No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 0.0.1
- Package version: 0.0.10
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import xapis "github.com/xopenapi/xapis-go"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), xapis.ContextServerIndex, 1)
Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), xapis.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), xapis.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), xapis.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
All URIs are relative to https://api.growingbox.cn
Class | Method | HTTP request | Description |
---|---|---|---|
ConfigApi | CreateConfig | Post /config/v1/configs | 创建配置 |
ConfigApi | CreateConfigGroup | Post /config/v1/config_groups | 创建配置组 |
ConfigApi | CreateConfigTemplate | Post /config/v1/config_templates | 创建配置模版 |
ConfigApi | DeleteConfig | Delete /config/v1/configs/{id} | 删除配置 |
ConfigApi | DeleteConfigGroup | Delete /config/v1/config_groups/{id} | 删除配置组 |
ConfigApi | DeleteConfigTemplate | Delete /config/v1/config_templates/{id} | 删除配置模板 |
ConfigApi | GetConfig | Get /config/v1/configs/{id} | 查询配置 |
ConfigApi | GetConfigByKey | Get /config/v1/configs | 根据配置项查询配置 |
ConfigApi | GetConfigGroup | Get /config/v1/config_groups/{id} | 查询配置组 |
ConfigApi | GetConfigTemplate | Get /config/v1/config_templates/{id} | 查询配置模板 |
ConfigApi | GetConfigTemplateByKey | Get /config/v1/config_templates | 根据配置项查询配置模版 |
ConfigApi | UpdateConfig | Patch /config/v1/configs/{id} | 更新配置 |
ConfigApi | UpdateConfigGroup | Patch /config/v1/config_groups/{id} | 更新配置组 |
ConfigApi | UpdateConfigTemplate | Patch /config/v1/config_templates/{id} | 更新配置模板 |
SilkCodecApi | DecodeSilkV3 | Post /silk/v3/decode | 解码silk-v3格式的语音 |
SilkCodecApi | DecodeSilkV3ByURL | Get /silk/v3/decode | 将链接解码silk-v3格式的语音 |
SilkCodecApi | EncodeSilkV3 | Post /silk/v3/encode | 将语音编码为silk-v3格式 |
SilkCodecApi | EncodeSilkV3ByURL | Get /silk/v3/encode | 将语音链接编码为silk-v3格式 |
SmsApi | SendSMS | Post /sms/v1/send | 发送短信 |
StorageApi | GetAudioInfo | Get /storage/v1/audio_info | 获取音频信息 |
StorageApi | GetStorageTemporaryCredentials | Get /storage/v1/temporary_credentials | 获取上传文件临时凭证 |
StorageApi | GetVideoInfo | Get /storage/v1/video_info | 获取视频信息 |
StorageApi | GetVideoSnapshot | Get /storage/v1/video_snapshot | 获取视频截图 |
- ApiError
- AudioInfo
- Config
- ConfigGroup
- ConfigTemplate
- CreateConfig
- CreateConfigGroup
- CreateConfigTemplate
- Provider
- SendSMS
- SendSMSResult
- StorageTemporaryCredentials
- UpdateConfig
- UpdateConfigGroup
- UpdateConfigTemplate
- VideoInfo
- VideoSnapshot
- Type: API key
- API key parameter name: X-Client-ID
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: X-Client-ID and passed in as the auth context for each request.
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- configs:read: 读取配置、配置模版、配置组
- configs:write: 创建、更新配置、配置模版、配置组
- configs:delete: 删除配置、配置模版、配置组
- storage:read: 读取云存储资源
- storage.credentials:read: 获取云存储上传凭证
- sms:send: 发送短信
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
import "golang.org/x/oauth2"
/* Perform OAuth2 round trip request and obtain a token */
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime