@@ -45,7 +45,7 @@ func (r *BatchService) New(ctx context.Context, body BatchNewParams, opts ...opt
4545}
4646
4747// Get details of a batch job by ID
48- func (r * BatchService ) Get (ctx context.Context , id string , opts ... option.RequestOption ) (res * BatchGetResponse , err error ) {
48+ func (r * BatchService ) Get (ctx context.Context , id string , opts ... option.RequestOption ) (res * BatchJob , err error ) {
4949 opts = slices .Concat (r .Options , opts )
5050 if id == "" {
5151 err = errors .New ("missing required id parameter" )
@@ -57,15 +57,15 @@ func (r *BatchService) Get(ctx context.Context, id string, opts ...option.Reques
5757}
5858
5959// List all batch jobs for the authenticated user
60- func (r * BatchService ) List (ctx context.Context , opts ... option.RequestOption ) (res * []BatchListResponse , err error ) {
60+ func (r * BatchService ) List (ctx context.Context , opts ... option.RequestOption ) (res * []BatchJob , err error ) {
6161 opts = slices .Concat (r .Options , opts )
6262 path := "batches"
6363 err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , nil , & res , opts ... )
6464 return
6565}
6666
6767// Cancel a batch job by ID
68- func (r * BatchService ) Cancel (ctx context.Context , id string , opts ... option.RequestOption ) (res * BatchCancelResponse , err error ) {
68+ func (r * BatchService ) Cancel (ctx context.Context , id string , opts ... option.RequestOption ) (res * BatchJob , err error ) {
6969 opts = slices .Concat (r .Options , opts )
7070 if id == "" {
7171 err = errors .New ("missing required id parameter" )
@@ -76,135 +76,7 @@ func (r *BatchService) Cancel(ctx context.Context, id string, opts ...option.Req
7676 return
7777}
7878
79- type BatchNewResponse struct {
80- Job BatchNewResponseJob `json:"job"`
81- Warning string `json:"warning"`
82- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
83- JSON struct {
84- Job respjson.Field
85- Warning respjson.Field
86- ExtraFields map [string ]respjson.Field
87- raw string
88- } `json:"-"`
89- }
90-
91- // Returns the unmodified JSON received from the API
92- func (r BatchNewResponse ) RawJSON () string { return r .JSON .raw }
93- func (r * BatchNewResponse ) UnmarshalJSON (data []byte ) error {
94- return apijson .UnmarshalRoot (data , r )
95- }
96-
97- type BatchNewResponseJob struct {
98- ID string `json:"id" format:"uuid"`
99- CompletedAt time.Time `json:"completed_at" format:"date-time"`
100- CreatedAt time.Time `json:"created_at" format:"date-time"`
101- Endpoint string `json:"endpoint"`
102- Error string `json:"error"`
103- ErrorFileID string `json:"error_file_id"`
104- // Size of input file in bytes
105- FileSizeBytes int64 `json:"file_size_bytes"`
106- InputFileID string `json:"input_file_id"`
107- JobDeadline time.Time `json:"job_deadline" format:"date-time"`
108- // Model used for processing requests
109- ModelID string `json:"model_id"`
110- OutputFileID string `json:"output_file_id"`
111- // Completion progress (0.0 to 100)
112- Progress float64 `json:"progress"`
113- // Current status of the batch job
114- //
115- // Any of "VALIDATING", "IN_PROGRESS", "COMPLETED", "FAILED", "EXPIRED",
116- // "CANCELLED".
117- Status string `json:"status"`
118- UserID string `json:"user_id"`
119- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
120- JSON struct {
121- ID respjson.Field
122- CompletedAt respjson.Field
123- CreatedAt respjson.Field
124- Endpoint respjson.Field
125- Error respjson.Field
126- ErrorFileID respjson.Field
127- FileSizeBytes respjson.Field
128- InputFileID respjson.Field
129- JobDeadline respjson.Field
130- ModelID respjson.Field
131- OutputFileID respjson.Field
132- Progress respjson.Field
133- Status respjson.Field
134- UserID respjson.Field
135- ExtraFields map [string ]respjson.Field
136- raw string
137- } `json:"-"`
138- }
139-
140- // Returns the unmodified JSON received from the API
141- func (r BatchNewResponseJob ) RawJSON () string { return r .JSON .raw }
142- func (r * BatchNewResponseJob ) UnmarshalJSON (data []byte ) error {
143- return apijson .UnmarshalRoot (data , r )
144- }
145-
146- type BatchGetResponse struct {
147- ID string `json:"id" format:"uuid"`
148- CompletedAt time.Time `json:"completed_at" format:"date-time"`
149- CreatedAt time.Time `json:"created_at" format:"date-time"`
150- Endpoint string `json:"endpoint"`
151- Error string `json:"error"`
152- ErrorFileID string `json:"error_file_id"`
153- // Size of input file in bytes
154- FileSizeBytes int64 `json:"file_size_bytes"`
155- InputFileID string `json:"input_file_id"`
156- JobDeadline time.Time `json:"job_deadline" format:"date-time"`
157- // Model used for processing requests
158- ModelID string `json:"model_id"`
159- OutputFileID string `json:"output_file_id"`
160- // Completion progress (0.0 to 100)
161- Progress float64 `json:"progress"`
162- // Current status of the batch job
163- //
164- // Any of "VALIDATING", "IN_PROGRESS", "COMPLETED", "FAILED", "EXPIRED",
165- // "CANCELLED".
166- Status BatchGetResponseStatus `json:"status"`
167- UserID string `json:"user_id"`
168- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
169- JSON struct {
170- ID respjson.Field
171- CompletedAt respjson.Field
172- CreatedAt respjson.Field
173- Endpoint respjson.Field
174- Error respjson.Field
175- ErrorFileID respjson.Field
176- FileSizeBytes respjson.Field
177- InputFileID respjson.Field
178- JobDeadline respjson.Field
179- ModelID respjson.Field
180- OutputFileID respjson.Field
181- Progress respjson.Field
182- Status respjson.Field
183- UserID respjson.Field
184- ExtraFields map [string ]respjson.Field
185- raw string
186- } `json:"-"`
187- }
188-
189- // Returns the unmodified JSON received from the API
190- func (r BatchGetResponse ) RawJSON () string { return r .JSON .raw }
191- func (r * BatchGetResponse ) UnmarshalJSON (data []byte ) error {
192- return apijson .UnmarshalRoot (data , r )
193- }
194-
195- // Current status of the batch job
196- type BatchGetResponseStatus string
197-
198- const (
199- BatchGetResponseStatusValidating BatchGetResponseStatus = "VALIDATING"
200- BatchGetResponseStatusInProgress BatchGetResponseStatus = "IN_PROGRESS"
201- BatchGetResponseStatusCompleted BatchGetResponseStatus = "COMPLETED"
202- BatchGetResponseStatusFailed BatchGetResponseStatus = "FAILED"
203- BatchGetResponseStatusExpired BatchGetResponseStatus = "EXPIRED"
204- BatchGetResponseStatusCancelled BatchGetResponseStatus = "CANCELLED"
205- )
206-
207- type BatchListResponse struct {
79+ type BatchJob struct {
20880 ID string `json:"id" format:"uuid"`
20981 CompletedAt time.Time `json:"completed_at" format:"date-time"`
21082 CreatedAt time.Time `json:"created_at" format:"date-time"`
@@ -224,8 +96,8 @@ type BatchListResponse struct {
22496 //
22597 // Any of "VALIDATING", "IN_PROGRESS", "COMPLETED", "FAILED", "EXPIRED",
22698 // "CANCELLED".
227- Status BatchListResponseStatus `json:"status"`
228- UserID string `json:"user_id"`
99+ Status BatchJobStatus `json:"status"`
100+ UserID string `json:"user_id"`
229101 // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
230102 JSON struct {
231103 ID respjson.Field
@@ -248,84 +120,41 @@ type BatchListResponse struct {
248120}
249121
250122// Returns the unmodified JSON received from the API
251- func (r BatchListResponse ) RawJSON () string { return r .JSON .raw }
252- func (r * BatchListResponse ) UnmarshalJSON (data []byte ) error {
123+ func (r BatchJob ) RawJSON () string { return r .JSON .raw }
124+ func (r * BatchJob ) UnmarshalJSON (data []byte ) error {
253125 return apijson .UnmarshalRoot (data , r )
254126}
255127
256128// Current status of the batch job
257- type BatchListResponseStatus string
129+ type BatchJobStatus string
258130
259131const (
260- BatchListResponseStatusValidating BatchListResponseStatus = "VALIDATING"
261- BatchListResponseStatusInProgress BatchListResponseStatus = "IN_PROGRESS"
262- BatchListResponseStatusCompleted BatchListResponseStatus = "COMPLETED"
263- BatchListResponseStatusFailed BatchListResponseStatus = "FAILED"
264- BatchListResponseStatusExpired BatchListResponseStatus = "EXPIRED"
265- BatchListResponseStatusCancelled BatchListResponseStatus = "CANCELLED"
132+ BatchJobStatusValidating BatchJobStatus = "VALIDATING"
133+ BatchJobStatusInProgress BatchJobStatus = "IN_PROGRESS"
134+ BatchJobStatusCompleted BatchJobStatus = "COMPLETED"
135+ BatchJobStatusFailed BatchJobStatus = "FAILED"
136+ BatchJobStatusExpired BatchJobStatus = "EXPIRED"
137+ BatchJobStatusCancelled BatchJobStatus = "CANCELLED"
266138)
267139
268- type BatchCancelResponse struct {
269- ID string `json:"id" format:"uuid"`
270- CompletedAt time.Time `json:"completed_at" format:"date-time"`
271- CreatedAt time.Time `json:"created_at" format:"date-time"`
272- Endpoint string `json:"endpoint"`
273- Error string `json:"error"`
274- ErrorFileID string `json:"error_file_id"`
275- // Size of input file in bytes
276- FileSizeBytes int64 `json:"file_size_bytes"`
277- InputFileID string `json:"input_file_id"`
278- JobDeadline time.Time `json:"job_deadline" format:"date-time"`
279- // Model used for processing requests
280- ModelID string `json:"model_id"`
281- OutputFileID string `json:"output_file_id"`
282- // Completion progress (0.0 to 100)
283- Progress float64 `json:"progress"`
284- // Current status of the batch job
285- //
286- // Any of "VALIDATING", "IN_PROGRESS", "COMPLETED", "FAILED", "EXPIRED",
287- // "CANCELLED".
288- Status BatchCancelResponseStatus `json:"status"`
289- UserID string `json:"user_id"`
140+ type BatchNewResponse struct {
141+ Job BatchJob `json:"job"`
142+ Warning string `json:"warning"`
290143 // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
291144 JSON struct {
292- ID respjson.Field
293- CompletedAt respjson.Field
294- CreatedAt respjson.Field
295- Endpoint respjson.Field
296- Error respjson.Field
297- ErrorFileID respjson.Field
298- FileSizeBytes respjson.Field
299- InputFileID respjson.Field
300- JobDeadline respjson.Field
301- ModelID respjson.Field
302- OutputFileID respjson.Field
303- Progress respjson.Field
304- Status respjson.Field
305- UserID respjson.Field
306- ExtraFields map [string ]respjson.Field
307- raw string
145+ Job respjson.Field
146+ Warning respjson.Field
147+ ExtraFields map [string ]respjson.Field
148+ raw string
308149 } `json:"-"`
309150}
310151
311152// Returns the unmodified JSON received from the API
312- func (r BatchCancelResponse ) RawJSON () string { return r .JSON .raw }
313- func (r * BatchCancelResponse ) UnmarshalJSON (data []byte ) error {
153+ func (r BatchNewResponse ) RawJSON () string { return r .JSON .raw }
154+ func (r * BatchNewResponse ) UnmarshalJSON (data []byte ) error {
314155 return apijson .UnmarshalRoot (data , r )
315156}
316157
317- // Current status of the batch job
318- type BatchCancelResponseStatus string
319-
320- const (
321- BatchCancelResponseStatusValidating BatchCancelResponseStatus = "VALIDATING"
322- BatchCancelResponseStatusInProgress BatchCancelResponseStatus = "IN_PROGRESS"
323- BatchCancelResponseStatusCompleted BatchCancelResponseStatus = "COMPLETED"
324- BatchCancelResponseStatusFailed BatchCancelResponseStatus = "FAILED"
325- BatchCancelResponseStatusExpired BatchCancelResponseStatus = "EXPIRED"
326- BatchCancelResponseStatusCancelled BatchCancelResponseStatus = "CANCELLED"
327- )
328-
329158type BatchNewParams struct {
330159 // The endpoint to use for batch processing
331160 Endpoint string `json:"endpoint,required"`
0 commit comments