-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.go
executable file
·500 lines (443 loc) · 23 KB
/
view.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package braintrust
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"
"github.com/braintrustdata/braintrust-go/internal/apijson"
"github.com/braintrustdata/braintrust-go/internal/apiquery"
"github.com/braintrustdata/braintrust-go/internal/param"
"github.com/braintrustdata/braintrust-go/internal/requestconfig"
"github.com/braintrustdata/braintrust-go/option"
"github.com/braintrustdata/braintrust-go/packages/pagination"
"github.com/braintrustdata/braintrust-go/shared"
)
// ViewService contains methods and other services that help with interacting with
// the braintrust 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 [NewViewService] method instead.
type ViewService struct {
Options []option.RequestOption
}
// NewViewService 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 NewViewService(opts ...option.RequestOption) (r *ViewService) {
r = &ViewService{}
r.Options = opts
return
}
// Create a new view. If there is an existing view with the same name as the one
// specified in the request, will return the existing view unmodified
func (r *ViewService) New(ctx context.Context, body ViewNewParams, opts ...option.RequestOption) (res *shared.View, err error) {
opts = append(r.Options[:], opts...)
path := "v1/view"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Get a view object by its id
func (r *ViewService) Get(ctx context.Context, viewID string, query ViewGetParams, opts ...option.RequestOption) (res *shared.View, err error) {
opts = append(r.Options[:], opts...)
if viewID == "" {
err = errors.New("missing required view_id parameter")
return
}
path := fmt.Sprintf("v1/view/%s", viewID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
// Partially update a view object. Specify the fields to update in the payload. Any
// object-type fields will be deep-merged with existing content. Currently we do
// not support removing fields or setting them to null.
func (r *ViewService) Update(ctx context.Context, viewID string, body ViewUpdateParams, opts ...option.RequestOption) (res *shared.View, err error) {
opts = append(r.Options[:], opts...)
if viewID == "" {
err = errors.New("missing required view_id parameter")
return
}
path := fmt.Sprintf("v1/view/%s", viewID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return
}
// List out all views. The views are sorted by creation date, with the most
// recently-created views coming first
func (r *ViewService) List(ctx context.Context, query ViewListParams, opts ...option.RequestOption) (res *pagination.ListObjects[shared.View], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "v1/view"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// List out all views. The views are sorted by creation date, with the most
// recently-created views coming first
func (r *ViewService) ListAutoPaging(ctx context.Context, query ViewListParams, opts ...option.RequestOption) *pagination.ListObjectsAutoPager[shared.View] {
return pagination.NewListObjectsAutoPager(r.List(ctx, query, opts...))
}
// Delete a view object by its id
func (r *ViewService) Delete(ctx context.Context, viewID string, body ViewDeleteParams, opts ...option.RequestOption) (res *shared.View, err error) {
opts = append(r.Options[:], opts...)
if viewID == "" {
err = errors.New("missing required view_id parameter")
return
}
path := fmt.Sprintf("v1/view/%s", viewID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...)
return
}
// Create or replace view. If there is an existing view with the same name as the
// one specified in the request, will replace the existing view with the provided
// fields
func (r *ViewService) Replace(ctx context.Context, body ViewReplaceParams, opts ...option.RequestOption) (res *shared.View, err error) {
opts = append(r.Options[:], opts...)
path := "v1/view"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
return
}
type ViewNewParams struct {
// Name of the view
Name param.Field[string] `json:"name,required"`
// The id of the object the view applies to
ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
// The object type that the ACL applies to
ObjectType param.Field[ViewNewParamsObjectType] `json:"object_type,required"`
// Type of table that the view corresponds to.
ViewType param.Field[ViewNewParamsViewType] `json:"view_type,required"`
// Date of role deletion, or null if the role is still active
DeletedAt param.Field[time.Time] `json:"deleted_at" format:"date-time"`
// Options for the view in the app
Options param.Field[shared.ViewOptionsParam] `json:"options"`
// Identifies the user who created the view
UserID param.Field[string] `json:"user_id" format:"uuid"`
// The view definition
ViewData param.Field[shared.ViewDataParam] `json:"view_data"`
}
func (r ViewNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The object type that the ACL applies to
type ViewNewParamsObjectType string
const (
ViewNewParamsObjectTypeOrganization ViewNewParamsObjectType = "organization"
ViewNewParamsObjectTypeProject ViewNewParamsObjectType = "project"
ViewNewParamsObjectTypeExperiment ViewNewParamsObjectType = "experiment"
ViewNewParamsObjectTypeDataset ViewNewParamsObjectType = "dataset"
ViewNewParamsObjectTypePrompt ViewNewParamsObjectType = "prompt"
ViewNewParamsObjectTypePromptSession ViewNewParamsObjectType = "prompt_session"
ViewNewParamsObjectTypeGroup ViewNewParamsObjectType = "group"
ViewNewParamsObjectTypeRole ViewNewParamsObjectType = "role"
ViewNewParamsObjectTypeOrgMember ViewNewParamsObjectType = "org_member"
ViewNewParamsObjectTypeProjectLog ViewNewParamsObjectType = "project_log"
ViewNewParamsObjectTypeOrgProject ViewNewParamsObjectType = "org_project"
)
func (r ViewNewParamsObjectType) IsKnown() bool {
switch r {
case ViewNewParamsObjectTypeOrganization, ViewNewParamsObjectTypeProject, ViewNewParamsObjectTypeExperiment, ViewNewParamsObjectTypeDataset, ViewNewParamsObjectTypePrompt, ViewNewParamsObjectTypePromptSession, ViewNewParamsObjectTypeGroup, ViewNewParamsObjectTypeRole, ViewNewParamsObjectTypeOrgMember, ViewNewParamsObjectTypeProjectLog, ViewNewParamsObjectTypeOrgProject:
return true
}
return false
}
// Type of table that the view corresponds to.
type ViewNewParamsViewType string
const (
ViewNewParamsViewTypeProjects ViewNewParamsViewType = "projects"
ViewNewParamsViewTypeLogs ViewNewParamsViewType = "logs"
ViewNewParamsViewTypeExperiments ViewNewParamsViewType = "experiments"
ViewNewParamsViewTypeDatasets ViewNewParamsViewType = "datasets"
ViewNewParamsViewTypePrompts ViewNewParamsViewType = "prompts"
ViewNewParamsViewTypePlaygrounds ViewNewParamsViewType = "playgrounds"
ViewNewParamsViewTypeExperiment ViewNewParamsViewType = "experiment"
ViewNewParamsViewTypeDataset ViewNewParamsViewType = "dataset"
)
func (r ViewNewParamsViewType) IsKnown() bool {
switch r {
case ViewNewParamsViewTypeProjects, ViewNewParamsViewTypeLogs, ViewNewParamsViewTypeExperiments, ViewNewParamsViewTypeDatasets, ViewNewParamsViewTypePrompts, ViewNewParamsViewTypePlaygrounds, ViewNewParamsViewTypeExperiment, ViewNewParamsViewTypeDataset:
return true
}
return false
}
type ViewGetParams struct {
// The id of the object the ACL applies to
ObjectID param.Field[string] `query:"object_id,required" format:"uuid"`
// The object type that the ACL applies to
ObjectType param.Field[ViewGetParamsObjectType] `query:"object_type,required"`
}
// URLQuery serializes [ViewGetParams]'s query parameters as `url.Values`.
func (r ViewGetParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// The object type that the ACL applies to
type ViewGetParamsObjectType string
const (
ViewGetParamsObjectTypeOrganization ViewGetParamsObjectType = "organization"
ViewGetParamsObjectTypeProject ViewGetParamsObjectType = "project"
ViewGetParamsObjectTypeExperiment ViewGetParamsObjectType = "experiment"
ViewGetParamsObjectTypeDataset ViewGetParamsObjectType = "dataset"
ViewGetParamsObjectTypePrompt ViewGetParamsObjectType = "prompt"
ViewGetParamsObjectTypePromptSession ViewGetParamsObjectType = "prompt_session"
ViewGetParamsObjectTypeGroup ViewGetParamsObjectType = "group"
ViewGetParamsObjectTypeRole ViewGetParamsObjectType = "role"
ViewGetParamsObjectTypeOrgMember ViewGetParamsObjectType = "org_member"
ViewGetParamsObjectTypeProjectLog ViewGetParamsObjectType = "project_log"
ViewGetParamsObjectTypeOrgProject ViewGetParamsObjectType = "org_project"
)
func (r ViewGetParamsObjectType) IsKnown() bool {
switch r {
case ViewGetParamsObjectTypeOrganization, ViewGetParamsObjectTypeProject, ViewGetParamsObjectTypeExperiment, ViewGetParamsObjectTypeDataset, ViewGetParamsObjectTypePrompt, ViewGetParamsObjectTypePromptSession, ViewGetParamsObjectTypeGroup, ViewGetParamsObjectTypeRole, ViewGetParamsObjectTypeOrgMember, ViewGetParamsObjectTypeProjectLog, ViewGetParamsObjectTypeOrgProject:
return true
}
return false
}
type ViewUpdateParams struct {
// The id of the object the view applies to
ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
// The object type that the ACL applies to
ObjectType param.Field[ViewUpdateParamsObjectType] `json:"object_type,required"`
// Name of the view
Name param.Field[string] `json:"name"`
// Options for the view in the app
Options param.Field[shared.ViewOptionsParam] `json:"options"`
// Identifies the user who created the view
UserID param.Field[string] `json:"user_id" format:"uuid"`
// The view definition
ViewData param.Field[shared.ViewDataParam] `json:"view_data"`
// Type of table that the view corresponds to.
ViewType param.Field[ViewUpdateParamsViewType] `json:"view_type"`
}
func (r ViewUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The object type that the ACL applies to
type ViewUpdateParamsObjectType string
const (
ViewUpdateParamsObjectTypeOrganization ViewUpdateParamsObjectType = "organization"
ViewUpdateParamsObjectTypeProject ViewUpdateParamsObjectType = "project"
ViewUpdateParamsObjectTypeExperiment ViewUpdateParamsObjectType = "experiment"
ViewUpdateParamsObjectTypeDataset ViewUpdateParamsObjectType = "dataset"
ViewUpdateParamsObjectTypePrompt ViewUpdateParamsObjectType = "prompt"
ViewUpdateParamsObjectTypePromptSession ViewUpdateParamsObjectType = "prompt_session"
ViewUpdateParamsObjectTypeGroup ViewUpdateParamsObjectType = "group"
ViewUpdateParamsObjectTypeRole ViewUpdateParamsObjectType = "role"
ViewUpdateParamsObjectTypeOrgMember ViewUpdateParamsObjectType = "org_member"
ViewUpdateParamsObjectTypeProjectLog ViewUpdateParamsObjectType = "project_log"
ViewUpdateParamsObjectTypeOrgProject ViewUpdateParamsObjectType = "org_project"
)
func (r ViewUpdateParamsObjectType) IsKnown() bool {
switch r {
case ViewUpdateParamsObjectTypeOrganization, ViewUpdateParamsObjectTypeProject, ViewUpdateParamsObjectTypeExperiment, ViewUpdateParamsObjectTypeDataset, ViewUpdateParamsObjectTypePrompt, ViewUpdateParamsObjectTypePromptSession, ViewUpdateParamsObjectTypeGroup, ViewUpdateParamsObjectTypeRole, ViewUpdateParamsObjectTypeOrgMember, ViewUpdateParamsObjectTypeProjectLog, ViewUpdateParamsObjectTypeOrgProject:
return true
}
return false
}
// Type of table that the view corresponds to.
type ViewUpdateParamsViewType string
const (
ViewUpdateParamsViewTypeProjects ViewUpdateParamsViewType = "projects"
ViewUpdateParamsViewTypeLogs ViewUpdateParamsViewType = "logs"
ViewUpdateParamsViewTypeExperiments ViewUpdateParamsViewType = "experiments"
ViewUpdateParamsViewTypeDatasets ViewUpdateParamsViewType = "datasets"
ViewUpdateParamsViewTypePrompts ViewUpdateParamsViewType = "prompts"
ViewUpdateParamsViewTypePlaygrounds ViewUpdateParamsViewType = "playgrounds"
ViewUpdateParamsViewTypeExperiment ViewUpdateParamsViewType = "experiment"
ViewUpdateParamsViewTypeDataset ViewUpdateParamsViewType = "dataset"
)
func (r ViewUpdateParamsViewType) IsKnown() bool {
switch r {
case ViewUpdateParamsViewTypeProjects, ViewUpdateParamsViewTypeLogs, ViewUpdateParamsViewTypeExperiments, ViewUpdateParamsViewTypeDatasets, ViewUpdateParamsViewTypePrompts, ViewUpdateParamsViewTypePlaygrounds, ViewUpdateParamsViewTypeExperiment, ViewUpdateParamsViewTypeDataset:
return true
}
return false
}
type ViewListParams struct {
// The id of the object the ACL applies to
ObjectID param.Field[string] `query:"object_id,required" format:"uuid"`
// The object type that the ACL applies to
ObjectType param.Field[ViewListParamsObjectType] `query:"object_type,required"`
// Pagination cursor id.
//
// For example, if the initial item in the last page you fetched had an id of
// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
// pass one of `starting_after` and `ending_before`
EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
// Filter search results to a particular set of object IDs. To specify a list of
// IDs, include the query param multiple times
IDs param.Field[ViewListParamsIDsUnion] `query:"ids" format:"uuid"`
// Limit the number of objects to return
Limit param.Field[int64] `query:"limit"`
// Pagination cursor id.
//
// For example, if the final item in the last page you fetched had an id of `foo`,
// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
// `starting_after` and `ending_before`
StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
// Name of the view to search for
ViewName param.Field[string] `query:"view_name"`
// Type of table that the view corresponds to.
ViewType param.Field[ViewListParamsViewType] `query:"view_type"`
}
// URLQuery serializes [ViewListParams]'s query parameters as `url.Values`.
func (r ViewListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// The object type that the ACL applies to
type ViewListParamsObjectType string
const (
ViewListParamsObjectTypeOrganization ViewListParamsObjectType = "organization"
ViewListParamsObjectTypeProject ViewListParamsObjectType = "project"
ViewListParamsObjectTypeExperiment ViewListParamsObjectType = "experiment"
ViewListParamsObjectTypeDataset ViewListParamsObjectType = "dataset"
ViewListParamsObjectTypePrompt ViewListParamsObjectType = "prompt"
ViewListParamsObjectTypePromptSession ViewListParamsObjectType = "prompt_session"
ViewListParamsObjectTypeGroup ViewListParamsObjectType = "group"
ViewListParamsObjectTypeRole ViewListParamsObjectType = "role"
ViewListParamsObjectTypeOrgMember ViewListParamsObjectType = "org_member"
ViewListParamsObjectTypeProjectLog ViewListParamsObjectType = "project_log"
ViewListParamsObjectTypeOrgProject ViewListParamsObjectType = "org_project"
)
func (r ViewListParamsObjectType) IsKnown() bool {
switch r {
case ViewListParamsObjectTypeOrganization, ViewListParamsObjectTypeProject, ViewListParamsObjectTypeExperiment, ViewListParamsObjectTypeDataset, ViewListParamsObjectTypePrompt, ViewListParamsObjectTypePromptSession, ViewListParamsObjectTypeGroup, ViewListParamsObjectTypeRole, ViewListParamsObjectTypeOrgMember, ViewListParamsObjectTypeProjectLog, ViewListParamsObjectTypeOrgProject:
return true
}
return false
}
// Filter search results to a particular set of object IDs. To specify a list of
// IDs, include the query param multiple times
//
// Satisfied by [shared.UnionString], [ViewListParamsIDsArray].
type ViewListParamsIDsUnion interface {
ImplementsViewListParamsIDsUnion()
}
type ViewListParamsIDsArray []string
func (r ViewListParamsIDsArray) ImplementsViewListParamsIDsUnion() {}
// Type of table that the view corresponds to.
type ViewListParamsViewType string
const (
ViewListParamsViewTypeProjects ViewListParamsViewType = "projects"
ViewListParamsViewTypeLogs ViewListParamsViewType = "logs"
ViewListParamsViewTypeExperiments ViewListParamsViewType = "experiments"
ViewListParamsViewTypeDatasets ViewListParamsViewType = "datasets"
ViewListParamsViewTypePrompts ViewListParamsViewType = "prompts"
ViewListParamsViewTypePlaygrounds ViewListParamsViewType = "playgrounds"
ViewListParamsViewTypeExperiment ViewListParamsViewType = "experiment"
ViewListParamsViewTypeDataset ViewListParamsViewType = "dataset"
)
func (r ViewListParamsViewType) IsKnown() bool {
switch r {
case ViewListParamsViewTypeProjects, ViewListParamsViewTypeLogs, ViewListParamsViewTypeExperiments, ViewListParamsViewTypeDatasets, ViewListParamsViewTypePrompts, ViewListParamsViewTypePlaygrounds, ViewListParamsViewTypeExperiment, ViewListParamsViewTypeDataset:
return true
}
return false
}
type ViewDeleteParams struct {
// The id of the object the view applies to
ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
// The object type that the ACL applies to
ObjectType param.Field[ViewDeleteParamsObjectType] `json:"object_type,required"`
}
func (r ViewDeleteParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The object type that the ACL applies to
type ViewDeleteParamsObjectType string
const (
ViewDeleteParamsObjectTypeOrganization ViewDeleteParamsObjectType = "organization"
ViewDeleteParamsObjectTypeProject ViewDeleteParamsObjectType = "project"
ViewDeleteParamsObjectTypeExperiment ViewDeleteParamsObjectType = "experiment"
ViewDeleteParamsObjectTypeDataset ViewDeleteParamsObjectType = "dataset"
ViewDeleteParamsObjectTypePrompt ViewDeleteParamsObjectType = "prompt"
ViewDeleteParamsObjectTypePromptSession ViewDeleteParamsObjectType = "prompt_session"
ViewDeleteParamsObjectTypeGroup ViewDeleteParamsObjectType = "group"
ViewDeleteParamsObjectTypeRole ViewDeleteParamsObjectType = "role"
ViewDeleteParamsObjectTypeOrgMember ViewDeleteParamsObjectType = "org_member"
ViewDeleteParamsObjectTypeProjectLog ViewDeleteParamsObjectType = "project_log"
ViewDeleteParamsObjectTypeOrgProject ViewDeleteParamsObjectType = "org_project"
)
func (r ViewDeleteParamsObjectType) IsKnown() bool {
switch r {
case ViewDeleteParamsObjectTypeOrganization, ViewDeleteParamsObjectTypeProject, ViewDeleteParamsObjectTypeExperiment, ViewDeleteParamsObjectTypeDataset, ViewDeleteParamsObjectTypePrompt, ViewDeleteParamsObjectTypePromptSession, ViewDeleteParamsObjectTypeGroup, ViewDeleteParamsObjectTypeRole, ViewDeleteParamsObjectTypeOrgMember, ViewDeleteParamsObjectTypeProjectLog, ViewDeleteParamsObjectTypeOrgProject:
return true
}
return false
}
type ViewReplaceParams struct {
// Name of the view
Name param.Field[string] `json:"name,required"`
// The id of the object the view applies to
ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
// The object type that the ACL applies to
ObjectType param.Field[ViewReplaceParamsObjectType] `json:"object_type,required"`
// Type of table that the view corresponds to.
ViewType param.Field[ViewReplaceParamsViewType] `json:"view_type,required"`
// Date of role deletion, or null if the role is still active
DeletedAt param.Field[time.Time] `json:"deleted_at" format:"date-time"`
// Options for the view in the app
Options param.Field[shared.ViewOptionsParam] `json:"options"`
// Identifies the user who created the view
UserID param.Field[string] `json:"user_id" format:"uuid"`
// The view definition
ViewData param.Field[shared.ViewDataParam] `json:"view_data"`
}
func (r ViewReplaceParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The object type that the ACL applies to
type ViewReplaceParamsObjectType string
const (
ViewReplaceParamsObjectTypeOrganization ViewReplaceParamsObjectType = "organization"
ViewReplaceParamsObjectTypeProject ViewReplaceParamsObjectType = "project"
ViewReplaceParamsObjectTypeExperiment ViewReplaceParamsObjectType = "experiment"
ViewReplaceParamsObjectTypeDataset ViewReplaceParamsObjectType = "dataset"
ViewReplaceParamsObjectTypePrompt ViewReplaceParamsObjectType = "prompt"
ViewReplaceParamsObjectTypePromptSession ViewReplaceParamsObjectType = "prompt_session"
ViewReplaceParamsObjectTypeGroup ViewReplaceParamsObjectType = "group"
ViewReplaceParamsObjectTypeRole ViewReplaceParamsObjectType = "role"
ViewReplaceParamsObjectTypeOrgMember ViewReplaceParamsObjectType = "org_member"
ViewReplaceParamsObjectTypeProjectLog ViewReplaceParamsObjectType = "project_log"
ViewReplaceParamsObjectTypeOrgProject ViewReplaceParamsObjectType = "org_project"
)
func (r ViewReplaceParamsObjectType) IsKnown() bool {
switch r {
case ViewReplaceParamsObjectTypeOrganization, ViewReplaceParamsObjectTypeProject, ViewReplaceParamsObjectTypeExperiment, ViewReplaceParamsObjectTypeDataset, ViewReplaceParamsObjectTypePrompt, ViewReplaceParamsObjectTypePromptSession, ViewReplaceParamsObjectTypeGroup, ViewReplaceParamsObjectTypeRole, ViewReplaceParamsObjectTypeOrgMember, ViewReplaceParamsObjectTypeProjectLog, ViewReplaceParamsObjectTypeOrgProject:
return true
}
return false
}
// Type of table that the view corresponds to.
type ViewReplaceParamsViewType string
const (
ViewReplaceParamsViewTypeProjects ViewReplaceParamsViewType = "projects"
ViewReplaceParamsViewTypeLogs ViewReplaceParamsViewType = "logs"
ViewReplaceParamsViewTypeExperiments ViewReplaceParamsViewType = "experiments"
ViewReplaceParamsViewTypeDatasets ViewReplaceParamsViewType = "datasets"
ViewReplaceParamsViewTypePrompts ViewReplaceParamsViewType = "prompts"
ViewReplaceParamsViewTypePlaygrounds ViewReplaceParamsViewType = "playgrounds"
ViewReplaceParamsViewTypeExperiment ViewReplaceParamsViewType = "experiment"
ViewReplaceParamsViewTypeDataset ViewReplaceParamsViewType = "dataset"
)
func (r ViewReplaceParamsViewType) IsKnown() bool {
switch r {
case ViewReplaceParamsViewTypeProjects, ViewReplaceParamsViewTypeLogs, ViewReplaceParamsViewTypeExperiments, ViewReplaceParamsViewTypeDatasets, ViewReplaceParamsViewTypePrompts, ViewReplaceParamsViewTypePlaygrounds, ViewReplaceParamsViewTypeExperiment, ViewReplaceParamsViewTypeDataset:
return true
}
return false
}