anthropic 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/models/user_profile.rb +26 -1
  5. data/lib/anthropic/models/user_profile_enforcement_action.rb +66 -0
  6. data/lib/anthropic/models/user_profile_enforcement_action_ban.rb +62 -0
  7. data/lib/anthropic/models/user_profile_enforcement_action_next_step.rb +17 -0
  8. data/lib/anthropic/models/user_profile_enforcement_action_reason.rb +23 -0
  9. data/lib/anthropic/models/user_profile_enforcement_action_restriction.rb +67 -0
  10. data/lib/anthropic/models/user_profile_enforcement_status.rb +20 -0
  11. data/lib/anthropic/models/user_profile_list_params.rb +17 -1
  12. data/lib/anthropic/models.rb +12 -0
  13. data/lib/anthropic/resources/user_profiles.rb +5 -3
  14. data/lib/anthropic/version.rb +1 -1
  15. data/lib/anthropic.rb +6 -0
  16. data/rbi/anthropic/models/user_profile.rbi +42 -0
  17. data/rbi/anthropic/models/user_profile_enforcement_action.rbi +95 -0
  18. data/rbi/anthropic/models/user_profile_enforcement_action_ban.rbi +96 -0
  19. data/rbi/anthropic/models/user_profile_enforcement_action_next_step.rbi +34 -0
  20. data/rbi/anthropic/models/user_profile_enforcement_action_reason.rbi +58 -0
  21. data/rbi/anthropic/models/user_profile_enforcement_action_restriction.rbi +106 -0
  22. data/rbi/anthropic/models/user_profile_enforcement_status.rbi +39 -0
  23. data/rbi/anthropic/models/user_profile_list_params.rbi +36 -0
  24. data/rbi/anthropic/models.rbi +16 -0
  25. data/rbi/anthropic/resources/user_profiles.rbi +12 -0
  26. data/sig/anthropic/models/user_profile.rbs +10 -0
  27. data/sig/anthropic/models/user_profile_enforcement_action.rbs +50 -0
  28. data/sig/anthropic/models/user_profile_enforcement_action_ban.rbs +45 -0
  29. data/sig/anthropic/models/user_profile_enforcement_action_next_step.rbs +13 -0
  30. data/sig/anthropic/models/user_profile_enforcement_action_reason.rbs +24 -0
  31. data/sig/anthropic/models/user_profile_enforcement_action_restriction.rbs +45 -0
  32. data/sig/anthropic/models/user_profile_enforcement_status.rbs +17 -0
  33. data/sig/anthropic/models/user_profile_list_params.rbs +9 -0
  34. data/sig/anthropic/models.rbs +12 -0
  35. data/sig/anthropic/resources/user_profiles.rbs +1 -0
  36. metadata +20 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11d93e08f4a486ca6d7facc28fb3965b1e7e4d56c82cd07516e977783955fde0
4
- data.tar.gz: 35c801e2826f036315a7ac7657d18cd4acec36d0e9fcce6b54b651c4d3306102
3
+ metadata.gz: 1d88e7a1741b4ec77ffe3d32523b09d83cf522d475d477e48a48fa58648470de
4
+ data.tar.gz: 3672c35346dbc9afe8d2f63649e4f7e3ddcc38b1d52ad5bdcdb12f0f3a77f658
5
5
  SHA512:
