Skip to content

Commit f107ebe

Browse files
chore(internal): use explicit returns
1 parent 6dfc676 commit f107ebe

File tree

10 files changed

+38
-38
lines changed

10 files changed

+38
-38
lines changed

adminauthprovider.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,51 +39,51 @@ func (r *AdminAuthProviderService) New(ctx context.Context, body AdminAuthProvid
3939
opts = slices.Concat(r.Options, opts)
4040
path := "v1/admin/auth_providers"
4141
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
42-
return
42+
return res, err
4343
}
4444

4545
// List a page of auth providers that are available to the caller
4646
func (r *AdminAuthProviderService) List(ctx context.Context, opts ...option.RequestOption) (res *AdminAuthProviderListResponse, err error) {
4747
opts = slices.Concat(r.Options, opts)
4848
path := "v1/admin/auth_providers"
4949
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
50-
return
50+
return res, err
5151
}
5252

5353
// Delete a specific auth provider
5454
func (r *AdminAuthProviderService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *AuthProviderResponse, err error) {
5555
opts = slices.Concat(r.Options, opts)
5656
if id == "" {
5757
err = errors.New("missing required id parameter")
58-
return
58+
return nil, err
5959
}
6060
path := fmt.Sprintf("v1/admin/auth_providers/%s", id)
6161
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
62-
return
62+
return res, err
6363
}
6464

6565
// Get the details of a specific auth provider
6666
func (r *AdminAuthProviderService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *AuthProviderResponse, err error) {
6767
opts = slices.Concat(r.Options, opts)
6868
if id == "" {
6969
err = errors.New("missing required id parameter")
70-
return
70+
return nil, err
7171
}
7272
path := fmt.Sprintf("v1/admin/auth_providers/%s", id)
7373
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
74-
return
74+
return res, err
7575
}
7676

7777
// Patch an existing auth provider
7878
func (r *AdminAuthProviderService) Patch(ctx context.Context, id string, body AdminAuthProviderPatchParams, opts ...option.RequestOption) (res *AuthProviderResponse, err error) {
7979
opts = slices.Concat(r.Options, opts)
8080
if id == "" {
8181
err = errors.New("missing required id parameter")
82-
return
82+
return nil, err
8383
}
8484
path := fmt.Sprintf("v1/admin/auth_providers/%s", id)
8585
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
86-
return
86+
return res, err
8787
}
8888

