-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package oauth | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/oauth" | ||
) | ||
|
||
// ApprovalList 拉取token下授权广告账户接口 | ||
func ApprovalList(clt *core.SDKClient, accessToken string) ([]uint64, error) { | ||
req := &oauth.ApprovalListRequest{ | ||
AppID: clt.AppID(), | ||
Secret: clt.Secret(), | ||
AccessToken: accessToken, | ||
} | ||
var resp oauth.ApprovalListResponse | ||
err := clt.Post("", req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return resp.Details, nil | ||
} |
23 changes: 23 additions & 0 deletions
23
model/oauth/access_token_response.go → model/oauth/access_token.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package oauth | ||
|
||
import "encoding/json" | ||
|
||
// ApprovalListRequest 拉取token下授权广告账户接口 API Request | ||
type ApprovalListRequest struct { | ||
// AppID 申请应用后快手返回的 app_id | ||
AppID uint64 `json:"app_id,omitempty"` | ||
// Secret 申请应用后快手返回的 secret | ||
Secret string `json:"secret,omitempty"` | ||
// AccessToken 查询的 access_token | ||
AccessToken string `json:"access_token,omitempty"` | ||
// PageNo 分页页码,必填 | ||
PageNo int `json:"page_no,omitempty"` | ||
// PageSize 分页每页展示条数,必填,最大值为1000 | ||
PageSize int `json:"page_size,omitempty"` | ||
} | ||
|
||
// Url implement PostRequest interface | ||
func (r ApprovalListRequest) Url() string { | ||
return "oauth2/authorize/approval/list" | ||
} | ||
|
||
// Encode implement PostRequest interface | ||
func (r ApprovalListRequest) Encode() []byte { | ||
buf, _ := json.Marshal(r) | ||
return buf | ||
} | ||
|
||
// ApprovalListResponse 拉取token下授权广告账户接口 API Response | ||
type ApprovalListResponse struct { | ||
// Details 查询获得的广告主 ID | ||
Details []uint64 `json:"details,omitempty"` | ||
} |