6
- metadata.gz: fa9f8c77556a09a40427dc7c383914a67fa0986a97ed0b4f5bf99d4b5add1565a87e95533a866c5d8e28e87bee29c2b75085fe042d2d4f408de0413ebe25d85d
7
- data.tar.gz: fbb7b230cdfd0313dc5ce46d542132fd6601de67a6dab9f7fc49bdfa1eb20ae134830e33b015786b441e187c6efde884245ef9539ab63c389c6e71fb382f3ecd
6
+ metadata.gz: 3a6d6573f1b09ae58d90b738c46b756780a6f6f2bb952febc58e114dfa5fe5fb87cb9d272b6d4ea7a2df7cf4e174ccb83891bcd2811bf1b9d1955b2bb3fa1e17
7
+ data.tar.gz: 2bbe046e948cb1074ea16dfc7ed7eafd70519a5db351a934fff7a75551b289a3094e1e155d4045d8f7c714843e7d71499582a8a67b5e949897fe25e9b82b4287
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v2.0.0...v2.1.0) (2026-10-21)
4
+
5
+ ### Features
6
+
7
+ * **api:** add enforcement status, actions and filter to user profiles
8
+
9
+
10
+ ### Chores
11
+
12
+ * **ci:** update ruby/setup-ruby and run on the latest Ruby 3.2
13
+ * **docs:** add enforcement fields to the user profile example
14
+
3
15
  ## [2.0.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.82.0...v2.0.0) (2026-10-21)
4
16
 
5
17
  ### ⚠ BREAKING CHANGES
data/README.md CHANGED
@@ -15,7 +15,7 @@ Add to your application's Gemfile:
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "anthropic", "~> 2.0.0"
18
+ gem "anthropic", "~> 2.1.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -23,6 +23,27 @@ module Anthropic
23
23
  # @return [Time]
24
24
  required :created_at, Time
25
25
 
26
+ # @!attribute enforcement_actions
27
+ # The enforcement actions open on this profile; empty when none is open. Absent
28
+ # under the `user-profiles-2026-09-04` and earlier beta headers.
29
+ #
30
+ # @return [Array<Anthropic::Models::UserProfileEnforcementActionRestriction, Anthropic::Models::UserProfileEnforcementActionBan>]
31
+ required :enforcement_actions,
32
+ -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::UserProfileEnforcementAction] }
33
+
34
+ # @!attribute enforcement_status
35
+ # Anthropic's enforcement status of this profile, from its open enforcement
36
+ # actions and any identity check under review, by the first rule that applies:
37
+ # `banned` while any open action is a `ban`; `pending` while a restriction that an
38
+ # identity check can clear is open, the end user has submitted that check,
39
+ # Anthropic's review of it has not ended, and no open action's `reason` is
40
+ # `account_compromise`; `restricted` while any action is open; `unrestricted`
41
+ # while none is. Absent under the `user-profiles-2026-09-04` and earlier beta
42
+ # headers.
43
+ #
44
+ # @return [Symbol, Anthropic::Models::UserProfileEnforcementStatus]
45
+ required :enforcement_status, enum: -> { Anthropic::UserProfileEnforcementStatus }
46
+
26
47
  # @!attribute external_user_details
27
48
  # Details about the entity this profile represents, as the platform states them;
28
49
  # not verified by Anthropic. Every field is present, `null` until the platform
@@ -74,7 +95,7 @@ module Anthropic
74
95
  # @return [Time]
75
96
  required :updated_at, Time
76
97
 
77
- # @!method initialize(id:, access_type:, created_at:, external_user_details:, metadata:, name:, programs:, updated_at:, type: :user_profile)
98
+ # @!method initialize(id:, access_type:, created_at:, enforcement_actions:, enforcement_status:, external_user_details:, metadata:, name:, programs:, updated_at:, type: :user_profile)
78
99
  # A record of an entity that the platform serves through the API, such as an
79
100
  # end-user of the platform's product or a company that the platform resells Claude
80
101
  # access to.
@@ -92,6 +113,10 @@ module Anthropic
92
113
  #
93
114
  # @param created_at [Time] When this user profile was created, in RFC 3339 format.
94
115
  #
116
+ # @param enforcement_actions [Array<Anthropic::Models::UserProfileEnforcementActionRestriction, Anthropic::Models::UserProfileEnforcementActionBan>] The enforcement actions open on this profile; empty when none is open. Absent un
117
+ #
118
+ # @param enforcement_status [Symbol, Anthropic::Models::UserProfileEnforcementStatus] Anthropic's enforcement status of this profile, from its open enforcement action
119
+ #
95
120
  # @param external_user_details [Anthropic::Models::UserProfileExternalUserDetails] Details about the entity this profile represents, as the platform states them; n
