-
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
77 changed files
with
2,289 additions
and
89 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,22 @@ | ||
package advertiser | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model" | ||
"github.com/bububa/spotlight-mapi/model/oauth" | ||
) | ||
|
||
// AccessToken 获取accessToken | ||
func AccessToken(ctx context.Context, clt *core.SDKClient, advertiserID uint64) (*oauth.AccessToken, error) { | ||
req := model.CommonRequest{ | ||
AdvertiserID: advertiserID, | ||
Method: "oauth.getAccessToken", | ||
} | ||
var ret oauth.AccessTokenResponse | ||
if err := clt.Post(ctx, "/common", req, &ret, ""); err != nil { | ||
return nil, err | ||
} | ||
return ret.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,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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package conversion | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/conversion" | ||
) | ||
|
||
// App APP口令码数据回传 | ||
func App(ctx context.Context, clt *core.SDKClient, req *conversion.AppRequest) error { | ||
return clt.Post(ctx, "/app", req, 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,13 @@ | ||
package conversion | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/conversion" | ||
) | ||
|
||
// AuroraLeads 线索转化数据回传 | ||
func AuroraLeads(ctx context.Context, clt *core.SDKClient, req *conversion.AuroraLeadsRequest) error { | ||
return clt.Post(ctx, "/common", req, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package conversion | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/conversion" | ||
) | ||
|
||
// HawkingLeads 聚光落地页线索数据回传 | ||
func HawkingLeads(ctx context.Context, clt *core.SDKClient, req *conversion.HawkingLeadsRequest) error { | ||
return clt.PostHawkingLeads(ctx, req) | ||
} |
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,17 @@ | ||
package offline | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/offline" | ||
) | ||
|
||
// Advertiser 账户层级离线数据 | ||
func Advertiser(ctx context.Context, clt *core.SDKClient, req *offline.Request, accessToken string) (*offline.ReportList, error) { | ||
var resp offline.Response | ||
if err := clt.Post(ctx, "/jg/data/report/offline/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,17 @@ | ||
package offline | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/offline" | ||
) | ||
|
||
// Campaign 广告计划层级离线数据 | ||
func Campaign(ctx context.Context, clt *core.SDKClient, req *offline.Request, accessToken string) (*offline.ReportList, error) { | ||
var resp offline.Response | ||
if err := clt.Post(ctx, "/jg/data/report/offline/campaign", 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,17 @@ | ||
package offline | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/offline" | ||
) | ||
|
||
// Creativity 广告创意层级离线数据 | ||
func Creativity(ctx context.Context, clt *core.SDKClient, req *offline.Request, accessToken string) (*offline.ReportList, error) { | ||
var resp offline.Response | ||
if err := clt.Post(ctx, "/jg/data/report/offline/creativity", 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 offline 离线报表 | ||
package offline |
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 offline | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/offline" | ||
) | ||
|
||
// Keyword 关键词层级离线数据 | ||
func Keyword(ctx context.Context, clt *core.SDKClient, req *offline.Request, accessToken string) (*offline.ReportList, error) { | ||
var resp offline.Response | ||
if err := clt.Post(ctx, "/jg/data/report/offline/keyword", 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,17 @@ | ||
package offline | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/offline" | ||
) | ||
|
||
// Unit 广告单元层级离线数据 | ||
func Unit(ctx context.Context, clt *core.SDKClient, req *offline.Request, accessToken string) (*offline.ReportList, error) { | ||
var resp offline.Response | ||
if err := clt.Post(ctx, "/jg/data/report/offline/unit", 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,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.DataReportDTO, 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,17 @@ | ||
package realtime | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/realtime" | ||
) | ||
|
||
// Campaign 计划层级实时数据 | ||
func Campaign(ctx context.Context, clt *core.SDKClient, req *realtime.CampaignRequest, accessToken string) (*realtime.CampaignResponse, error) { | ||
resp := new(realtime.CampaignResponse) | ||
if err := clt.Post(ctx, "/jg/data/report/realtime/campaign", req, resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp, 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,17 @@ | ||
package realtime | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/realtime" | ||
) | ||
|
||
// Creativity 创意层级实时数据 | ||
func Creativity(ctx context.Context, clt *core.SDKClient, req *realtime.CreativityRequest, accessToken string) (*realtime.CreativityResponse, error) { | ||
resp := new(realtime.CreativityResponse) | ||
if err := clt.Post(ctx, "/jg/data/report/realtime/creativity", req, resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp, 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,17 @@ | ||
package realtime | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/realtime" | ||
) | ||
|
||
// Keyword 关键词层级实时数据 | ||
func Keyword(ctx context.Context, clt *core.SDKClient, req *realtime.KeywordRequest, accessToken string) (*realtime.KeywordResponse, error) { | ||
resp := new(realtime.KeywordResponse) | ||
if err := clt.Post(ctx, "/jg/data/report/realtime/keyword", req, resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp, 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,17 @@ | ||
package realtime | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/spotlight-mapi/core" | ||
"github.com/bububa/spotlight-mapi/model/report/realtime" | ||
) | ||
|
||
// Unit 单元层级实时数据 | ||
func Unit(ctx context.Context, clt *core.SDKClient, req *realtime.UnitRequest, accessToken string) (*realtime.UnitResponse, error) { | ||
resp := new(realtime.UnitResponse) | ||
if err := clt.Post(ctx, "/jg/data/report/realtime/unit", req, resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp, 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 unit 广告单元相关 | ||
package unit |
Oops, something went wrong.