Skip to content

Commit 5f3c1e3

Browse files
feat(api): beta user profiles: add external_user_onboarded_at, remove relationship in favor of access_type
1 parent d19dea9 commit 5f3c1e3

3 files changed

Lines changed: 36 additions & 80 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 200
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-319861ef873b46e22d6feb51442e743643815093bdd2b3324df52ed202d7ab93.yml
3-
openapi_spec_hash: bf6370c3faa55a6268e5c52bce1eefe9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-ed07e7749a421b323bda2bc4dccdc51a3c0300bd8fbb4c798d420cb34c81ec0b.yml
3+
openapi_spec_hash: a7c6a5d576c441c2d46744296d2239c7
44
config_hash: 87207a5b615f18ff11b0d1c6beb259dd

betauserprofile.go

Lines changed: 22 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -152,30 +152,26 @@ type BetaUserProfile struct {
152152
AccessType BetaUserProfileAccessType `json:"access_type"`
153153
// Platform's own identifier for this user. Not enforced unique.
154154
ExternalID string `json:"external_id" api:"nullable"`
155+
// A timestamp in RFC 3339 format
156+
ExternalUserOnboardedAt time.Time `json:"external_user_onboarded_at" api:"nullable" format:"date-time"`
155157
// Real-world name of the entity this profile represents (company or individual).
156-
// For a resold-to company (`access_type` `passthrough`, or `relationship` `resold`
157-
// under the `user-profiles-2026-03-24` header) this is that company's name.
158+
// For a company the platform resells Claude access to (`access_type`
159+
// `passthrough`) this is that company's name.
158160
Name string `json:"name" api:"nullable"`
159-
// How the entity behind a user profile relates to the platform that owns the API
160-
// key. `external`: an individual end-user of the platform. `resold`: a company the
161-
// platform resells Claude access to. `internal`: the platform's own usage.
162-
//
163-
// Any of "external", "resold", "internal".
164-
Relationship BetaUserProfileRelationship `json:"relationship"`
165161
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
166162
JSON struct {
167-
ID respjson.Field
168-
CreatedAt respjson.Field
169-
Metadata respjson.Field
170-
TrustGrants respjson.Field
171-
Type respjson.Field
172-
UpdatedAt respjson.Field
173-
AccessType respjson.Field
174-
ExternalID respjson.Field
175-
Name respjson.Field
176-
Relationship respjson.Field
177-
ExtraFields map[string]respjson.Field
178-
raw string
163+
ID respjson.Field
164+
CreatedAt respjson.Field
165+
Metadata respjson.Field
166+
TrustGrants respjson.Field
167+
Type respjson.Field
168+
UpdatedAt respjson.Field
169+
AccessType respjson.Field
170+
ExternalID respjson.Field
171+
ExternalUserOnboardedAt respjson.Field
172+
Name respjson.Field
173+
ExtraFields map[string]respjson.Field
174+
raw string
179175
} `json:"-"`
180176
}
181177

@@ -204,17 +200,6 @@ const (
204200
BetaUserProfileAccessTypePassthrough BetaUserProfileAccessType = "passthrough"
205201
)
206202

