Skip to content

Commit 59bb4d9

Browse files
committed
chore: auto update client api apecloud/apecloud@ab5de80
1 parent bdf46cf commit 59bb4d9

File tree

3 files changed

+33
-16
lines changed

3 files changed

+33
-16
lines changed

.generator/schemas/adminapi.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14707,7 +14707,6 @@ paths:
1470714707
summary: Create a new key
1470814708
description: Store a new key in the system.
1470914709
requestBody:
14710-
required: true
1471114710
content:
1471214711
application/json:
1471314712
schema:
@@ -14720,7 +14719,7 @@ paths:
1472014719
schema:
1472114720
$ref: '#/components/schemas/key'
1472214721
'400':
14723-
description: Invalid input provided.
14722+
$ref: '#/components/responses/400'
1472414723
'401':
1472514724
$ref: '#/components/responses/401'
1472614725
'403':

apecloud

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit e529ca9797063f52fab310db20f33c4cdf06afd0
1+
Subproject commit ab5de80400501de98662a5e28e1896561eeede3e

api/kbcloud/admin/api_key.go

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,40 @@ import (
1717
// KeyApi service type
1818
type KeyApi common.Service
1919

20+
// CreateKeyOptionalParameters holds optional parameters for CreateKey.
21+
type CreateKeyOptionalParameters struct {
22+
Body *Key
23+
}
24+
25+
// NewCreateKeyOptionalParameters creates an empty struct for parameters.
26+
func NewCreateKeyOptionalParameters() *CreateKeyOptionalParameters {
27+
this := CreateKeyOptionalParameters{}
28+
return &this
29+
}
30+
31+
// WithBody sets the corresponding parameter name and returns the struct.
32+
func (r *CreateKeyOptionalParameters) WithBody(body Key) *CreateKeyOptionalParameters {
33+
r.Body = &body
34+
return r
35+
}
36+
2037
// CreateKey Create a new key.
2138
// Store a new key in the system.
22-
func (a *KeyApi) CreateKey(ctx _context.Context, body Key) (Key, *_nethttp.Response, error) {
39+
func (a *KeyApi) CreateKey(ctx _context.Context, o ...CreateKeyOptionalParameters) (Key, *_nethttp.Response, error) {
2340
var (
2441
localVarHTTPMethod = _nethttp.MethodPost
2542
localVarPostBody interface{}
2643
localVarReturnValue Key
44+
optionalParams CreateKeyOptionalParameters
2745
)
2846

47+
if len(o) > 1 {
48+
return localVarReturnValue, nil, common.ReportError("only one argument of type CreateKeyOptionalParameters is allowed")
49+
}
50+
if len(o) == 1 {
51+
optionalParams = o[0]
52+
}
53+
2954
// Add api info to context
3055
apiInfo := common.APIInfo{
3156
Tag: "key",
@@ -46,10 +71,12 @@ func (a *KeyApi) CreateKey(ctx _context.Context, body Key) (Key, *_nethttp.Respo
4671
localVarQueryParams := _neturl.Values{}
4772
localVarFormParams := _neturl.Values{}
4873
localVarHeaderParams["Content-Type"] = "application/json"
49-
localVarHeaderParams["Accept"] = "*/*"
74+
localVarHeaderParams["Accept"] = "application/json"
5075

5176
// body params
52-
localVarPostBody = &body
77+
if optionalParams.Body != nil {
78+
localVarPostBody = &optionalParams.Body
79+
}
5380
common.SetAuthKeys(
5481
ctx,
5582
&localVarHeaderParams,
@@ -75,16 +102,7 @@ func (a *KeyApi) CreateKey(ctx _context.Context, body Key) (Key, *_nethttp.Respo
75102
ErrorBody: localVarBody,
76103
ErrorMessage: localVarHTTPResponse.Status,
77104
}
78-
if localVarHTTPResponse.StatusCode == 400 {
79-
var v None
80-
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
81-
if err != nil {
82-
return localVarReturnValue, localVarHTTPResponse, newErr
83-
}
84-
newErr.ErrorModel = v
85-
return localVarReturnValue, localVarHTTPResponse, newErr
86-
}
87-
if localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 {
105+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 {
88106
var v APIErrorResponse
89107
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
90108
if err != nil {

0 commit comments

Comments
 (0)