rest_api

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServiceName string   `json:"service_name" yaml:"service_name"`
	Urls        []string `json:"urls"         yaml:"urls"`
	User        string   `json:"user"         yaml:"user"`
	Pass        string   `json:"pass"         yaml:"pass"`
	SignName    string   `json:"sign_name"    yaml:"sign_name"`
}

ServiceAPI config struct

type RestApi

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

*

  • RestApi
  • @Description:

*

func NewRestInstances

func NewRestInstances(conf Config, signs *http_sign.SignMgr) *RestApi

* * @Description: new restapi impl * @param: conf * @return: *RestApi * @Author: Iori * @Date: 2022-07-06 15:14:20 *

func (*RestApi) Get

func (self *RestApi) Get(uin int64, uriMap *map[string]string) ([]byte, error)

* * @Description: get请求 * @param: uin * @param: uriMap * @return: map[string]interface{} * @return: error * @Author: Iori * @Date: 2022-07-06 17:11:14 *

func (*RestApi) Post

func (self *RestApi) Post(common_param, actions *map[string]interface{}) ([]byte, error)

* * @Description: post新规范请求 * @param: uin * @param: uriMap * @return: map[string]interface{} * @return: error * @Author: Iori * @Date: 2022-07-06 17:11:32 *

func (*RestApi) SignGet

func (self *RestApi) SignGet(uin int64, uriMap *map[string]string) ([]byte, error)

* * @Description: 带签名的get请求 * @param: uin * @param: uriMap * @return: map[string]interface{} * @return: error * @Author: Iori * @Date: 2022-07-06 17:11:14 *

func (*RestApi) SignPost

func (self *RestApi) SignPost(common_param, actions *map[string]interface{}) ([]byte, error)

* * @Description: 带签名的post,新规范请求 * @param: uin * @param: uriMap * @return: map[string]interface{} * @return: error * @Author: Iori * @Date: 2022-07-06 17:11:32 *

func (*RestApi) SignPostV2

func (self *RestApi) SignPostV2(headMap, uriMap *map[string]string, actions *map[string]interface{}) ([]byte, error)

* * @Description: 带签名的post,不带规范 * @param: uin * @param: uriMap * @return: map[string]interface{} * @return: error * @Author: Iori * @Date: 2025-03-15 17:11:32 *

type RestApiMgr

type RestApiMgr struct {
	Instances map[string]*RestApi
	// contains filtered or unexported fields
}

*

  • RestApiMgr
  • @Description:

*

func NewRestApiMgr

func NewRestApiMgr() *RestApiMgr

* * @Description: 创建restApi管理器 * @return: *RestApiMgr * @Author: Iori * @Date: 2022-02-14 11:28:59 *

func (*RestApiMgr) GetRestIns

func (self *RestApiMgr) GetRestIns(keys ...string) *RestApi

* * @Description: 获取restApi实例 * @receiver: self * @param: key * @param: o * @Author: Iori * @Date: 2022-02-14 11:29:20 *

func (*RestApiMgr) Init

func (self *RestApiMgr) Init(cfgs []Config, signs *http_sign.SignMgr)

* * @Description: 初始化RestApi管理器 * @receiver: self * @param: cfgs * @return: error * @Author: Iori * @Date: 2022-02-14 11:29:45 *

func (*RestApiMgr) SetRestIns

func (self *RestApiMgr) SetRestIns(key string, impl *RestApi)

* * @Description: 设置restApi实例 * @param: key * @param: impl * @Author: Iori * @Date: 2022-02-14 16:13:53 *

func (*RestApiMgr) Tick

func (self *RestApiMgr) Tick(nowMs int64)

* * @Description: tick * @receiver: self * @param: nowMs * @Author: Iori * @Date: 2022-02-14 11:39:54 *

type UrlConfig

type UrlConfig struct {
	Urls     []string
	UrlCount int64
}

*

  • UrlConfig
  • @Description:

*

func NewUrlConf

func NewUrlConf(urls []string) (config *UrlConfig)

* * @Description: 创建url实例 * @param: urls * @return: config * @Author: Iori * @Date: 2022-07-06 15:12:21 *

func (*UrlConfig) GetHashUrl

func (self *UrlConfig) GetHashUrl(uin ...int64) string

* * @Description: 根据uin hash获取 * @param: uin * @return: string * @Author: Iori * @Date: 2022-07-06 15:12:24 *

Jump to

Keyboard shortcuts

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