207-
// How the entity behind a user profile relates to the platform that owns the API
208-
// key. `external`: an individual end-user of the platform. `resold`: a company the
209-
// platform resells Claude access to. `internal`: the platform's own usage.
210-
type BetaUserProfileRelationship string
211-
212-
const (
213-
BetaUserProfileRelationshipExternal BetaUserProfileRelationship = "external"
214-
BetaUserProfileRelationshipResold BetaUserProfileRelationship = "resold"
215-
BetaUserProfileRelationshipInternal BetaUserProfileRelationship = "internal"
216-
)
217-
218203
type BetaUserProfileEnrollmentURL struct {
219204
// A timestamp in RFC 3339 format
220205
ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
@@ -280,10 +265,12 @@ type BetaUserProfileNewParams struct {
280265
// characters.
281266
ExternalID param.Opt[string] `json:"external_id,omitzero"`
282267
// Optional for all profiles. Real-world name of the entity this profile represents
283-
// (company or individual); for a resold-to company (`relationship` `resold` /
284-
// `access_type` `passthrough`), that company's name where known. Maximum 255
268+
// (company or individual); for a company the platform resells Claude access to
269+
// (`access_type` `passthrough`), that company's name where known. Maximum 255
285270
// characters.
286271
Name param.Opt[string] `json:"name,omitzero"`
272+
// A timestamp in RFC 3339 format
273+
ExternalUserOnboardedAt param.Opt[time.Time] `json:"external_user_onboarded_at,omitzero" format:"date-time"`
287274
// How the platform uses the API on behalf of the entity this profile represents.
288275
// `application`: the platform sells a product that uses the API behind the scenes,
289276
// and the profile represents an individual end-user of that product.
@@ -296,12 +283,6 @@ type BetaUserProfileNewParams struct {
296283
// keys up to 64 characters and values up to 512 characters. Values must be
297284
// non-empty strings.
298285
Metadata map[string]string `json:"metadata,omitzero"`
299-
// How the entity behind a user profile relates to the platform that owns the API
300-
// key. `external`: an individual end-user of the platform. `resold`: a company the
301-
// platform resells Claude access to. `internal`: the platform's own usage.
302-
//
303-
// Any of "external", "resold", "internal".
304-
Relationship BetaUserProfileNewParamsRelationship `json:"relationship,omitzero"`
305286
// Optional header to specify the beta version(s) you want to use.
306287
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
307288
paramObj
@@ -327,17 +308,6 @@ const (
327308
BetaUserProfileNewParamsAccessTypePassthrough BetaUserProfileNewParamsAccessType = "passthrough"
328309
)
329310

330-
// How the entity behind a user profile relates to the platform that owns the API
331-
// key. `external`: an individual end-user of the platform. `resold`: a company the
332-
// platform resells Claude access to. `internal`: the platform's own usage.
333-
type BetaUserProfileNewParamsRelationship string
334-
335-
const (
336-
BetaUserProfileNewParamsRelationshipExternal BetaUserProfileNewParamsRelationship = "external"
337-
BetaUserProfileNewParamsRelationshipResold BetaUserProfileNewParamsRelationship = "resold"
338-
BetaUserProfileNewParamsRelationshipInternal BetaUserProfileNewParamsRelationship = "internal"
339-
)
340-
341311
type BetaUserProfileGetParams struct {
342312
// Optional header to specify the beta version(s) you want to use.
343313
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
@@ -351,6 +321,8 @@ type BetaUserProfileUpdateParams struct {
351321
// If present, replaces the stored name. Omit to leave unchanged. Maximum 255
352322
// characters.
353323
Name param.Opt[string] `json:"name,omitzero"`
324+
// A timestamp in RFC 3339 format
325+
ExternalUserOnboardedAt param.Opt[time.Time] `json:"external_user_onboarded_at,omitzero" format:"date-time"`
354326
// How the platform uses the API on behalf of the entity this profile represents.
355327
// `application`: the platform sells a product that uses the API behind the scenes,
356328
// and the profile represents an individual end-user of that product.
@@ -359,12 +331,6 @@ type BetaUserProfileUpdateParams struct {
359331
//
360332
// Any of "application", "passthrough".
361333
AccessType BetaUserProfileUpdateParamsAccessType `json:"access_type,omitzero"`
362-
// How the entity behind a user profile relates to the platform that owns the API
363-
// key. `external`: an individual end-user of the platform. `resold`: a company the
364-
// platform resells Claude access to. `internal`: the platform's own usage.
365-
//
366-
// Any of "external", "resold", "internal".
367-
Relationship BetaUserProfileUpdateParamsRelationship `json:"relationship,omitzero"`
368334
// Key-value pairs to merge into the stored metadata. Keys provided overwrite
369335
// existing values. To remove a key, set its value to an empty string. Keys not
370336
// provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and
@@ -395,17 +361,6 @@ const (
395361
BetaUserProfileUpdateParamsAccessTypePassthrough BetaUserProfileUpdateParamsAccessType = "passthrough"
396362
)
397363

398-
// How the entity behind a user profile relates to the platform that owns the API
399-
// key. `external`: an individual end-user of the platform. `resold`: a company the
400-
// platform resells Claude access to. `internal`: the platform's own usage.
401-
type BetaUserProfileUpdateParamsRelationship string
402-
403-
const (
404-
BetaUserProfileUpdateParamsRelationshipExternal BetaUserProfileUpdateParamsRelationship = "external"
405-
BetaUserProfileUpdateParamsRelationshipResold BetaUserProfileUpdateParamsRelationship = "resold"
406-
BetaUserProfileUpdateParamsRelationshipInternal BetaUserProfileUpdateParamsRelationship = "internal"
407-
)
408-
409364
type BetaUserProfileListParams struct {
410365
// Query parameter for limit
411366
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`

betauserprofile_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"errors"
88
"os"
99
"testing"
10+
"time"
1011

1112
"github.com/anthropics/anthropic-sdk-go"
1213
"github.com/anthropics/anthropic-sdk-go/internal/testutil"
@@ -26,12 +27,12 @@ func TestBetaUserProfileNewWithOptionalParams(t *testing.T) {
2627
option.WithAPIKey("my-anthropic-api-key"),
2728
)
2829
_, err := client.Beta.UserProfiles.New(context.TODO(), anthropic.BetaUserProfileNewParams{
29-
AccessType: anthropic.BetaUserProfileNewParamsAccessTypeApplication,
30-
ExternalID: anthropic.String("user_12345"),
31-
Metadata: map[string]string{},
32-
Name: anthropic.String("x"),
33-
Relationship: anthropic.BetaUserProfileNewParamsRelationshipExternal,
34-
Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMessageBatches2024_09_24},
30+
AccessType: anthropic.BetaUserProfileNewParamsAccessTypeApplication,
31+
ExternalID: anthropic.String("user_12345"),
32+
ExternalUserOnboardedAt: anthropic.Time(time.Now()),
33+
Metadata: map[string]string{},
34+
Name: anthropic.String("x"),
35+
Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMessageBatches2024_09_24},
3536
})
3637
if err != nil {
3738
var apierr *anthropic.Error
@@ -86,14 +87,14 @@ func TestBetaUserProfileUpdateWithOptionalParams(t *testing.T) {
8687
context.TODO(),
8788
"uprof_011CZkZCu8hGbp5mYRQgUmz9",
8889
anthropic.BetaUserProfileUpdateParams{
89-
AccessType: anthropic.BetaUserProfileUpdateParamsAccessTypeApplication,
90-
ExternalID: anthropic.String("user_12345"),
90+
AccessType: anthropic.BetaUserProfileUpdateParamsAccessTypeApplication,
91+
ExternalID: anthropic.String("user_12345"),
92+
ExternalUserOnboardedAt: anthropic.Time(time.Now()),
9193
Metadata: map[string]string{
9294
"foo": "string",
9395
},
94-
Name: anthropic.String("x"),
95-
Relationship: anthropic.BetaUserProfileUpdateParamsRelationshipExternal,
96-
Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMessageBatches2024_09_24},
96+
Name: anthropic.String("x"),
97+
Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMessageBatches2024_09_24},
9798
},
9899
)
99100
if err != nil {

0 commit comments

Comments
 (0)