oauth

package
v1.26.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package oauth OAuth授权相关API models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenRequest

type AccessTokenRequest struct {
	// AppId 开发者申请的应用APP_ID
	AppId uint64 `json:"app_id,omitempty"`
	// Secret 开发者应用的私钥Secret
	Secret string `json:"secret,omitempty"`
	// GrantType 授权类型。允许值: "auth_code"
	GrantType string `json:"grant_type,omitempty"`
	// AuthCode 授权码,在授权完成后回调时会提供该授权码,只有10分钟有效期,且只能使用一次,获取详情可见OAuth2.0授权
	AuthCode string `json:"auth_code,omitempty"`
	// RefreshToken 刷新token,从"获取Access Token"和“刷新Access Token”的返回结果中得到),刷新后会过期,请及时保存最新的token
	RefreshToken string `json:"refresh_token,omitempty"`
}

AccessTokenRequest 获取Access Token API Request

func (AccessTokenRequest) Encode

func (r AccessTokenRequest) Encode() []byte

Encode implement PostRequest interface

type AccessTokenResponse

type AccessTokenResponse struct {
	model.BaseResponse
	// Data json返回值
	Data *AccessTokenResponseData `json:"data,omitempty"`
}

AccessTokenResponse 获取Access Token API Response

type AccessTokenResponseData

type AccessTokenResponseData struct {
	// AccessToken 用于验证权限的token
	AccessToken string `json:"access_token,omitempty"`
	// RefreshToken 刷新access_token,用于获取新的access_token和refresh_token,并且刷新过期时间
	RefreshToken string `json:"refresh_token,omitempty"`
	// ExpiresIn access_token剩余有效时间,单位(秒)
	ExpiresIn int64 `json:"expires_in,omitempty"`
	// RefreshTokenExpiresIn refresh_token剩余有效时间,单位(秒)
	RefreshTokenExpiresIn int64 `json:"refresh_token_expires_in,omitempty"`
	// AdvertiserID (将废弃,当前支持代理商角色账号授权可一次授权多个账号,请使用advertiser_ids字段获取授权账号ID)登录用户对应的广告账户ID, 如果授权多个广告主默认为第一个
	AdvertiserID uint64 `json:"advertiser_id,omitempty"`
	// AdvertiserIDs 授权的账户id列表;该字段返回授权选择的账户id,包括管家、代理商、广告主等,具体角色说明可以通过【获取已授权账户】列表来获取
	AdvertiserIDs []uint64 `json:"advertiser_ids,omitempty"`
}

AccessTokenResponseData json返回值

type Advertiser

type Advertiser struct {
	// AdvertiserID 账号id
	AdvertiserID uint64 `json:"advertiser_id,omitempty"`
	// AccountStringID 账号id(字符串型)
	// 当advertiser_role=10有效,即抖音号类型时,即为aweme_sec_uid,可用于Dou+接口调用
	AccountStringID string `json:"account_string_id,omitempty"`
	// AdvertiserName 账号名称
	AdvertiserName string `json:"advertiser_name,omitempty"`
	// AdvertiserRole 账号角色,1-普通广告主,2-账号管家,3-一级代理商,4-二级代理商, 6-星图账号,10-抖音号(用于Dou+接口调用)
	AdvertiserRole uint `json:"advertiser_role,omitempty"`
	// IsValid 授权有效性,允许值:true/false;false表示对应的user在客户中心/一站式平台代理商平台变更了对此账号的权限,需要到对应平台进行调整过来;
	IsValid bool `json:"is_valid,omitempty"`
	// AccountRole 新版授权账号角色
	AccountRole enum.AccountRole `json:"account_role,omitempty"`
	// CompanyList
	CompanyList []Company `json:"company_list,omitempty"`
}

Advertiser 广告账户

type AdvertiserGetRequest

type AdvertiserGetRequest 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"`
}

AdvertiserGetRequest 获取已授权账户 API Request

func (AdvertiserGetRequest) Encode

func (r AdvertiserGetRequest) Encode() string

Encode implement GetRequest interface

type AdvertiserGetResponse

type AdvertiserGetResponse struct {
	model.BaseResponse
	// Data json返回值
	Data *AdvertiserGetResponseData `json:"data,omitempty"`
}

AdvertiserGetResponse 获取已授权账户 API Response

type AdvertiserGetResponseData

type AdvertiserGetResponseData struct {
	// List 广告主列表
	List []Advertiser `json:"list,omitempty"`
}

AdvertiserGetResponseData json返回值

type AppAccessTokenRequest added in v1.19.3

type AppAccessTokenRequest struct {
	// AppID 开发者申请的应用APP_ID,可通过“应用管理”界面查看
	AppID uint64 `json:"app_id,omitempty"`
	// Secret 开发者应用的私钥Secret,可通过“应用管理”界面查看(确保填入secret与app_id对应以免报错!)
	Secret string `json:"secret,omitempty"`
}

AppAccessTokenRequest 获取APP Access Token API Request

func (AppAccessTokenRequest) Encode added in v1.19.3

func (r AppAccessTokenRequest) Encode() []byte

Encode implement PostRequest interface

type AppAccessTokenResponse added in v1.19.3

type AppAccessTokenResponse struct {
	model.BaseResponse
	// Data json返回值
	Data *AppAccessTokenResult `json:"data,omitempty"`
}

AppAccessTokenResponse 获取App Access Token API Response

type AppAccessTokenResult added in v1.19.3

type AppAccessTokenResult struct {
	// AccessToken 应用级别token
	AccessToken string `json:"access_token,omitempty"`
	// ExpiresIn access_token剩余有效时间,单位(秒)
	ExpiresIn int64 `json:"expires_in,omitempty"`
}

AppAccessTokenResult

type Company added in v1.8.0

type Company struct {
	// CustomerCompanyID
	CustomerCompanyID uint64 `json:"customer_company_id,omitempty"`
	// CustomerCompanyName
	CustomerCompanyName string `json:"customer_company_name,omitempty"`
}

Company

type UserInfoResponse

type UserInfoResponse struct {
	// Data json返回值
	Data *UserInfoResponseData `json:"data,omitempty"`
	model.BaseResponse
}

UserInfoResponse 获取授权User信息 API Response

type UserInfoResponseData

type UserInfoResponseData struct {
	// Email 邮箱(已经脱敏处理)
	Email string `json:"email,omitempty"`
	// DisplayName 用户名
	DisplayName string `json:"display_name,omitempty"`
	// TokenScopeList 权限点list
	TokenScopeList []uint64 `json:"token_scope_list,omitempty"`
	// TokenApiList 当前token可操作的api接口列表
	TokenApiList []string `json:"token_api_list,omitempty"`
	// ID 用户id
	ID uint64 `json:"id,omitempty"`
	// AppID 授权的应用id
	AppID uint64 `json:"app_id,omitempty"`
	// MaterialAuditStatus 是否敏感物料授权, true 已敏感物料授权, false 未敏感物料授权
	MaterialAuditStatus bool `json:"material_audit_status,omitempty"`
}

UserInfoResponseData userinfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL