icsoc

package module
v0.0.0-...-1102109 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: MIT Imports: 7 Imported by: 0

README

icsoc

Latest Tag

Golang封装的中通天鸿的坐席操作平台SDK。

官网地址:http://dev.icsoc.net/docs/develop/authentication/

安装
go get -u gitee.com/cuckoopark/icsoc

Documentation

Index

Constants

View Source
const (
	// 认证方式
	GrantTypePassword = "password" // 密码认证

	// 权限范围
	ScopeOpenId = "openid" // OpenId

	// Token类型
	TokenTypeBearer = "Bearer"
)

Variables

This section is empty.

Functions

func PostAPI

func PostAPI(
	apiUrl string,
	header map[string]string,
	body map[string]string,
	data interface{},
) (err error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(clientId string, clientSecret string, enterpriseCode string) (client *Client)

初始化中通天鸿客户端

type GetAccessTokenBody

type GetAccessTokenBody struct {
	JobNumber string `json:"job_number"` // 工号
	Password  string `json:"password"`   // 密码
}

type GetAccessTokenResponse

type GetAccessTokenResponse struct {
	AccessToken  string `json:"access_token"`  // 后续所有的接口访问都需要带上此token
	ExpiresIn    int64  `json:"expires_in"`    // access_token有效时间,过期后将无法使用
	TokenType    string `json:"token_type"`    // Bearar,固定值,参见constant.go
	Scope        string `json:"scope"`         // 权限范围
	RefreshToken string `json:"refresh_token"` // 可以在access_token失效之前使用refresh_token来刷新access_token
}

Jump to

Keyboard shortcuts

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