96
121
  #
97
122
  # @param metadata [Hash{Symbol=>String}] Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up t
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ # A limit Anthropic has placed on the entity this profile represents and not yet
6
+ # resolved, discriminated by `type`: `restriction` or `ban`. More types may be
7
+ # added; read a `type` you do not recognize as `restriction`.
8
+ module UserProfileEnforcementAction
9
+ extend Anthropic::Internal::Type::Union
10
+
11
+ discriminator :type
12
+
13
+ # Anthropic has limited how it serves the end user until the action is resolved. The end user may still be served in part.
14
+ variant :restriction, -> { Anthropic::UserProfileEnforcementActionRestriction }
15
+
16
+ # Anthropic has stopped serving the end user where the ban applies and does not plan to serve them there again.
17
+ variant :ban, -> { Anthropic::UserProfileEnforcementActionBan }
18
+
19
+ module Type
20
+ extend Anthropic::Internal::Type::Enum
21
+
22
+ RESTRICTION = :restriction
23
+ BAN = :ban
24
+
25
+ # @!method self.values
26
+ # @return [Array<Symbol>]
27
+ end
28
+
29
+ # @!method self.variants
30
+ # @return [Array(Anthropic::Models::UserProfileEnforcementActionRestriction, Anthropic::Models::UserProfileEnforcementActionBan)]
31
+
32
+ # Creates a new instance of the variant class whose `type` matches the given
33
+ # value, passing the remaining arguments to its constructor.
34
+ #
35
+ # Some parameter documentations has been truncated, see
36
+ # {Anthropic::Models::UserProfileEnforcementAction} for more details.
37
+ #
38
+ # @param type [Symbol, Anthropic::Models::UserProfileEnforcementAction::Type, String]
39
+ #
40
+ # @param args [Hash{Symbol=>Object}] Attributes for the chosen variant.
41
+ #
42
+ # @option args [String] :id The action's ID (`enac_...`), stable while the action is open.
43
+ #
44
+ # @option args [Symbol, Anthropic::Models::UserProfileEnforcementActionNextStep, nil] :action The next step on the action: `verify` or `null`. `verify`: the end user can clea
45
+ #
46
+ # @option args [Time, nil] :expires_at When the action ends on its own, in RFC 3339 format; it stops showing once this
47
+ #
48
+ # @option args [Time] :opened_at When Anthropic opened the action, in RFC 3339 format.
49
+ #
50
+ # @option args [Symbol, Anthropic::Models::UserProfileEnforcementActionReason] :reason Why Anthropic placed the limit: `unsupported_region`, `fraud_or_abuse`, `high_ha
51
+ #
52
+ # @raise [ArgumentError]
53
+ # @return [Anthropic::Models::UserProfileEnforcementActionRestriction, Anthropic::Models::UserProfileEnforcementActionBan]
54
+ def self.new(type:, **args)
55
+ case type.to_sym
56
+ when :restriction
57
+ Anthropic::UserProfileEnforcementActionRestriction.new(**args)
58
+ when :ban
59
+ Anthropic::UserProfileEnforcementActionBan.new(**args)
60
+ else
61
+ raise ArgumentError, "unknown type: #{type}"
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ class UserProfileEnforcementActionBan < Anthropic::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ # The action's ID (`enac_...`), stable while the action is open.
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!attribute action
13
+ # Always `null`: the end user cannot clear a ban.
14
+ #
15
+ # @return [Symbol, Anthropic::Models::UserProfileEnforcementActionNextStep, nil]
16
+ required :action, enum: -> { Anthropic::UserProfileEnforcementActionNextStep }, nil?: true
17
+
18
+ # @!attribute expires_at
19
+ # Always `null`: a ban has no end date.
20
+ #
21
+ # @return [Time, nil]
22
+ required :expires_at, Time, nil?: true
23
+
24
+ # @!attribute opened_at
25
+ # When Anthropic opened the action, in RFC 3339 format.
26
+ #
27
+ # @return [Time]
28
+ required :opened_at, Time
29
+
30
+ # @!attribute reason
31
+ # Why Anthropic placed the limit: `unsupported_region`, `fraud_or_abuse`,
32
+ # `high_harm`, `usage_policy_violation`, `account_compromise` or `unspecified`.
33
+ #
34
+ # @return [Symbol, Anthropic::Models::UserProfileEnforcementActionReason]
35
+ required :reason, enum: -> { Anthropic::UserProfileEnforcementActionReason }
36
+
37
+ # @!attribute type
38
+ #
39
+ # @return [Symbol, :ban]
40
+ required :type, const: :ban
41
+
42
+ # @!method initialize(id:, action:, expires_at:, opened_at:, reason:, type: :ban)
43
+ # Anthropic has stopped serving the end user where the ban applies and does not
44
+ # plan to serve them there again.
45
+ #
46
+ # Some parameter documentations has been truncated, see
47
+ # {Anthropic::Models::UserProfileEnforcementActionBan} for more details.
48
+ #
49
+ # @param id [String] The action's ID (`enac_...`), stable while the action is open.
50
+ #
51
+ # @param action [Symbol, Anthropic::Models::UserProfileEnforcementActionNextStep, nil] Always `null`: the end user cannot clear a ban.
52
+ #
53
+ # @param expires_at [Time, nil] Always `null`: a ban has no end date.
54
+ #
55
+ # @param opened_at [Time] When Anthropic opened the action, in RFC 3339 format.
56
+ #
57
+ # @param reason [Symbol, Anthropic::Models::UserProfileEnforcementActionReason] Why Anthropic placed the limit: `unsupported_region`, `fraud_or_abuse`, `high_ha
58
+ #
59
+ # @param type [Symbol, :ban]
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ # The next step on this enforcement action: `verify` means the end user can clear
6
+ # the action by passing an identity check. More values may be added; read a value
7
+ # you do not recognize as `null`.
8
+ module UserProfileEnforcementActionNextStep
9
+ extend Anthropic::Internal::Type::Enum
10
+
11
+ VERIFY = :verify
12
+
13
+ # @!method self.values
14
+ # @return [Array<Symbol>]
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ # Why Anthropic placed this enforcement action: `unsupported_region`,
6
+ # `fraud_or_abuse`, `high_harm`, `usage_policy_violation`, `account_compromise` or
7
+ # `unspecified`. More values may be added; read a value you do not recognize as
8
+ # `unspecified`.
9
+ module UserProfileEnforcementActionReason
10
+ extend Anthropic::Internal::Type::Enum
11
+
12
+ UNSUPPORTED_REGION = :unsupported_region
13
+ FRAUD_OR_ABUSE = :fraud_or_abuse
14
+ HIGH_HARM = :high_harm
15
+ USAGE_POLICY_VIOLATION = :usage_policy_violation
16
+ ACCOUNT_COMPROMISE = :account_compromise
17
+ UNSPECIFIED = :unspecified
18
+
19
+ # @!method self.values
20
+ # @return [Array<Symbol>]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ class UserProfileEnforcementActionRestriction < Anthropic::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ # The action's ID (`enac_...`), stable while the action is open.
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!attribute action
13
+ # The next step on the action: `verify` or `null`. `verify`: the end user can
14
+ # clear it now by passing an identity check. `null`: there is nothing the end user
15
+ # can do now to clear it, including while Anthropic reviews an identity check the
16
+ # end user submitted.
17
+ #
18
+ # @return [Symbol, Anthropic::Models::UserProfileEnforcementActionNextStep, nil]
19
+ required :action, enum: -> { Anthropic::UserProfileEnforcementActionNextStep }, nil?: true
20
+
21
+ # @!attribute expires_at
22
+ # When the action ends on its own, in RFC 3339 format; it stops showing once this
23
+ # time has passed. `null` when it has no end date, and always `null` when `reason`
24
+ # is `account_compromise`.
25
+ #
26
+ # @return [Time, nil]
27
+ required :expires_at, Time, nil?: true
28
+
29
+ # @!attribute opened_at
30
+ # When Anthropic opened the action, in RFC 3339 format.
31
+ #
32
+ # @return [Time]
33
+ required :opened_at, Time
34
+
35
+ # @!attribute reason
36
+ # Why Anthropic placed the limit: `unsupported_region`, `fraud_or_abuse`,
37
+ # `high_harm`, `usage_policy_violation`, `account_compromise` or `unspecified`.
38
+ #
39
+ # @return [Symbol, Anthropic::Models::UserProfileEnforcementActionReason]
40
+ required :reason, enum: -> { Anthropic::UserProfileEnforcementActionReason }
41
+
42
+ # @!attribute type
43
+ #
44
+ # @return [Symbol, :restriction]
45
+ required :type, const: :restriction
46
+
47
+ # @!method initialize(id:, action:, expires_at:, opened_at:, reason:, type: :restriction)
48
+ # Anthropic has limited how it serves the end user until the action is resolved.
49
+ # The end user may still be served in part.
50
+ #
51
+ # Some parameter documentations has been truncated, see
52
+ # {Anthropic::Models::UserProfileEnforcementActionRestriction} for more details.
53
+ #
54
+ # @param id [String] The action's ID (`enac_...`), stable while the action is open.
55
+ #
56
+ # @param action [Symbol, Anthropic::Models::UserProfileEnforcementActionNextStep, nil] The next step on the action: `verify` or `null`. `verify`: the end user can clea
57
+ #
58
+ # @param expires_at [Time, nil] When the action ends on its own, in RFC 3339 format; it stops showing once this
59
+ #
60
+ # @param opened_at [Time] When Anthropic opened the action, in RFC 3339 format.
61
+ #
62
+ # @param reason [Symbol, Anthropic::Models::UserProfileEnforcementActionReason] Why Anthropic placed the limit: `unsupported_region`, `fraud_or_abuse`, `high_ha
63
+ #
64
+ # @param type [Symbol, :restriction]
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ # Anthropic's enforcement status of this profile: `unrestricted`, `pending`,
6
+ # `restricted` or `banned`. More values may be added; read a value you do not
7
+ # recognize as `restricted`.
8
+ module UserProfileEnforcementStatus
9
+ extend Anthropic::Internal::Type::Enum
10
+
11
+ UNRESTRICTED = :unrestricted
12
+ PENDING = :pending
13
+ RESTRICTED = :restricted
14
+ BANNED = :banned
15
+
16
+ # @!method self.values
17
+ # @return [Array<Symbol>]
18
+ end
19
+ end
20
+ end
@@ -7,6 +7,20 @@ module Anthropic
7
7
  extend Anthropic::Internal::Type::RequestParameters::Converter