8989
type AuthProviderCreateRequestParam struct {

adminsecret.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ func (r *AdminSecretService) New(ctx context.Context, secretKey string, body Adm
3939
opts = slices.Concat(r.Options, opts)
4040
if secretKey == "" {
4141
err = errors.New("missing required secret_key parameter")
42-
return
42+
return nil, err
4343
}
4444
path := fmt.Sprintf("v1/admin/secrets/%s", secretKey)
4545
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
46-
return
46+
return res, err
4747
}
4848

4949
// List all secrets that are visible to the caller
5050
func (r *AdminSecretService) List(ctx context.Context, opts ...option.RequestOption) (res *AdminSecretListResponse, err error) {
5151
opts = slices.Concat(r.Options, opts)
5252
path := "v1/admin/secrets"
5353
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
54-
return
54+
return res, err
5555
}
5656

5757
// Delete a secret by its ID
@@ -60,11 +60,11 @@ func (r *AdminSecretService) Delete(ctx context.Context, secretID string, opts .
6060
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
6161
if secretID == "" {
6262
err = errors.New("missing required secret_id parameter")
63-
return
63+
return err
6464
}
6565
path := fmt.Sprintf("v1/admin/secrets/%s", secretID)
6666
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
67-
return
67+
return err
6868
}
6969

7070
type SecretResponse struct {

adminuserconnection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ func (r *AdminUserConnectionService) Delete(ctx context.Context, id string, opts
6666
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
6767
if id == "" {
6868
err = errors.New("missing required id parameter")
69-
return
69+
return err
7070
}
7171
path := fmt.Sprintf("v1/admin/user_connections/%s", id)
7272
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
73-
return
73+
return err
7474
}
7575

7676
type UserConnectionResponse struct {

auth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ func (r *AuthService) Authorize(ctx context.Context, body AuthAuthorizeParams, o
4040
opts = slices.Concat(r.Options, opts)
4141
path := "v1/auth/authorize"
4242
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
43-
return
43+
return res, err
4444
}
4545

4646
// Confirms a user's details during an authorization flow
4747
func (r *AuthService) ConfirmUser(ctx context.Context, body AuthConfirmUserParams, opts ...option.RequestOption) (res *ConfirmUserResponse, err error) {
4848
opts = slices.Concat(r.Options, opts)
4949
path := "v1/auth/confirm_user"
5050
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
51-
return
51+
return res, err
5252
}
5353

5454
// Checks the status of an ongoing authorization process for a specific tool. If
@@ -58,7 +58,7 @@ func (r *AuthService) Status(ctx context.Context, query AuthStatusParams, opts .
5858
opts = slices.Concat(r.Options, opts)
5959
path := "v1/auth/status"
6060
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
61-
return
61+
return res, err
6262
}
6363

6464
type AuthRequestParam struct {

chatcompletion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (r *ChatCompletionService) New(ctx context.Context, body ChatCompletionNewP
3636
opts = slices.Concat(r.Options, opts)
3737
path := "v1/chat/completions"
3838
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
39-
return
39+
return res, err
4040
}
4141

4242
type ChatCompletionNewParams struct {

health.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (r *HealthService) Check(ctx context.Context, opts ...option.RequestOption)
3636
opts = slices.Concat(r.Options, opts)
3737
path := "v1/health"
3838
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
39-
return
39+
return res, err
4040
}
4141

4242
type HealthSchema struct {

tool.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,27 @@ func (r *ToolService) Authorize(ctx context.Context, body ToolAuthorizeParams, o
7272
opts = slices.Concat(r.Options, opts)
7373
path := "v1/tools/authorize"
7474
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
75-
return
75+
return res, err
7676
}
7777

7878
// Executes a tool by name and arguments
7979
func (r *ToolService) Execute(ctx context.Context, body ToolExecuteParams, opts ...option.RequestOption) (res *ExecuteToolResponse, err error) {
8080
opts = slices.Concat(r.Options, opts)
8181
path := "v1/tools/execute"
8282
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
83-
return
83+
return res, err
8484
}
8585

8686
// Returns the arcade tool specification for a specific tool
8787
func (r *ToolService) Get(ctx context.Context, name string, query ToolGetParams, opts ...option.RequestOption) (res *ToolDefinition, err error) {
8888
opts = slices.Concat(r.Options, opts)
8989
if name == "" {
9090
err = errors.New("missing required name parameter")
91-
return
91+
return nil, err
9292
}
9393
path := fmt.Sprintf("v1/tools/%s", name)
9494
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
95-
return
95+
return res, err
9696
}
9797

9898
type AuthorizeToolRequestParam struct {

toolformatted.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ func (r *ToolFormattedService) Get(ctx context.Context, name string, query ToolF
6666
opts = slices.Concat(r.Options, opts)
6767
if name == "" {
6868
err = errors.New("missing required name parameter")
69-
return
69+
return nil, err
7070
}
7171
path := fmt.Sprintf("v1/formatted_tools/%s", name)
7272
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
73-
return
73+
return res, err
7474
}
7575

7676
type ToolFormattedListResponse map[string]interface{}

toolscheduled.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ func (r *ToolScheduledService) Get(ctx context.Context, id string, opts ...optio
6565
opts = slices.Concat(r.Options, opts)
6666
if id == "" {
6767
err = errors.New("missing required id parameter")
68-
return
68+
return nil, err
6969
}
7070
path := fmt.Sprintf("v1/scheduled_tools/%s", id)
7171
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
72-
return
72+
return res, err
7373
}
7474

7575
type ToolScheduledGetResponse struct {

worker.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ func (r *WorkerService) New(ctx context.Context, body WorkerNewParams, opts ...o
4242
opts = slices.Concat(r.Options, opts)
4343
path := "v1/workers"
4444
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
45-
return
45+
return res, err
4646
}
4747

4848
// Update a worker
4949
func (r *WorkerService) Update(ctx context.Context, id string, body WorkerUpdateParams, opts ...option.RequestOption) (res *WorkerResponse, err error) {
5050
opts = slices.Concat(r.Options, opts)
5151
if id == "" {
5252
err = errors.New("missing required id parameter")
53-
return
53+
return nil, err
5454
}
5555
path := fmt.Sprintf("v1/workers/%s", id)
5656
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
57-
return
57+
return res, err
5858
}
5959

6060
// List all workers with their definitions
@@ -86,35 +86,35 @@ func (r *WorkerService) Delete(ctx context.Context, id string, opts ...option.Re
8686
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
8787
if id == "" {
8888
err = errors.New("missing required id parameter")
89-
return
89+
return err
9090
}
9191
path := fmt.Sprintf("v1/workers/%s", id)
9292
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
93-
return
93+
return err
9494
}
9595

9696
// Get a worker by ID
9797
func (r *WorkerService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *WorkerResponse, err error) {
9898
opts = slices.Concat(r.Options, opts)
9999
if id == "" {
100100
err = errors.New("missing required id parameter")
101-
return
101+
return nil, err
102102
}
103103
path := fmt.Sprintf("v1/workers/%s", id)
104104
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
105-
return
105+
return res, err
106106
}
107107

108108
// Get the health of a worker
109109
func (r *WorkerService) Health(ctx context.Context, id string, opts ...option.RequestOption) (res *WorkerHealthResponse, err error) {
110110
opts = slices.Concat(r.Options, opts)
111111
if id == "" {
112112
err = errors.New("missing required id parameter")
113-
return
113+
return nil, err
114114
}
115115
path := fmt.Sprintf("v1/workers/%s/health", id)
116116
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
117-
return
117+
return res, err
118118
}
119119

120120
// Returns a page of tools
@@ -124,7 +124,7 @@ func (r *WorkerService) Tools(ctx context.Context, id string, query WorkerToolsP
124124
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
125125
if id == "" {
126126
err = errors.New("missing required id parameter")
127-
return
127+
return nil, err
128128
}
129129
path := fmt.Sprintf("v1/workers/%s/tools", id)
130130
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)

0 commit comments

Comments
 (0)