@@ -75,15 +75,33 @@ func (r *FineTuningCheckpointPermissionService) NewAutoPaging(ctx context.Contex
75
75
//
76
76
// Organization owners can use this endpoint to view all permissions for a
77
77
// fine-tuned model checkpoint.
78
- func (r * FineTuningCheckpointPermissionService ) Get (ctx context.Context , fineTunedModelCheckpoint string , query FineTuningCheckpointPermissionGetParams , opts ... option.RequestOption ) (res * FineTuningCheckpointPermissionGetResponse , err error ) {
78
+ func (r * FineTuningCheckpointPermissionService ) Get (ctx context.Context , fineTunedModelCheckpoint string , query FineTuningCheckpointPermissionGetParams , opts ... option.RequestOption ) (res * pagination.CursorPage [FineTuningCheckpointPermissionGetResponse ], err error ) {
79
+ var raw * http.Response
79
80
opts = append (r .Options [:], opts ... )
81
+ opts = append ([]option.RequestOption {option .WithResponseInto (& raw )}, opts ... )
80
82
if fineTunedModelCheckpoint == "" {
81
83
err = errors .New ("missing required fine_tuned_model_checkpoint parameter" )
82
84
return
83
85
}
84
86
path := fmt .Sprintf ("fine_tuning/checkpoints/%s/permissions" , fineTunedModelCheckpoint )
85
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , query , & res , opts ... )
86
- return
87
+ cfg , err := requestconfig .NewRequestConfig (ctx , http .MethodGet , path , query , & res , opts ... )
88
+ if err != nil {
89
+ return nil , err
90
+ }
91
+ err = cfg .Execute ()
92
+ if err != nil {
93
+ return nil , err
94
+ }
95
+ res .SetPageConfig (cfg , raw )
96
+ return res , nil
97
+ }
98
+
99
+ // **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
100
+ //
101
+ // Organization owners can use this endpoint to view all permissions for a
102
+ // fine-tuned model checkpoint.
103
+ func (r * FineTuningCheckpointPermissionService ) GetAutoPaging (ctx context.Context , fineTunedModelCheckpoint string , query FineTuningCheckpointPermissionGetParams , opts ... option.RequestOption ) * pagination.CursorPageAutoPager [FineTuningCheckpointPermissionGetResponse ] {
104
+ return pagination .NewCursorPageAutoPager (r .Get (ctx , fineTunedModelCheckpoint , query , opts ... ))
87
105
}
88
106
89
107
// **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
@@ -133,33 +151,9 @@ func (r *FineTuningCheckpointPermissionNewResponse) UnmarshalJSON(data []byte) e
133
151
return apijson .UnmarshalRoot (data , r )
134
152
}
135
153
136
- type FineTuningCheckpointPermissionGetResponse struct {
137
- Data []FineTuningCheckpointPermissionGetResponseData `json:"data,required"`
138
- HasMore bool `json:"has_more,required"`
139
- Object constant.List `json:"object,required"`
140
- FirstID string `json:"first_id,nullable"`
141
- LastID string `json:"last_id,nullable"`
142
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
143
- JSON struct {
144
- Data respjson.Field
145
- HasMore respjson.Field
146
- Object respjson.Field
147
- FirstID respjson.Field
148
- LastID respjson.Field
149
- ExtraFields map [string ]respjson.Field
150
- raw string
151
- } `json:"-"`
152
- }
153
-
154
- // Returns the unmodified JSON received from the API
155
- func (r FineTuningCheckpointPermissionGetResponse ) RawJSON () string { return r .JSON .raw }
156
- func (r * FineTuningCheckpointPermissionGetResponse ) UnmarshalJSON (data []byte ) error {
157
- return apijson .UnmarshalRoot (data , r )
158
- }
159
-
160
154
// The `checkpoint.permission` object represents a permission for a fine-tuned
161
155
// model checkpoint.
162
- type FineTuningCheckpointPermissionGetResponseData struct {
156
+ type FineTuningCheckpointPermissionGetResponse struct {
163
157
// The permission identifier, which can be referenced in the API endpoints.
164
158
ID string `json:"id,required"`
165
159
// The Unix timestamp (in seconds) for when the permission was created.
@@ -180,8 +174,8 @@ type FineTuningCheckpointPermissionGetResponseData struct {
180
174
}
181
175
182
176
// Returns the unmodified JSON received from the API
183
- func (r FineTuningCheckpointPermissionGetResponseData ) RawJSON () string { return r .JSON .raw }
184
- func (r * FineTuningCheckpointPermissionGetResponseData ) UnmarshalJSON (data []byte ) error {
177
+ func (r FineTuningCheckpointPermissionGetResponse ) RawJSON () string { return r .JSON .raw }
178
+ func (r * FineTuningCheckpointPermissionGetResponse ) UnmarshalJSON (data []byte ) error {
185
179
return apijson .UnmarshalRoot (data , r )
186
180
}
187
181
0 commit comments