8
8
  include Anthropic::Internal::Type::RequestParameters
9
9
 
10
+ # @!attribute enforcement_status
11
+ # Return only the user profiles whose `enforcement_status` is one of these values:
12
+ # `unrestricted`, `pending`, `restricted` or `banned`. Repeat the parameter to
13
+ # match any of several. With it set, a page may hold fewer than `limit` profiles,
14
+ # or none, and still carry a `next_page`: the service examines a bounded number of
15
+ # profiles per request, and only a null `next_page` means the listing is complete.
16
+ # Rejected with `invalid_request_error` under the `user-profiles-2026-09-04` and
17
+ # earlier beta headers. Fails with `overloaded_error` when a profile's enforcement
18
+ # actions cannot be read for the moment.
19
+ #
20
+ # @return [Array<Symbol, Anthropic::Models::UserProfileEnforcementStatus>, nil]
21
+ optional :enforcement_status,
22
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::UserProfileEnforcementStatus] }
23
+
10
24
  # @!attribute limit
11
25
  # The maximum number of user profiles to return, from 1 to 100. Defaults to 20.
12
26
  #
@@ -47,10 +61,12 @@ module Anthropic
47
61
  # @return [String, nil]
48
62
  optional :workspace_id, String
49
63
 
50
- # @!method initialize(limit: nil, order: nil, order_by: nil, page: nil, workspace_id: nil, request_options: {})
64
+ # @!method initialize(enforcement_status: nil, limit: nil, order: nil, order_by: nil, page: nil, workspace_id: nil, request_options: {})
51
65
  # Some parameter documentations has been truncated, see
