module_api

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IdTypeModuleApiId = module_id.IdType("module_api:id")

Functions

func RegisterPlatform

func RegisterPlatform(platform *Platform)

Types

type GetAccessTokenFunc

type GetAccessTokenFunc = func(httpService httpx.IService, appId, appSecret string, extends map[string]any) (res *OauthInfo, err error)

type IGenId

type IGenId interface {
	GenId() (res int64)
}

type IOauthAccessTokenCache

type IOauthAccessTokenCache interface {
	Add(data *OauthAccessToken)
	Get(name string) (res *OauthAccessToken)
	GetIfPresent(name string) (res *OauthAccessToken)
}

type IOauthAccessTokenService

type IOauthAccessTokenService interface {
	GetAccessToken(name string) (res string, err error)
}

type IOauthAccessTokenStorage

type IOauthAccessTokenStorage interface {
	GetByName(name string) (res *OauthAccessToken, err error)
	Insert(in *OauthAccessToken) (res int64, err error)
	Update(in *OauthAccessToken) (res int64, err error)
	UpdateAccessToken(name string, accessToken string, expiresIn int64, expiresAt int64) (res int64, err error)
	Query(in *OauthAccessToken) (res []*OauthAccessToken, err error)
	Page(in *OauthAccessToken, pageNo int64, pageSize int64) (res []*OauthAccessToken, err error)
	DeleteByName(name string) (res int64, err error)
}

type OauthAccessToken

type OauthAccessToken struct {
	Name         string `json:"name" column:"name"`
	PlatformType string `json:"platformType" column:"platform_type"`
	OauthUrl     string `json:"oauthUrl" column:"oauth_url"`
	AppId        string `json:"appId" column:"app_id"`
	AppSecret    string `json:"appSecret" column:"app_secret"`
	Extends      string `json:"extends" column:"extends"`
	AccessToken  string `json:"accessToken" column:"access_token"`
	ExpiresIn    int64  `json:"expiresIn" column:"expires_in"`
	ExpiresAt    int64  `json:"expiresAt" column:"expires_at"`
	Status       int    `json:"status" column:"status"`
	CreatedAt    int64  `json:"createdAt" column:"created_at"`
	UpdatedAt    int64  `json:"updatedAt" column:"updated_at"`
}

func (*OauthAccessToken) GetPrimaryKey

func (this_ *OauthAccessToken) GetPrimaryKey() []string

func (*OauthAccessToken) GetTableName

func (this_ *OauthAccessToken) GetTableName() string

type OauthInfo

type OauthInfo struct {
	AccessToken string `json:"accessToken"`
	// ExpiresIn 有效期(秒),部分平台可能返回时间戳,业务层转换后存储
	ExpiresIn int64 `json:"expiresIn"`
}

func GetAccessToken

func GetAccessToken(platformType string, httpService httpx.IService, info *OauthAccessToken) (res *OauthInfo, err error)

type Platform

type Platform struct {
	Type string `json:"type,omitempty"`
	// contains filtered or unexported fields
}

func GetPlatform

func GetPlatform(platformType string) *Platform

func (*Platform) SetGetAccessToken

func (this_ *Platform) SetGetAccessToken(getAccessToken GetAccessTokenFunc) *Platform

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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