-
Notifications
You must be signed in to change notification settings - Fork 0
/
sandboxjobconfiguration.go
142 lines (117 loc) · 5.43 KB
/
sandboxjobconfiguration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package finchgo
import (
"context"
"net/http"
"github.com/Finch-API/finch-api-go/internal/apijson"
"github.com/Finch-API/finch-api-go/internal/param"
"github.com/Finch-API/finch-api-go/internal/requestconfig"
"github.com/Finch-API/finch-api-go/option"
)
// SandboxJobConfigurationService contains methods and other services that help
// with interacting with the Finch API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewSandboxJobConfigurationService] method instead.
type SandboxJobConfigurationService struct {
Options []option.RequestOption
}
// NewSandboxJobConfigurationService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewSandboxJobConfigurationService(opts ...option.RequestOption) (r *SandboxJobConfigurationService) {
r = &SandboxJobConfigurationService{}
r.Options = opts
return
}
// Get configurations for sandbox jobs
func (r *SandboxJobConfigurationService) Get(ctx context.Context, opts ...option.RequestOption) (res *[]SandboxJobConfiguration, err error) {
opts = append(r.Options[:], opts...)
path := "sandbox/jobs/configuration"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Update configurations for sandbox jobs
func (r *SandboxJobConfigurationService) Update(ctx context.Context, body SandboxJobConfigurationUpdateParams, opts ...option.RequestOption) (res *SandboxJobConfiguration, err error) {
opts = append(r.Options[:], opts...)
path := "sandbox/jobs/configuration"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
return
}
type SandboxJobConfiguration struct {
CompletionStatus SandboxJobConfigurationCompletionStatus `json:"completion_status,required"`
Type SandboxJobConfigurationType `json:"type,required"`
JSON sandboxJobConfigurationJSON `json:"-"`
}
// sandboxJobConfigurationJSON contains the JSON metadata for the struct
// [SandboxJobConfiguration]
type sandboxJobConfigurationJSON struct {
CompletionStatus apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *SandboxJobConfiguration) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r sandboxJobConfigurationJSON) RawJSON() string {
return r.raw
}
type SandboxJobConfigurationCompletionStatus string
const (
SandboxJobConfigurationCompletionStatusComplete SandboxJobConfigurationCompletionStatus = "complete"
SandboxJobConfigurationCompletionStatusReauthError SandboxJobConfigurationCompletionStatus = "reauth_error"
SandboxJobConfigurationCompletionStatusPermissionsError SandboxJobConfigurationCompletionStatus = "permissions_error"
SandboxJobConfigurationCompletionStatusError SandboxJobConfigurationCompletionStatus = "error"
)
func (r SandboxJobConfigurationCompletionStatus) IsKnown() bool {
switch r {
case SandboxJobConfigurationCompletionStatusComplete, SandboxJobConfigurationCompletionStatusReauthError, SandboxJobConfigurationCompletionStatusPermissionsError, SandboxJobConfigurationCompletionStatusError:
return true
}
return false
}
type SandboxJobConfigurationType string
const (
SandboxJobConfigurationTypeDataSyncAll SandboxJobConfigurationType = "data_sync_all"
)
func (r SandboxJobConfigurationType) IsKnown() bool {
switch r {
case SandboxJobConfigurationTypeDataSyncAll:
return true
}
return false
}
type SandboxJobConfigurationUpdateParams struct {
CompletionStatus param.Field[SandboxJobConfigurationUpdateParamsCompletionStatus] `json:"completion_status,required"`
Type param.Field[SandboxJobConfigurationUpdateParamsType] `json:"type,required"`
}
func (r SandboxJobConfigurationUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type SandboxJobConfigurationUpdateParamsCompletionStatus string
const (
SandboxJobConfigurationUpdateParamsCompletionStatusComplete SandboxJobConfigurationUpdateParamsCompletionStatus = "complete"
SandboxJobConfigurationUpdateParamsCompletionStatusReauthError SandboxJobConfigurationUpdateParamsCompletionStatus = "reauth_error"
SandboxJobConfigurationUpdateParamsCompletionStatusPermissionsError SandboxJobConfigurationUpdateParamsCompletionStatus = "permissions_error"
SandboxJobConfigurationUpdateParamsCompletionStatusError SandboxJobConfigurationUpdateParamsCompletionStatus = "error"
)
func (r SandboxJobConfigurationUpdateParamsCompletionStatus) IsKnown() bool {
switch r {
case SandboxJobConfigurationUpdateParamsCompletionStatusComplete, SandboxJobConfigurationUpdateParamsCompletionStatusReauthError, SandboxJobConfigurationUpdateParamsCompletionStatusPermissionsError, SandboxJobConfigurationUpdateParamsCompletionStatusError:
return true
}
return false
}
type SandboxJobConfigurationUpdateParamsType string
const (
SandboxJobConfigurationUpdateParamsTypeDataSyncAll SandboxJobConfigurationUpdateParamsType = "data_sync_all"
)
func (r SandboxJobConfigurationUpdateParamsType) IsKnown() bool {
switch r {
case SandboxJobConfigurationUpdateParamsTypeDataSyncAll:
return true
}
return false
}