52
66
  # {Anthropic::Models::UserProfileListParams} for more details.
53
67
  #
68
+ # @param enforcement_status [Array<Symbol, Anthropic::Models::UserProfileEnforcementStatus>] Return only the user profiles whose `enforcement_status` is one of these values:
69
+ #
54
70
  # @param limit [Integer] The maximum number of user profiles to return, from 1 to 100. Defaults to 20.
55
71
  #
56
72
  # @param order [Symbol, Anthropic::Models::UserProfileListOrder] The sort direction, applied to the field that `order_by` selects. Defaults to `d
@@ -836,6 +836,18 @@ module Anthropic
836
836
 
837
837
  UserProfileEfsProgram = Anthropic::Models::UserProfileEfsProgram
838
838
 
839
+ UserProfileEnforcementAction = Anthropic::Models::UserProfileEnforcementAction
840
+
841
+ UserProfileEnforcementActionBan = Anthropic::Models::UserProfileEnforcementActionBan
842
+
843
+ UserProfileEnforcementActionNextStep = Anthropic::Models::UserProfileEnforcementActionNextStep
844
+
845
+ UserProfileEnforcementActionReason = Anthropic::Models::UserProfileEnforcementActionReason
846
+
847
+ UserProfileEnforcementActionRestriction = Anthropic::Models::UserProfileEnforcementActionRestriction
848
+
849
+ UserProfileEnforcementStatus = Anthropic::Models::UserProfileEnforcementStatus
850
+
839
851
  UserProfileExternalUserAccountStatus = Anthropic::Models::UserProfileExternalUserAccountStatus
