-
Notifications
You must be signed in to change notification settings - Fork 0
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
48 changed files
with
1,305 additions
and
54 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,17 @@ | ||
package advertiser | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/advertiser" | ||
) | ||
|
||
// BalanceInfo 获取账号余额接口 | ||
func BalanceInfo(ctx context.Context, clt *core.SDKClient, req *advertiser.BalanceInfoRequest, accessToken string) (*advertiser.Balance, error) { | ||
var resp advertiser.BalanceInfoResponse | ||
if err := clt.Get(ctx, "/jg/account/balance/info", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
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,2 @@ | ||
// Package advertiser 广告主相关 | ||
package advertiser |
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,20 @@ | ||
package oauth | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/oauth" | ||
) | ||
|
||
// AccessToken 获取Token | ||
// 利用授权码 auth_code,请求小红书服务器,获取 access_token 和 refresh_token 及当前账户的广告主 ID。 | ||
func AccessToken(ctx context.Context, clt *core.SDKClient, req *oauth.AccessTokenRequest) (*oauth.AccessToken, error) { | ||
req.AppID = clt.AppID() | ||
req.Secret = clt.Secret() | ||
var resp oauth.AccessTokenResponse | ||
if err := clt.Post(ctx, "/oauth2/access_token", req, &resp, ""); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
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,2 @@ | ||
// Package oauth 授权相关 | ||
package oauth |
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,20 @@ | ||
package oauth | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/oauth" | ||
) | ||
|
||
// RefreshToken 刷新Token | ||
// 请求小红书服务器,刷新 access_token 和 refresh_token 及 token 过期时间。 | ||
func RefreshToken(ctx context.Context, clt *core.SDKClient, req *oauth.RefreshTokenRequest) (*oauth.AccessToken, error) { | ||
req.AppID = clt.AppID() | ||
req.Secret = clt.Secret() | ||
var resp oauth.AccessTokenResponse | ||
if err := clt.Post(ctx, "/oauth2/refresh_token", req, &resp, ""); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
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,15 @@ | ||
package oauth | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/oauth" | ||
"github.com/bububa/spotlight-mapi/util" | ||
) | ||
|
||
// URL 生成oauth授权链接 | ||
func URL(ctx context.Context, clt *core.SDKClient, req *oauth.URLRequest) string { | ||
req.AppID = clt.AppID() | ||
return util.StringsJoin(core.OAUTH_URL, "?", req.Encode()) | ||
} |
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,2 @@ | ||
// Package report 报表相关 | ||
package report |
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,18 @@ | ||
package realtime | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report" | ||
"github.com/bububa/spotlight-mapi/model/report/realtime" | ||
) | ||
|
||
// Advertiser 账户层级实时数据 | ||
func Advertiser(ctx context.Context, clt *core.SDKClient, req *realtime.AdvertiserRequest, accessToken string) (*report.Metric, error) { | ||
var resp realtime.AdvertiserResponse | ||
if err := clt.Post(ctx, "/jg/data/report/realtime/account", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
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,3 @@ | ||
// Package realtime 实时报表 | ||
package realtime | ||
|
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,2 @@ | ||
// Package unit 广告单元相关 | ||
package unit |
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,17 @@ | ||
package unit | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/unit" | ||
) | ||
|
||
// List 获取单元列表接口 | ||
func List(ctx context.Context, clt *core.SDKClient, req *unit.ListRequest, accessToken string) (*unit.ListResult, error) { | ||
var resp unit.ListResponse | ||
if err := clt.Post(ctx, "/jg/unit/list", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
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
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,11 @@ | ||
package enum | ||
|
||
// ApprovalRoleType 授权账号类型 | ||
type ApprovalRoleType int | ||
|
||
const ( | ||
// ApprovalRoleType_BRAND 品牌 | ||
ApprovalRoleType_BRAND ApprovalRoleType = 4 | ||
// ApprovalRoleType_AGENCY 代理商 | ||
ApprovalRoleType_AGENCY ApprovalRoleType = 601 | ||
) |
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,9 @@ | ||
package enum | ||
|
||
// CrowdActionType 行为类型 | ||
type CrowdActionType string | ||
|
||
const ( | ||
CrowdActionType_IMP CrowdActionType = "imp" | ||
CrowdActionType_READ CrowdActionType = "read" | ||
) |
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,14 @@ | ||
package enum | ||
|
||
// DeveloperRoleType 应用角色类型 | ||
type DeveloperRoleType int | ||
|
||
const ( | ||
|
||
// DeveloperRoleType_BRAND 品牌开发者 | ||
DeveloperRoleType_BRAND DeveloperRoleType = 1 | ||
// DeveloperRoleType_AGENCY 代理商开发者, | ||
DeveloperRoleType_AGENCY DeveloperRoleType = 2 | ||
// DeveloperRoleType_SERVICE_PROVIDER 服务商开发者 | ||
DeveloperRoleType_SERVICE_PROVIDER DeveloperRoleType = 3 | ||
) |
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,15 @@ | ||
package enum | ||
|
||
// KeywordGenType 单元选词方式 | ||
type KeywordGenType int | ||
|
||
const ( | ||
// KeywordGenType_UNSPECIFIED 无意义默认值 | ||
KeywordGenType_UNSPECIFIED KeywordGenType = -1 | ||
// KeywordGenType_MANUAL 手动选词 | ||
KeywordGenType_MANUAL KeywordGenType = 0 | ||
// KeywordGenType_INTELLIGENT 智能拓词 | ||
KeywordGenType_INTELLIGENT KeywordGenType = 1 | ||
// KeywordGenType_MANUAL_INTELLIGENT 手动+智能 | ||
KeywordGenType_MANUAL_INTELLIGENT KeywordGenType = 2 | ||
) |
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,13 @@ | ||
package enum | ||
|
||
// KeywordTargetAction 关键词定向行为 | ||
type KeywordTargetAction int | ||
|
||
const ( | ||
// KeywordTargetAction_SEARCH 搜索 | ||
KeywordTargetAction_SEARCH KeywordTargetAction = 1 | ||
// KeywordTargetAction_INTERACTIVE 互动 | ||
KeywordTargetAction_INTERACTIVE KeywordTargetAction = 2 | ||
// KeywordTargetAction_READ 阅读 | ||
KeywordTargetAction_READ KeywordTargetAction = 3 | ||
) |
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,13 @@ | ||
package enum | ||
|
||
// LandingPageType 落地页链接类型 | ||
type LandingPageType int | ||
|
||
const ( | ||
// LandingPageTYpe_UNSPECIFIED 默认值,无实际意义 | ||
LandingPageType_UNSPECIFIED LandingPageType = 0 | ||
// LandingPageType_FORM 表单 | ||
LandingPageType_FORM LandingPageType = 1 | ||
// LandingPageType_LINK 外跳链接 | ||
LandingPageType_LINK LandingPageType = 2 | ||
) |
Oops, something went wrong.