oauth

package
v0.0.0-...-4c075ac Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 4 Imported by: 0

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 string `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"`
	// AdvertiserName 账号名称
	AdvertiserName string `json:"advertiser_name,omitempty"`
	// AdvertiserRole 账号角色,1-普通广告主,2-账号管家,3-一级代理商,4-二级代理商
	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 string `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 Company

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 {
	model.BaseResponse
	// Data json返回值
	Data *UserInfoResponseData `json:"data,omitempty"`
}

UserInfoResponse 获取授权User信息 API Response

type UserInfoResponseData

type UserInfoResponseData struct {
	// ID 用户id
	ID uint64 `json:"id,omitempty"`
	// Email 邮箱(已经脱敏处理)
	Email string `json:"email,omitempty"`
	// DisplayName 用户名
	DisplayName string `json:"display_name,omitempty"`
}

UserInfoResponseData userinfo

Jump to

Keyboard shortcuts

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