840
852
 
841
853
  UserProfileExternalUserDetails = Anthropic::Models::UserProfileExternalUserDetails
@@ -119,7 +119,9 @@ module Anthropic
119
119
  # Some parameter documentations has been truncated, see
120
120
  # {Anthropic::Models::UserProfileListParams} for more details.
121
121
  #
122
- # @overload list(limit: nil, order: nil, order_by: nil, page: nil, workspace_id: nil, request_options: {})
122
+ # @overload list(enforcement_status: nil, limit: nil, order: nil, order_by: nil, page: nil, workspace_id: nil, request_options: {})
123
+ #
124
+ # @param enforcement_status [Array<Symbol, Anthropic::Models::UserProfileEnforcementStatus>] Query param: Return only the user profiles whose `enforcement_status` is one of
123
125
  #
124
126
  # @param limit [Integer] Query param: The maximum number of user profiles to return, from 1 to 100. Defau
125
127
  #
@@ -137,13 +139,13 @@ module Anthropic
137
139
  #
138
140
  # @see Anthropic::Models::UserProfileListParams
139
141
  def list(params = {})
140
- query_params = [:limit, :order, :order_by, :page]
142
+ query_params = [:enforcement_status, :limit, :order, :order_by, :page]
141
143
  parsed, options = Anthropic::UserProfileListParams.dump_request(params)
