Skip to content

Commit

Permalink
Merge branch 'release/v1.9.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Aug 28, 2024
2 parents 9a516a9 + 0287e07 commit d6e4df7
Show file tree
Hide file tree
Showing 220 changed files with 1,261 additions and 699 deletions.
47 changes: 23 additions & 24 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ name: Go

on:
push:
branches: [ master, main ]
branches: [master, main]
pull_request:
branches: [ master, main ]
branches: [master, main]

jobs:

build:
runs-on: ubuntu-latest
env:
Expand All @@ -17,28 +16,28 @@ jobs:
run:
working-directory: ${{ env.GOPATH }}/${{ env.package }}
steps:
- uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/${{ env.package }}
- uses: actions/checkout@v4
with:
path: ${{ env.GOPATH }}/${{ env.package }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
cache-dependency-path: |
${{ env.GOPATH }}/${{ env.package }}/go.mod
${{ env.GOPATH }}/${{ env.package }}/go.sum
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.21.0"
cache-dependency-path: |
${{ env.GOPATH }}/${{ env.package }}/go.mod
${{ env.GOPATH }}/${{ env.package }}/go.sum
- name: Dependencies
run: go mod download
- name: Dependencies
run: go mod download

- name: Build
working-directory: ${{ env.GOPATH }}/${{ env.package }}
run: |
go build -v ./...
- name: Build
working-directory: ${{ env.GOPATH }}/${{ env.package }}
run: |
go build -v ./...
- name: Test
env:
APPKEY: ${{ secrets.APPKEY }}
SECRET: ${{ secrets.APP_SECRET }}
run: go test -v ./...
- name: Test
env:
APPKEY: ${{ secrets.APPKEY }}
SECRET: ${{ secrets.APP_SECRET }}
run: go test -v ./...
10 changes: 5 additions & 5 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: goreleaser
on:
push:
tags:
- '*'
- "*"

jobs:
goreleaser:
Expand All @@ -12,16 +12,16 @@ jobs:
cache: ${{ github.workspace }}/go.sum
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: ">=1.21.0"
cache-dependency-path: ${{ env.cache }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
Expand Down
10 changes: 5 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ before:
builds:
- skip: true
archives:
- id: "kwai-marketing-api"
- id: "kwai-marketing-api"
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
version_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "^test:"
354 changes: 177 additions & 177 deletions README.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions api/adcompass/advertisers.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package adcompass

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/adcompass"
)

// Advertisers 获取罗盘绑定广告主列
func Advertisers(clt *core.SDKClient, accessToken string, advertiserID uint64) ([]adcompass.Advertiser, error) {
func Advertisers(ctx context.Context, clt *core.SDKClient, accessToken string, advertiserID uint64) ([]adcompass.Advertiser, error) {
req := &adcompass.AdvertisersRequest{
AdvertiserID: advertiserID,
}
var resp adcompass.AdvertisersResponse
err := clt.Post(accessToken, req, &resp)
err := clt.Post(ctx, accessToken, req, &resp)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions api/adcompass/quota_tending.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package adcompass

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/adcompass"
)

// QuotaTending 磁力罗盘对外 quota 腾挪接口
func QuotaTending(clt *core.SDKClient, accessToken string, req *adcompass.QuotaTendingRequest) (string, error) {
func QuotaTending(ctx context.Context, clt *core.SDKClient, accessToken string, req *adcompass.QuotaTendingRequest) (string, error) {
var resp adcompass.QuotaTendingResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
if err := clt.Post(ctx, accessToken, req, &resp); err != nil {
return "", err
}
return resp.Describe, nil
Expand Down
6 changes: 4 additions & 2 deletions api/advertiser/budget_get.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package advertiser

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/advertiser"
)

// BudgetGet 账户日预算查询
func BudgetGet(clt *core.SDKClient, accessToken string, advertiserID uint64) (*advertiser.Budget, error) {
func BudgetGet(ctx context.Context, clt *core.SDKClient, accessToken string, advertiserID uint64) (*advertiser.Budget, error) {
req := &advertiser.BudgetGetRequest{
AdvertiserID: advertiserID,
}
var resp advertiser.Budget
if err := clt.Post(accessToken, req, &resp); err != nil {
if err := clt.Post(ctx, accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
Expand Down
6 changes: 4 additions & 2 deletions api/advertiser/fund_daily_flows.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package advertiser

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/advertiser"
)

// FundDailyFlows 获取广告账户流水信息
func FundDailyFlows(clt *core.SDKClient, accessToken string, req *advertiser.FundDailyFlowsRequest) (*advertiser.FundDailyFlowsResponse, error) {
func FundDailyFlows(ctx context.Context, clt *core.SDKClient, accessToken string, req *advertiser.FundDailyFlowsRequest) (*advertiser.FundDailyFlowsResponse, error) {
var resp advertiser.FundDailyFlowsResponse
err := clt.Post(accessToken, req, &resp)
err := clt.Post(ctx, accessToken, req, &resp)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions api/advertiser/fund_get.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package advertiser

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/advertiser"
)

// FundGet 获取广告账户余额信息
func FundGet(clt *core.SDKClient, accessToken string, advertiserID uint64) (float64, error) {
func FundGet(ctx context.Context, clt *core.SDKClient, accessToken string, advertiserID uint64) (float64, error) {
req := &advertiser.FundGetRequest{
AdvertiserID: advertiserID,
}
var resp advertiser.FundGetResponse
err := clt.Post(accessToken, req, &resp)
err := clt.Post(ctx, accessToken, req, &resp)
if err != nil {
return 0, err
}
Expand Down
6 changes: 4 additions & 2 deletions api/advertiser/info.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package advertiser

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/advertiser"
)

// Info 获取广告账户信息
func Info(clt *core.SDKClient, accessToken string, advertiserID uint64) (*advertiser.Info, error) {
func Info(ctx context.Context, clt *core.SDKClient, accessToken string, advertiserID uint64) (*advertiser.Info, error) {
req := &advertiser.InfoRequest{
AdvertiserID: advertiserID,
}
var resp advertiser.Info
err := clt.Post(accessToken, req, &resp)
err := clt.Post(ctx, accessToken, req, &resp)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions api/advertiser/update_budget.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package advertiser

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/advertiser"
)

// UpdateBudget 修改账户预算
func UpdateBudget(clt *core.SDKClient, accessToken string, req *advertiser.UpdateBudgetRequest) error {
return clt.Post(accessToken, req, nil)
func UpdateBudget(ctx context.Context, clt *core.SDKClient, accessToken string, req *advertiser.UpdateBudgetRequest) error {
return clt.Post(ctx, accessToken, req, nil)
}
6 changes: 4 additions & 2 deletions api/advertiser/white_list.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package advertiser

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/advertiser"
)

// WhiteList 获取可选白名单接口
func WhiteList(clt *core.SDKClient, accessToken string, advertiserID uint64) (*advertiser.WhiteListResponse, error) {
func WhiteList(ctx context.Context, clt *core.SDKClient, accessToken string, advertiserID uint64) (*advertiser.WhiteListResponse, error) {
req := &advertiser.WhiteListRequest{
AdvertiserID: advertiserID,
}
var resp advertiser.WhiteListResponse
err := clt.Get(accessToken, req, &resp)
err := clt.Get(ctx, accessToken, req, &resp)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions api/appcenter/app/create_android.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package app

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/appcenter/app"
)

// CreateAndroid 创建Android应用
func CreateAndroid(clt *core.SDKClient, accessToken string, req *app.CreateAndroidRequest) (*app.App, error) {
func CreateAndroid(ctx context.Context, clt *core.SDKClient, accessToken string, req *app.CreateAndroidRequest) (*app.App, error) {
var resp app.App
if err := clt.Post(accessToken, req, &resp); err != nil {
if err := clt.Post(ctx, accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
Expand Down
6 changes: 4 additions & 2 deletions api/appcenter/app/create_ios.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package app

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/appcenter/app"
)

// CreateIos 创建iOS应用
func CreateIos(clt *core.SDKClient, accessToken string, req *app.CreateIosRequest) (*app.App, error) {
func CreateIos(ctx context.Context, clt *core.SDKClient, accessToken string, req *app.CreateIosRequest) (*app.App, error) {
var resp app.App
if err := clt.Post(accessToken, req, &resp); err != nil {
if err := clt.Post(ctx, accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
Expand Down
6 changes: 4 additions & 2 deletions api/appcenter/app/detail.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package app

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/appcenter/app"
)

// Detail 【应用中心】获取应用详情
func Detail(clt *core.SDKClient, accessToken string, req *app.DetailRequest) (*app.App, error) {
func Detail(ctx context.Context, clt *core.SDKClient, accessToken string, req *app.DetailRequest) (*app.App, error) {
var resp app.App
if err := clt.Post(accessToken, req, &resp); err != nil {
if err := clt.Post(ctx, accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
Expand Down
5 changes: 3 additions & 2 deletions api/appcenter/app/ios_update.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package app

import (
"context"
"errors"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/appcenter/app"
)

// IosUpdate iOS 应用上报更新
func IosUpdate(clt *core.SDKClient, accessToken string, req *app.IosUpdateRequest) error {
func IosUpdate(ctx context.Context, clt *core.SDKClient, accessToken string, req *app.IosUpdateRequest) error {
var resp app.IosUpdateResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
if err := clt.Post(ctx, accessToken, req, &resp); err != nil {
return err
}
if !resp.Result {
Expand Down
6 changes: 4 additions & 2 deletions api/appcenter/app/list.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package app

import (
"context"

"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/appcenter/app"
)

// List 【应用中心】获取应用列表
func List(clt *core.SDKClient, accessToken string, req *app.ListRequest) (*app.ListResponse, error) {
func List(ctx context.Context, clt *core.SDKClient, accessToken string, req *app.ListRequest) (*app.ListResponse, error) {
var resp app.ListResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
if err := clt.Post(ctx, accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
Expand Down
Loading

0 comments on commit d6e4df7

Please sign in to comment.