safetykit 0.62.0 → 0.64.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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/safety_kit/models/content_create_params.rb +3 -2
  5. data/lib/safety_kit/models/content_create_response.rb +13 -1
  6. data/lib/safety_kit/models/data_get_settings_params.rb +22 -0
  7. data/lib/safety_kit/models/data_get_settings_response.rb +47 -0
  8. data/lib/safety_kit/models/data_update_settings_params.rb +12 -1
  9. data/lib/safety_kit/models/data_update_settings_response.rb +14 -1
  10. data/lib/safety_kit/models.rb +2 -0
  11. data/lib/safety_kit/resources/content.rb +5 -3
  12. data/lib/safety_kit/resources/data.rb +27 -3
  13. data/lib/safety_kit/version.rb +1 -1
  14. data/lib/safety_kit.rb +2 -0
  15. data/rbi/safety_kit/models/content_create_params.rbi +4 -2
  16. data/rbi/safety_kit/models/content_create_response.rbi +16 -3
  17. data/rbi/safety_kit/models/data_get_settings_params.rbi +40 -0
  18. data/rbi/safety_kit/models/data_get_settings_response.rbi +67 -0
  19. data/rbi/safety_kit/models/data_update_settings_params.rbi +17 -0
  20. data/rbi/safety_kit/models/data_update_settings_response.rbi +16 -3
  21. data/rbi/safety_kit/models.rbi +2 -0
  22. data/rbi/safety_kit/resources/content.rbi +6 -4
  23. data/rbi/safety_kit/resources/data.rbi +24 -2
  24. data/sig/safety_kit/models/content_create_response.rbs +10 -3
  25. data/sig/safety_kit/models/data_get_settings_params.rbs +23 -0
  26. data/sig/safety_kit/models/data_get_settings_response.rbs +35 -0
  27. data/sig/safety_kit/models/data_update_settings_params.rbs +7 -0
  28. data/sig/safety_kit/models/data_update_settings_response.rbs +8 -3
  29. data/sig/safety_kit/models.rbs +2 -0
  30. data/sig/safety_kit/resources/data.rbs +6 -0
  31. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f5ba2319763d7b6d9c2efb54f5c4f2fbb38e8f1ad5a3e13e9263489462a655b
4
- data.tar.gz: ea534ef3d9af074b20402b4116c9b5603928d859d5e0397db00327c73bb68b0e
3
+ metadata.gz: 6008e0325c4a55331b32202f0042aa80776a3fa3f03590ccc23a79b4f7c223c6
4
+ data.tar.gz: e09c4d9df7fb7efc00717e0bacac8c893267f1cb1fad96e09075475126dd07b3
5
5
  SHA512:
6
- metadata.gz: d0003cb3fc891f5e4bab459017dee09977aa213a0a203003b95959c6a8e450c996702eeed8fc477406f58850562f87668ce012fb039cc5dd2558b349d63e106a
7
- data.tar.gz: 6a5af12159936f30f5dd14c894581d27d96b990be0793bb9fb539775cd00459fd4403a737eebd8db196cc383d28a61502587ce8351e7a5fcabcb803463cd2cdd
6
+ metadata.gz: 51a30dc4f05ce0d79dcb586524f05805ed24c2f17a70537b48927126b4efa5f91baad779a9e4f141a0dd4b4047b2f215fcd3b6ec37d45ff165e6bb4fd166fd99
7
+ data.tar.gz: fb0a690a1c12e3dae1fa06a5a2325d1684b918180f25848113c85a3dda558f1da0797875c1d82ebb6a45fa583d761af35d8f0f6182ec8083fd9f6e69eece4344
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.64.0 (2026-08-20)
4
+
5
+ Full Changelog: [v0.63.0...v0.64.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.63.0...v0.64.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([1931e07](https://github.com/GetSafetyKit/safetykit-ruby/commit/1931e07d454e90ef8fd8c67022ed2377e4d86293))
10
+
11
+ ## 0.63.0 (2026-08-19)
12
+
13
+ Full Changelog: [v0.62.0...v0.63.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.62.0...v0.63.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** api update ([9cecd7f](https://github.com/GetSafetyKit/safetykit-ruby/commit/9cecd7fef16f48e93b3093b4dda18418413b44e9))
18
+
3
19
  ## 0.62.0 (2026-08-13)
4
20
 
5
21
  Full Changelog: [v0.61.0...v0.62.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.61.0...v0.62.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "safetykit", "~> 0.62.0"
20
+ gem "safetykit", "~> 0.64.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -29,7 +29,8 @@ module SafetyKit
29
29
  optional :content_id, String
30
30
 
31
31
  # @!attribute metadata
32
- # Additional product context for this content. At most 8KB when serialized.
32
+ # Additional product context for this content, echoed back unchanged on the
33
+ # response. At most 8KB when serialized.
33
34
  #
34
35
  # @return [Hash{Symbol=>Object, nil}, nil]
35
36
  optional :metadata, SafetyKit::Internal::Type::HashOf[SafetyKit::Internal::Type::Unknown, nil?: true]
@@ -50,7 +51,7 @@ module SafetyKit
50
51
  #
51
52
  # @param content_id [String] Your content identifier.
52
53
  #
53
- # @param metadata [Hash{Symbol=>Object, nil}] Additional product context for this content. At most 8KB when serialized.
54
+ # @param metadata [Hash{Symbol=>Object, nil}] Additional product context for this content, echoed back unchanged on the respon
54
55
  #
55
56
  # @param safety_kit_version [Symbol, SafetyKit::Models::ContentCreateParams::SafetyKitVersion] The API version this operation is defined against.
56
57
  #
@@ -29,7 +29,17 @@ module SafetyKit
29
29
  # @return [String]
30
30
  required :version, String
31
31
 
32
- # @!method initialize(content_id:, labels:, user_id:, version:)
32
+ # @!attribute metadata
33
+ # The metadata from the request, echoed back unchanged. Absent when the request
34
+ # sent none.
35
+ #
36
+ # @return [Hash{Symbol=>Object, nil}, nil]
37
+ optional :metadata, SafetyKit::Internal::Type::HashOf[SafetyKit::Internal::Type::Unknown, nil?: true]
38
+
39
+ # @!method initialize(content_id:, labels:, user_id:, version:, metadata: nil)
40
+ # Some parameter documentations has been truncated, see
41
+ # {SafetyKit::Models::ContentCreateResponse} for more details.
42
+ #
33
43
  # Synchronous classification result for the submitted content.
34
44
  #
35
45
  # @param content_id [String] SafetyKit identifier for the classified content.
@@ -39,6 +49,8 @@ module SafetyKit
39
49
  # @param user_id [String] The user_id from the request.
40
50
  #
41
51
  # @param version [String] The API version that served this request.
52
+ #
53
+ # @param metadata [Hash{Symbol=>Object, nil}] The metadata from the request, echoed back unchanged. Absent when the request se
42
54
 
43
55
  # Result for one label evaluated against the submitted content.
44
56
  module Label
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SafetyKit
4
+ module Models
5
+ # @see SafetyKit::Resources::Data#get_settings
6
+ class DataGetSettingsParams < SafetyKit::Internal::Type::BaseModel
7
+ extend SafetyKit::Internal::Type::RequestParameters::Converter
8
+ include SafetyKit::Internal::Type::RequestParameters
9
+
10
+ # @!attribute namespace
11
+ # The namespace to ingest data into
12
+ #
13
+ # @return [String]
14
+ required :namespace, String
15
+
16
+ # @!method initialize(namespace:, request_options: {})
17
+ # @param namespace [String] The namespace to ingest data into
18
+ #
19
+ # @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SafetyKit
4
+ module Models
5
+ # @see SafetyKit::Resources::Data#get_settings
6
+ class DataGetSettingsResponse < SafetyKit::Internal::Type::BaseModel
7
+ # @!attribute namespace
8
+ #
9
+ # @return [String]
10
+ required :namespace, String
11
+
12
+ # @!attribute schema
13
+ # The stored schema for this namespace, returned exactly as stored.
14
+ #
15
+ # @return [Hash{Symbol=>Object, nil}]
16
+ required :schema, SafetyKit::Internal::Type::HashOf[SafetyKit::Internal::Type::Unknown, nil?: true]
17
+
18
+ # @!attribute settings
19
+ # The stored namespace settings. Configure with guidance from SafetyKit.
20
+ #
21
+ # @return [Hash{Symbol=>Object, nil}]
22
+ required :settings, SafetyKit::Internal::Type::HashOf[SafetyKit::Internal::Type::Unknown, nil?: true]
23
+
24
+ # @!attribute version
25
+ # The current configuration version, incremented each time the configuration is
26
+ # updated through the API or by SafetyKit. Send it as previous_version when
27
+ # updating to detect intervening changes.
28
+ #
29
+ # @return [Integer]
30
+ required :version, Integer
31
+
32
+ # @!method initialize(namespace:, schema:, settings:, version:)
33
+ # Some parameter documentations has been truncated, see
34
+ # {SafetyKit::Models::DataGetSettingsResponse} for more details.
35
+ #
36
+ # The namespace's stored configuration and its current version.
37
+ #
38
+ # @param namespace [String]
39
+ #
40
+ # @param schema [Hash{Symbol=>Object, nil}] The stored schema for this namespace, returned exactly as stored.
41
+ #
42
+ # @param settings [Hash{Symbol=>Object, nil}] The stored namespace settings. Configure with guidance from SafetyKit.
43
+ #
44
+ # @param version [Integer] The current configuration version, incremented each time the configuration is up
45
+ end
46
+ end
47
+ end
@@ -13,6 +13,15 @@ module SafetyKit
13
13
  # @return [String]
14
14
  required :namespace, String
15
15
 
16
+ # @!attribute previous_version
17
+ # The version returned by GET (or a prior update). When provided, the update is
18
+ # rejected with 409 if the stored configuration has changed since that read, so a
19
+ # stale sync cannot overwrite a newer update. Strongly recommended for automated
20
+ # schema syncs.
21
+ #
22
+ # @return [Integer, nil]
23
+ optional :previous_version, Integer
24
+
16
25
  # @!attribute schema
17
26
  # New schema to store for this namespace. Omit to leave the existing schema
18
27
  # unchanged.
@@ -27,12 +36,14 @@ module SafetyKit
27
36
  # @return [Hash{Symbol=>Object, nil}, nil]
28
37
  optional :settings, SafetyKit::Internal::Type::HashOf[SafetyKit::Internal::Type::Unknown, nil?: true]
29
38
 
30
- # @!method initialize(namespace:, schema: nil, settings: nil, request_options: {})
39
+ # @!method initialize(namespace:, previous_version: nil, schema: nil, settings: nil, request_options: {})
31
40
  # Some parameter documentations has been truncated, see
32
41
  # {SafetyKit::Models::DataUpdateSettingsParams} for more details.
33
42
  #
34
43
  # @param namespace [String] The namespace to ingest data into
35
44
  #
45
+ # @param previous_version [Integer] The version returned by GET (or a prior update). When provided, the update is re
46
+ #
36
47
  # @param schema [Hash{Symbol=>SafetyKit::Models::DataUpdateSettingsParams::Schema}] New schema to store for this namespace. Omit to leave the existing schema unchan
37
48
  #
38
49
  # @param settings [Hash{Symbol=>Object, nil}] Namespace settings to store, replacing existing settings. Omit to leave existing
@@ -14,11 +14,24 @@ module SafetyKit
14
14
  # @return [Symbol, SafetyKit::Models::DataUpdateSettingsResponse::Status]
15
15
  required :status, enum: -> { SafetyKit::Models::DataUpdateSettingsResponse::Status }
16
16
 
17
- # @!method initialize(namespace:, status:)
17
+ # @!attribute version
18
+ # The configuration version after this update. Send it as previous_version on your
19
+ # next update to detect intervening changes.
20
+ #
21
+ # @return [Integer]
22
+ required :version, Integer
23
+
24
+ # @!method initialize(namespace:, status:, version:)
25
+ # Some parameter documentations has been truncated, see
26
+ # {SafetyKit::Models::DataUpdateSettingsResponse} for more details.
27
+ #
18
28
  # Namespace configuration was stored.
19
29
  #
20
30
  # @param namespace [String]
31
+ #
21
32
  # @param status [Symbol, SafetyKit::Models::DataUpdateSettingsResponse::Status]
33
+ #
34
+ # @param version [Integer] The configuration version after this update. Send it as previous_version on your
22
35
 
23
36
  # @see SafetyKit::Models::DataUpdateSettingsResponse#status
24
37
  module Status
@@ -57,6 +57,8 @@ module SafetyKit
57
57
 
58
58
  DataGetDownloadURLParams = SafetyKit::Models::DataGetDownloadURLParams
59
59
 
60
+ DataGetSettingsParams = SafetyKit::Models::DataGetSettingsParams
61
+
60
62
  DataGetStatusParams = SafetyKit::Models::DataGetStatusParams
61
63
 
62
64
  DataObject = SafetyKit::Models::DataObject
@@ -9,8 +9,10 @@ module SafetyKit
9
9
  # {SafetyKit::Models::ContentCreateParams} for more details.
10
10
  #
11
11
  # Classify a piece of content synchronously. Send text and image parts and receive
12
- # per-label results in the response. Requests have a maximum size of 6MB. API
13
- # version 2026-08-11; see the API versioning guide for superseded versions.
12
+ # per-label results in the response. Any metadata you send is echoed back on the
13
+ # response, so a decision can be matched to your own request without a side
14
+ # lookup. Requests have a maximum size of 6MB. API version 2026-08-11; see the API
15
+ # versioning guide for superseded versions.
14
16
  #
15
17
  # Errors: 400 for an invalid body or images, with the failing field in the
16
18
  # message. 401 for a missing or invalid API key. 413 for requests over 6MB. 429
@@ -26,7 +28,7 @@ module SafetyKit
26
28
  #
27
29
  # @param content_id [String] Body param: Your content identifier.
28
30
  #
29
- # @param metadata [Hash{Symbol=>Object, nil}] Body param: Additional product context for this content. At most 8KB when serial
31
+ # @param metadata [Hash{Symbol=>Object, nil}] Body param: Additional product context for this content, echoed back unchanged o
30
32
  #
31
33
  # @param safety_kit_version [Symbol, SafetyKit::Models::ContentCreateParams::SafetyKitVersion] Header param: The API version this operation is defined against.
32
34
  #
@@ -83,6 +83,28 @@ module SafetyKit
83
83
  )
84
84
  end
85
85
 
86
+ # Fetch the stored schema, settings, and configuration version for a namespace.
87
+ # Use the returned version as previous_version when updating so a stale update is
88
+ # rejected instead of overwriting a newer one.
89
+ #
90
+ # @overload get_settings(namespace, request_options: {})
91
+ #
92
+ # @param namespace [String] The namespace to ingest data into
93
+ #
94
+ # @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}, nil]
95
+ #
96
+ # @return [SafetyKit::Models::DataGetSettingsResponse]
97
+ #
98
+ # @see SafetyKit::Models::DataGetSettingsParams
99
+ def get_settings(namespace, params = {})
100
+ @client.request(
101
+ method: :get,
102
+ path: ["v1/data/%1$s/settings", namespace],
103
+ model: SafetyKit::Models::DataGetSettingsResponse,
104
+ options: params[:request_options]
105
+ )
106
+ end
107
+
86
108
  # Retrieve the status of a data ingestion request and, once complete, return
87
109
  # processed objects inline. If the processed output exceeds the 5 MiB inline
88
110
  # response limit, this endpoint returns an error instructing you to use the
@@ -116,14 +138,16 @@ module SafetyKit
116
138
  # Some parameter documentations has been truncated, see
117
139
  # {SafetyKit::Models::DataUpdateSettingsParams} for more details.
118
140
  #
119
- # Update the schema and/or settings for a namespace. Only the fields provided are
120
- # updated; omitted fields are left unchanged. Namespaces whose configuration is
141
+ # Update the schema and/or settings for a namespace. Each is replaced in full when
142
+ # provided and left unchanged when omitted. Namespaces whose configuration is
121
143
  # managed by SafetyKit cannot be updated through this endpoint.
122
144
  #
123
- # @overload update_settings(namespace, schema: nil, settings: nil, request_options: {})
145
+ # @overload update_settings(namespace, previous_version: nil, schema: nil, settings: nil, request_options: {})
124
146
  #
125
147
  # @param namespace [String] The namespace to ingest data into
126
148
  #
149
+ # @param previous_version [Integer] The version returned by GET (or a prior update). When provided, the update is re
150
+ #
127
151
  # @param schema [Hash{Symbol=>SafetyKit::Models::DataUpdateSettingsParams::Schema}] New schema to store for this namespace. Omit to leave the existing schema unchan
128
152
  #
129
153
  # @param settings [Hash{Symbol=>Object, nil}] Namespace settings to store, replacing existing settings. Omit to leave existing
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SafetyKit
4
- VERSION = "0.62.0"
4
+ VERSION = "0.64.0"
5
5
  end
data/lib/safety_kit.rb CHANGED
@@ -70,6 +70,8 @@ require_relative "safety_kit/models/data_create_upload_url_params"
70
70
  require_relative "safety_kit/models/data_create_upload_url_response"
71
71
  require_relative "safety_kit/models/data_get_download_url_params"
72
72
  require_relative "safety_kit/models/data_get_download_url_response"
73
+ require_relative "safety_kit/models/data_get_settings_params"
74
+ require_relative "safety_kit/models/data_get_settings_response"
73
75
  require_relative "safety_kit/models/data_get_status_params"
74
76
  require_relative "safety_kit/models/data_get_status_response"
75
77
  require_relative "safety_kit/models/data_object"
@@ -37,7 +37,8 @@ module SafetyKit
37
37
  sig { params(content_id: String).void }
38
38
  attr_writer :content_id
39
39
 
40
- # Additional product context for this content. At most 8KB when serialized.
40
+ # Additional product context for this content, echoed back unchanged on the
41
+ # response. At most 8KB when serialized.
41
42
  sig { returns(T.nilable(T::Hash[Symbol, T.nilable(T.anything)])) }
42
43
  attr_reader :metadata
43
44
 
@@ -86,7 +87,8 @@ module SafetyKit
86
87
  user_id:,
87
88
  # Your content identifier.
88
89
  content_id: nil,
89
- # Additional product context for this content. At most 8KB when serialized.
90
+ # Additional product context for this content, echoed back unchanged on the
91
+ # response. At most 8KB when serialized.
90
92
  metadata: nil,
91
93
  # The API version this operation is defined against.
92
94
  safety_kit_version: nil,
@@ -31,6 +31,14 @@ module SafetyKit
31
31
  sig { returns(String) }
32
32
  attr_accessor :version
33
33
 
34
+ # The metadata from the request, echoed back unchanged. Absent when the request
35
+ # sent none.
36
+ sig { returns(T.nilable(T::Hash[Symbol, T.nilable(T.anything)])) }
37
+ attr_reader :metadata
38
+
39
+ sig { params(metadata: T::Hash[Symbol, T.nilable(T.anything)]).void }
40
+ attr_writer :metadata
41
+
34
42
  # Synchronous classification result for the submitted content.
35
43
  sig do
36
44
  params(
@@ -43,7 +51,8 @@ module SafetyKit
43
51
  )
44
52
  ],
45
53
  user_id: String,
46
- version: String
54
+ version: String,
55
+ metadata: T::Hash[Symbol, T.nilable(T.anything)]
47
56
  ).returns(T.attached_class)
48
57
  end
49
58
  def self.new(
@@ -54,7 +63,10 @@ module SafetyKit
54
63
  # The user_id from the request.
55
64
  user_id:,
56
65
  # The API version that served this request.
57
- version:
66
+ version:,
67
+ # The metadata from the request, echoed back unchanged. Absent when the request
68
+ # sent none.
69
+ metadata: nil
58
70
  )
59
71
  end
60
72
 
@@ -67,7 +79,8 @@ module SafetyKit
67
79
  SafetyKit::Models::ContentCreateResponse::Label::Variants
68
80
  ],
69
81
  user_id: String,
70
- version: String
82
+ version: String,
83
+ metadata: T::Hash[Symbol, T.nilable(T.anything)]
71
84
  }
72
85
  )
73
86
  end
@@ -0,0 +1,40 @@
1
+ # typed: strong
2
+
3
+ module SafetyKit
4
+ module Models
5
+ class DataGetSettingsParams < SafetyKit::Internal::Type::BaseModel
6
+ extend SafetyKit::Internal::Type::RequestParameters::Converter
7
+ include SafetyKit::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(SafetyKit::DataGetSettingsParams, SafetyKit::Internal::AnyHash)
12
+ end
13
+
14
+ # The namespace to ingest data into
15
+ sig { returns(String) }
16
+ attr_accessor :namespace
17
+
18
+ sig do
19
+ params(
20
+ namespace: String,
21
+ request_options: SafetyKit::RequestOptions::OrHash
22
+ ).returns(T.attached_class)
23
+ end
24
+ def self.new(
25
+ # The namespace to ingest data into
26
+ namespace:,
27
+ request_options: {}
28
+ )
29
+ end
30
+
31
+ sig do
32
+ override.returns(
33
+ { namespace: String, request_options: SafetyKit::RequestOptions }
34
+ )
35
+ end
36
+ def to_hash
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,67 @@
1
+ # typed: strong
2
+
3
+ module SafetyKit
4
+ module Models
5
+ class DataGetSettingsResponse < SafetyKit::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ SafetyKit::Models::DataGetSettingsResponse,
10
+ SafetyKit::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :namespace
16
+
17
+ # The stored schema for this namespace, returned exactly as stored.
18
+ sig { returns(T::Hash[Symbol, T.nilable(T.anything)]) }
19
+ attr_accessor :schema
20
+
21
+ # The stored namespace settings. Configure with guidance from SafetyKit.
22
+ sig { returns(T::Hash[Symbol, T.nilable(T.anything)]) }
23
+ attr_accessor :settings
24
+
25
+ # The current configuration version, incremented each time the configuration is
26
+ # updated through the API or by SafetyKit. Send it as previous_version when
27
+ # updating to detect intervening changes.
28
+ sig { returns(Integer) }
29
+ attr_accessor :version
30
+
31
+ # The namespace's stored configuration and its current version.
32
+ sig do
33
+ params(
34
+ namespace: String,
35
+ schema: T::Hash[Symbol, T.nilable(T.anything)],
36
+ settings: T::Hash[Symbol, T.nilable(T.anything)],
37
+ version: Integer
38
+ ).returns(T.attached_class)
39
+ end
40
+ def self.new(
41
+ namespace:,
42
+ # The stored schema for this namespace, returned exactly as stored.
43
+ schema:,
44
+ # The stored namespace settings. Configure with guidance from SafetyKit.
45
+ settings:,
46
+ # The current configuration version, incremented each time the configuration is
47
+ # updated through the API or by SafetyKit. Send it as previous_version when
48
+ # updating to detect intervening changes.
49
+ version:
50
+ )
51
+ end
52
+
53
+ sig do
54
+ override.returns(
55
+ {
56
+ namespace: String,
57
+ schema: T::Hash[Symbol, T.nilable(T.anything)],
58
+ settings: T::Hash[Symbol, T.nilable(T.anything)],
59
+ version: Integer
60
+ }
61
+ )
62
+ end
63
+ def to_hash
64
+ end
65
+ end
66
+ end
67
+ end
@@ -18,6 +18,16 @@ module SafetyKit
18
18
  sig { returns(String) }
19
19
  attr_accessor :namespace
20
20
 
21
+ # The version returned by GET (or a prior update). When provided, the update is
22
+ # rejected with 409 if the stored configuration has changed since that read, so a
23
+ # stale sync cannot overwrite a newer update. Strongly recommended for automated
24
+ # schema syncs.
25
+ sig { returns(T.nilable(Integer)) }
26
+ attr_reader :previous_version
27
+
28
+ sig { params(previous_version: Integer).void }
29
+ attr_writer :previous_version
30
+
21
31
  # New schema to store for this namespace. Omit to leave the existing schema
22
32
  # unchanged.
23
33
  sig do
@@ -48,6 +58,7 @@ module SafetyKit
48
58
  sig do
49
59
  params(
50
60
  namespace: String,
61
+ previous_version: Integer,
51
62
  schema:
52
63
  T::Hash[
53
64
  Symbol,
@@ -60,6 +71,11 @@ module SafetyKit
60
71
  def self.new(
61
72
  # The namespace to ingest data into
62
73
  namespace:,
74
+ # The version returned by GET (or a prior update). When provided, the update is
75
+ # rejected with 409 if the stored configuration has changed since that read, so a
76
+ # stale sync cannot overwrite a newer update. Strongly recommended for automated
77
+ # schema syncs.
78
+ previous_version: nil,
63
79
  # New schema to store for this namespace. Omit to leave the existing schema
64
80
  # unchanged.
65
81
  schema: nil,
@@ -74,6 +90,7 @@ module SafetyKit
74
90
  override.returns(
75
91
  {
76
92
  namespace: String,
93
+ previous_version: Integer,
77
94
  schema:
78
95
  T::Hash[Symbol, SafetyKit::DataUpdateSettingsParams::Schema],
79
96
  settings: T::Hash[Symbol, T.nilable(T.anything)],
@@ -21,15 +21,27 @@ module SafetyKit
21
21
  end
22
22
  attr_accessor :status
23
23
 
24
+ # The configuration version after this update. Send it as previous_version on your
25
+ # next update to detect intervening changes.
26
+ sig { returns(Integer) }
27
+ attr_accessor :version
28
+
24
29
  # Namespace configuration was stored.
25
30
  sig do
26
31
  params(
27
32
  namespace: String,
28
33
  status:
29
- SafetyKit::Models::DataUpdateSettingsResponse::Status::OrSymbol
34
+ SafetyKit::Models::DataUpdateSettingsResponse::Status::OrSymbol,
35
+ version: Integer
30
36
  ).returns(T.attached_class)
31
37
  end
32
- def self.new(namespace:, status:)
38
+ def self.new(
39
+ namespace:,
40
+ status:,
41
+ # The configuration version after this update. Send it as previous_version on your
42
+ # next update to detect intervening changes.
43
+ version:
44
+ )
33
45
  end
34
46
 
35
47
  sig do
@@ -37,7 +49,8 @@ module SafetyKit
37
49
  {
38
50
  namespace: String,
39
51
  status:
40
- SafetyKit::Models::DataUpdateSettingsResponse::Status::TaggedSymbol
52
+ SafetyKit::Models::DataUpdateSettingsResponse::Status::TaggedSymbol,
53
+ version: Integer
41
54
  }
42
55
  )
43
56
  end
@@ -22,6 +22,8 @@ module SafetyKit
22
22
 
23
23
  DataGetDownloadURLParams = SafetyKit::Models::DataGetDownloadURLParams
24
24
 
25
+ DataGetSettingsParams = SafetyKit::Models::DataGetSettingsParams
26
+
25
27
  DataGetStatusParams = SafetyKit::Models::DataGetStatusParams
26
28
 
27
29
  DataObject = SafetyKit::Models::DataObject
@@ -6,8 +6,10 @@ module SafetyKit
6
6
  # the response.
7
7
  class Content
8
8
  # Classify a piece of content synchronously. Send text and image parts and receive
9
- # per-label results in the response. Requests have a maximum size of 6MB. API
10
- # version 2026-08-11; see the API versioning guide for superseded versions.
9
+ # per-label results in the response. Any metadata you send is echoed back on the
10
+ # response, so a decision can be matched to your own request without a side
11
+ # lookup. Requests have a maximum size of 6MB. API version 2026-08-11; see the API
12
+ # versioning guide for superseded versions.
11
13
  #
12
14
  # Errors: 400 for an invalid body or images, with the failing field in the
13
15
  # message. 401 for a missing or invalid API key. 413 for requests over 6MB. 429
@@ -40,8 +42,8 @@ module SafetyKit
40
42
  user_id:,
41
43
  # Body param: Your content identifier.
42
44
  content_id: nil,
43
- # Body param: Additional product context for this content. At most 8KB when
44
- # serialized.
45
+ # Body param: Additional product context for this content, echoed back unchanged
46
+ # on the response. At most 8KB when serialized.
45
47
  metadata: nil,
46
48
  # Header param: The API version this operation is defined against.
47
49
  safety_kit_version: nil,
@@ -62,6 +62,22 @@ module SafetyKit
62
62
  )
63
63
  end
64
64
 
65
+ # Fetch the stored schema, settings, and configuration version for a namespace.
66
+ # Use the returned version as previous_version when updating so a stale update is
67
+ # rejected instead of overwriting a newer one.
68
+ sig do
69
+ params(
70
+ namespace: String,
71
+ request_options: SafetyKit::RequestOptions::OrHash
72
+ ).returns(SafetyKit::Models::DataGetSettingsResponse)
73
+ end
74
+ def get_settings(
75
+ # The namespace to ingest data into
76
+ namespace,
77
+ request_options: {}
78
+ )
79
+ end
80
+
65
81
  # Retrieve the status of a data ingestion request and, once complete, return
66
82
  # processed objects inline. If the processed output exceeds the 5 MiB inline
67
83
  # response limit, this endpoint returns an error instructing you to use the
@@ -82,12 +98,13 @@ module SafetyKit
82
98
  )
83
99
  end
84
100
 
85
- # Update the schema and/or settings for a namespace. Only the fields provided are
86
- # updated; omitted fields are left unchanged. Namespaces whose configuration is
101
+ # Update the schema and/or settings for a namespace. Each is replaced in full when
102
+ # provided and left unchanged when omitted. Namespaces whose configuration is
87
103
  # managed by SafetyKit cannot be updated through this endpoint.
88
104
  sig do
89
105
  params(
90
106
  namespace: String,
107
+ previous_version: Integer,
91
108
  schema:
92
109
  T::Hash[
93
110
  Symbol,
@@ -100,6 +117,11 @@ module SafetyKit
100
117
  def update_settings(
101
118
  # The namespace to ingest data into
102
119
  namespace,
120
+ # The version returned by GET (or a prior update). When provided, the update is
121
+ # rejected with 409 if the stored configuration has changed since that read, so a
122
+ # stale sync cannot overwrite a newer update. Strongly recommended for automated
123
+ # schema syncs.
124
+ previous_version: nil,
103
125
  # New schema to store for this namespace. Omit to leave the existing schema
104
126
  # unchanged.
105
127
  schema: nil,
@@ -5,7 +5,8 @@ module SafetyKit
5
5
  content_id: String,
6
6
  labels: ::Array[SafetyKit::Models::ContentCreateResponse::label],
7
7
  user_id: String,
8
- version: String
8
+ version: String,
9
+ metadata: ::Hash[Symbol, top?]
9
10
  }
10
11
 
11
12
  class ContentCreateResponse < SafetyKit::Internal::Type::BaseModel
@@ -17,18 +18,24 @@ module SafetyKit
17
18
 
18
19
  attr_accessor version: String
19
20
 
21
+ attr_reader metadata: ::Hash[Symbol, top?]?
22
+
23
+ def metadata=: (::Hash[Symbol, top?]) -> ::Hash[Symbol, top?]
24
+
20
25
  def initialize: (
21
26
  content_id: String,
22
27
  labels: ::Array[SafetyKit::Models::ContentCreateResponse::label],
23
28
  user_id: String,
24
- version: String
29
+ version: String,
30
+ ?metadata: ::Hash[Symbol, top?]
25
31
  ) -> void
26
32
 
27
33
  def to_hash: -> {
28
34
  content_id: String,
29
35
  labels: ::Array[SafetyKit::Models::ContentCreateResponse::label],
30
36
  user_id: String,
31
- version: String
37
+ version: String,
38
+ metadata: ::Hash[Symbol, top?]
32
39
  }
33
40
 
34
41
  type label =
@@ -0,0 +1,23 @@
1
+ module SafetyKit
2
+ module Models
3
+ type data_get_settings_params =
4
+ { namespace: String } & SafetyKit::Internal::Type::request_parameters
5
+
6
+ class DataGetSettingsParams < SafetyKit::Internal::Type::BaseModel
7
+ extend SafetyKit::Internal::Type::RequestParameters::Converter
8
+ include SafetyKit::Internal::Type::RequestParameters
9
+
10
+ attr_accessor namespace: String
11
+
12
+ def initialize: (
13
+ namespace: String,
14
+ ?request_options: SafetyKit::request_opts
15
+ ) -> void
16
+
17
+ def to_hash: -> {
18
+ namespace: String,
19
+ request_options: SafetyKit::RequestOptions
20
+ }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,35 @@
1
+ module SafetyKit
2
+ module Models
3
+ type data_get_settings_response =
4
+ {
5
+ namespace: String,
6
+ schema: ::Hash[Symbol, top?],
7
+ settings: ::Hash[Symbol, top?],
8
+ version: Integer
9
+ }
10
+
11
+ class DataGetSettingsResponse < SafetyKit::Internal::Type::BaseModel
12
+ attr_accessor namespace: String
13
+
14
+ attr_accessor schema: ::Hash[Symbol, top?]
15
+
16
+ attr_accessor settings: ::Hash[Symbol, top?]
17
+
18
+ attr_accessor version: Integer
19
+
20
+ def initialize: (
21
+ namespace: String,
22
+ schema: ::Hash[Symbol, top?],
23
+ settings: ::Hash[Symbol, top?],
24
+ version: Integer
25
+ ) -> void
26
+
27
+ def to_hash: -> {
28
+ namespace: String,
29
+ schema: ::Hash[Symbol, top?],
30
+ settings: ::Hash[Symbol, top?],
31
+ version: Integer
32
+ }
33
+ end
34
+ end
35
+ end
@@ -3,6 +3,7 @@ module SafetyKit
3
3
  type data_update_settings_params =
4
4
  {
5
5
  namespace: String,
6
+ previous_version: Integer,
6
7
  schema: ::Hash[Symbol, SafetyKit::DataUpdateSettingsParams::Schema],
7
8
  settings: ::Hash[Symbol, top?]
8
9
  }
@@ -14,6 +15,10 @@ module SafetyKit
14
15
 
15
16
  attr_accessor namespace: String
16
17
 
18
+ attr_reader previous_version: Integer?
19
+
20
+ def previous_version=: (Integer) -> Integer
21
+
17
22
  attr_reader schema: ::Hash[Symbol, SafetyKit::DataUpdateSettingsParams::Schema]?
18
23
 
19
24
  def schema=: (
@@ -26,6 +31,7 @@ module SafetyKit
26
31
 
27
32
  def initialize: (
28
33
  namespace: String,
34
+ ?previous_version: Integer,
29
35
  ?schema: ::Hash[Symbol, SafetyKit::DataUpdateSettingsParams::Schema],
30
36
  ?settings: ::Hash[Symbol, top?],
31
37
  ?request_options: SafetyKit::request_opts
@@ -33,6 +39,7 @@ module SafetyKit
33
39
 
34
40
  def to_hash: -> {
35
41
  namespace: String,
42
+ previous_version: Integer,
36
43
  schema: ::Hash[Symbol, SafetyKit::DataUpdateSettingsParams::Schema],
37
44
  settings: ::Hash[Symbol, top?],
38
45
  request_options: SafetyKit::RequestOptions
@@ -3,7 +3,8 @@ module SafetyKit
3
3
  type data_update_settings_response =
4
4
  {
5
5
  namespace: String,
6
- status: SafetyKit::Models::DataUpdateSettingsResponse::status
6
+ status: SafetyKit::Models::DataUpdateSettingsResponse::status,
7
+ version: Integer
7
8
  }
8
9
 
9
10
  class DataUpdateSettingsResponse < SafetyKit::Internal::Type::BaseModel
@@ -11,14 +12,18 @@ module SafetyKit
11
12
 
12
13
  attr_accessor status: SafetyKit::Models::DataUpdateSettingsResponse::status
13
14
 
15
+ attr_accessor version: Integer
16
+
14
17
  def initialize: (
15
18
  namespace: String,
16
- status: SafetyKit::Models::DataUpdateSettingsResponse::status
19
+ status: SafetyKit::Models::DataUpdateSettingsResponse::status,
20
+ version: Integer
17
21
  ) -> void
18
22
 
19
23
  def to_hash: -> {
20
24
  namespace: String,
21
- status: SafetyKit::Models::DataUpdateSettingsResponse::status
25
+ status: SafetyKit::Models::DataUpdateSettingsResponse::status,
26
+ version: Integer
22
27
  }
23
28
 
24
29
  type status = :updated
@@ -17,6 +17,8 @@ module SafetyKit
17
17
 
18
18
  class DataGetDownloadURLParams = SafetyKit::Models::DataGetDownloadURLParams
19
19
 
20
+ class DataGetSettingsParams = SafetyKit::Models::DataGetSettingsParams
21
+
20
22
  class DataGetStatusParams = SafetyKit::Models::DataGetStatusParams
21
23
 
22
24
  class DataObject = SafetyKit::Models::DataObject
@@ -18,6 +18,11 @@ module SafetyKit
18
18
  ?request_options: SafetyKit::request_opts
19
19
  ) -> SafetyKit::Models::DataGetDownloadURLResponse
20
20
 
21
+ def get_settings: (
22
+ String namespace,
23
+ ?request_options: SafetyKit::request_opts
24
+ ) -> SafetyKit::Models::DataGetSettingsResponse
25
+
21
26
  def get_status: (
22
27
  String request_id,
23
28
  namespace: String,
@@ -26,6 +31,7 @@ module SafetyKit
26
31
 
27
32
  def update_settings: (
28
33
  String namespace,
34
+ ?previous_version: Integer,
29
35
  ?schema: ::Hash[Symbol, SafetyKit::DataUpdateSettingsParams::Schema],
30
36
  ?settings: ::Hash[Symbol, top?],
31
37
  ?request_options: SafetyKit::request_opts
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safetykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.0
4
+ version: 0.64.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Safetykit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-13 00:00:00.000000000 Z
11
+ date: 2026-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi
@@ -87,6 +87,8 @@ files:
87
87
  - lib/safety_kit/models/data_create_upload_url_response.rb
88
88
  - lib/safety_kit/models/data_get_download_url_params.rb
89
89
  - lib/safety_kit/models/data_get_download_url_response.rb
90
+ - lib/safety_kit/models/data_get_settings_params.rb
91
+ - lib/safety_kit/models/data_get_settings_response.rb
90
92
  - lib/safety_kit/models/data_get_status_params.rb
91
93
  - lib/safety_kit/models/data_get_status_response.rb
92
94
  - lib/safety_kit/models/data_object.rb
@@ -150,6 +152,8 @@ files:
150
152
  - rbi/safety_kit/models/data_create_upload_url_response.rbi
151
153
  - rbi/safety_kit/models/data_get_download_url_params.rbi
152
154
  - rbi/safety_kit/models/data_get_download_url_response.rbi
155
+ - rbi/safety_kit/models/data_get_settings_params.rbi
156
+ - rbi/safety_kit/models/data_get_settings_response.rbi
153
157
  - rbi/safety_kit/models/data_get_status_params.rbi
154
158
  - rbi/safety_kit/models/data_get_status_response.rbi
155
159
  - rbi/safety_kit/models/data_object.rbi
@@ -212,6 +216,8 @@ files:
212
216
  - sig/safety_kit/models/data_create_upload_url_response.rbs
213
217
  - sig/safety_kit/models/data_get_download_url_params.rbs
214
218
  - sig/safety_kit/models/data_get_download_url_response.rbs
219
+ - sig/safety_kit/models/data_get_settings_params.rbs
220
+ - sig/safety_kit/models/data_get_settings_response.rbs
215
221
  - sig/safety_kit/models/data_get_status_params.rbs
216
222
  - sig/safety_kit/models/data_get_status_response.rbs
217
223
  - sig/safety_kit/models/data_object.rbs