142
144
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
143
145
  @client.request(
144
146
  span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_LIST,
145
147
  span_route: "/v1/user_profiles",
146
- span_query: %w[limit order order_by page],
148
+ span_query: %w[enforcement_status limit order order_by page],
147
149
  method: :get,
148
150
  path: "v1/user_profiles",
149
151
  query: query,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
data/lib/anthropic.rb CHANGED
@@ -2031,6 +2031,12 @@ require_relative "anthropic/models/user_profile_cyber_tier"
2031
2031
  require_relative "anthropic/models/user_profile_delete_params"
2032
2032
  require_relative "anthropic/models/user_profile_efs_feature"
2033
2033
  require_relative "anthropic/models/user_profile_efs_program"
2034
+ require_relative "anthropic/models/user_profile_enforcement_action"
2035
+ require_relative "anthropic/models/user_profile_enforcement_action_ban"
2036
+ require_relative "anthropic/models/user_profile_enforcement_action_next_step"
2037
+ require_relative "anthropic/models/user_profile_enforcement_action_reason"
2038
+ require_relative "anthropic/models/user_profile_enforcement_action_restriction"
2039
+ require_relative "anthropic/models/user_profile_enforcement_status"
2034
2040
  require_relative "anthropic/models/user_profile_external_user_account_status"
2035
2041
  require_relative "anthropic/models/user_profile_external_user_details"
2036
2042
  require_relative "anthropic/models/user_profile_external_user_details_params"
@@ -21,6 +21,24 @@ module Anthropic
21
21
  sig { returns(Time) }
22
22
  attr_accessor :created_at
23
23
 
24
+ # The enforcement actions open on this profile; empty when none is open. Absent
25
+ # under the `user-profiles-2026-09-04` and earlier beta headers.
26
+ sig do
27
+ returns(T::Array[Anthropic::UserProfileEnforcementAction::Variants])
28
+ end
29
+ attr_accessor :enforcement_actions
30
+
31
+ # Anthropic's enforcement status of this profile, from its open enforcement
32
+ # actions and any identity check under review, by the first rule that applies:
33
+ # `banned` while any open action is a `ban`; `pending` while a restriction that an
34
+ # identity check can clear is open, the end user has submitted that check,
35
+ # Anthropic's review of it has not ended, and no open action's `reason` is
36
+ # `account_compromise`; `restricted` while any action is open; `unrestricted`
37
+ # while none is. Absent under the `user-profiles-2026-09-04` and earlier beta
38
+ # headers.
39
+ sig { returns(Anthropic::UserProfileEnforcementStatus::TaggedSymbol) }
40
+ attr_accessor :enforcement_status
41
+
24
42
  # Details about the entity this profile represents, as the platform states them;
25
43
  # not verified by Anthropic. Every field is present, `null` until the platform
26
44
  # supplies a value. Absent under the legacy `user-profiles-2026-03-24` and
@@ -83,6 +101,14 @@ module Anthropic
83
101
  id: String,
84
102
  access_type: Anthropic::UserProfileAccessType::OrSymbol,
85
103
  created_at: Time,
104
+ enforcement_actions:
105
+ T::Array[
106
+ T.any(
107
+ Anthropic::UserProfileEnforcementActionRestriction::OrHash,
108
+ Anthropic::UserProfileEnforcementActionBan::OrHash
109
+ )
110
+ ],
111
+ enforcement_status: Anthropic::UserProfileEnforcementStatus::OrSymbol,
86
112
  external_user_details:
87
113
  Anthropic::UserProfileExternalUserDetails::OrHash,
88
114
  metadata: T::Hash[Symbol, String],
@@ -100,6 +126,18 @@ module Anthropic
100
126
  access_type:,
101
127
  # When this user profile was created, in RFC 3339 format.
102
128
  created_at:,
129
+ # The enforcement actions open on this profile; empty when none is open. Absent
130
+ # under the `user-profiles-2026-09-04` and earlier beta headers.
131
+ enforcement_actions:,
132
+ # Anthropic's enforcement status of this profile, from its open enforcement
133
+ # actions and any identity check under review, by the first rule that applies:
134
+ # `banned` while any open action is a `ban`; `pending` while a restriction that an
135
+ # identity check can clear is open, the end user has submitted that check,
136
+ # Anthropic's review of it has not ended, and no open action's `reason` is
137
+ # `account_compromise`; `restricted` while any action is open; `unrestricted`
138
+ # while none is. Absent under the `user-profiles-2026-09-04` and earlier beta
139
+ # headers.
140
+ enforcement_status:,
103
141
  # Details about the entity this profile represents, as the platform states them;
104
142
  # not verified by Anthropic. Every field is present, `null` until the platform
105
143
  # supplies a value. Absent under the legacy `user-profiles-2026-03-24` and
@@ -136,6 +174,10 @@ module Anthropic
136
174
  id: String,
137
175
  access_type: Anthropic::UserProfileAccessType::TaggedSymbol,
138
176
  created_at: Time,
177
+ enforcement_actions:
178
+ T::Array[Anthropic::UserProfileEnforcementAction::Variants],
179
+ enforcement_status:
180
+ Anthropic::UserProfileEnforcementStatus::TaggedSymbol,
139
181
  external_user_details: Anthropic::UserProfileExternalUserDetails,
140
182
  metadata: T::Hash[Symbol, String],
141
183
  name: T.nilable(String),
@@ -0,0 +1,95 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ # A limit Anthropic has placed on the entity this profile represents and not yet
6
+ # resolved, discriminated by `type`: `restriction` or `ban`. More types may be
7
+ # added; read a `type` you do not recognize as `restriction`.
8
+ module UserProfileEnforcementAction
9
+ extend Anthropic::Internal::Type::Union
10
+
11
+ Variants =
12
+ T.type_alias do
13
+ T.any(
14
+ Anthropic::UserProfileEnforcementActionRestriction,
15
+ Anthropic::UserProfileEnforcementActionBan
16
+ )
17
+ end
18
+
19
+ module Type
20
+ extend Anthropic::Internal::Type::Enum
21
+
22
+ TaggedSymbol =
23
+ T.type_alias do
24
+ T.all(Symbol, Anthropic::UserProfileEnforcementAction::Type)
25
+ end
26
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
27
+
28
+ RESTRICTION =
29
+ T.let(
30
+ :restriction,
31
+ Anthropic::UserProfileEnforcementAction::Type::TaggedSymbol
32
+ )
33
+ BAN =
34
+ T.let(
35
+ :ban,
36
+ Anthropic::UserProfileEnforcementAction::Type::TaggedSymbol
37
+ )
38
+
39
+ sig do
40
+ override.returns(
41
+ T::Array[
42
+ Anthropic::UserProfileEnforcementAction::Type::TaggedSymbol
43
+ ]
44
+ )
45
+ end
46
+ def self.values
47
+ end
48
+ end
49
+
50
+ sig do
51
+ override.returns(
52
+ T::Array[Anthropic::UserProfileEnforcementAction::Variants]
53
+ )
54
+ end
55
+ def self.variants
56
+ end
57
+
58
+ # Creates a new instance of the variant class whose `type` matches the given
59
+ # value, passing the remaining arguments to its constructor.
60
+ sig do
61
+ params(
62
+ type: Anthropic::UserProfileEnforcementAction::Type::OrSymbol,
63
+ id: String,
64
+ action:
65
+ T.nilable(
66
+ Anthropic::UserProfileEnforcementActionNextStep::OrSymbol
67
+ ),
68
+ expires_at: T.nilable(Time),
69
+ opened_at: Time,
70
+ reason: Anthropic::UserProfileEnforcementActionReason::OrSymbol
71
+ ).returns(Anthropic::UserProfileEnforcementAction::Variants)
72
+ end
73
+ def self.new(
74
+ type:,
75
+ # The action's ID (`enac_...`), stable while the action is open.
76
+ id:,
77
+ # The next step on the action: `verify` or `null`. `verify`: the end user can
78
+ # clear it now by passing an identity check. `null`: there is nothing the end user
79
+ # can do now to clear it, including while Anthropic reviews an identity check the
80
+ # end user submitted.
81
+ action:,
82
+ # When the action ends on its own, in RFC 3339 format; it stops showing once this
83
+ # time has passed. `null` when it has no end date, and always `null` when `reason`
84
+ # is `account_compromise`.
85
+ expires_at:,
86
+ # When Anthropic opened the action, in RFC 3339 format.
87
+ opened_at:,
88
+ # Why Anthropic placed the limit: `unsupported_region`, `fraud_or_abuse`,
89
+ # `high_harm`, `usage_policy_violation`, `account_compromise` or `unspecified`.
90
+ reason:
91
+ )
92
+ end
93
+ end
94
+ end
95
+ end