moderation_api 1.2.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 (175) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +144 -0
  4. data/Rakefile +10 -0
  5. data/docs/AccountApi.md +74 -0
  6. data/docs/AccountGet200Response.md +26 -0
  7. data/docs/AccountGet200ResponseCurrentProject.md +20 -0
  8. data/docs/ActionsCreateRequest.md +36 -0
  9. data/docs/ActionsCreateRequestWebhooksInner.md +24 -0
  10. data/docs/ActionsDelete200Response.md +20 -0
  11. data/docs/ActionsExecute200Response.md +22 -0
  12. data/docs/ActionsExecuteDeprecatedRequest.md +22 -0
  13. data/docs/ActionsExecuteRequest.md +24 -0
  14. data/docs/ActionsGet200Response.md +40 -0
  15. data/docs/ActionsGet200ResponseWebhooksInner.md +26 -0
  16. data/docs/ActionsList200ResponseInner.md +38 -0
  17. data/docs/ActionsList200ResponseInnerPossibleValuesInner.md +18 -0
  18. data/docs/ActionsList400Response.md +22 -0
  19. data/docs/ActionsList400ResponseIssuesInner.md +18 -0
  20. data/docs/ActionsUpdateRequest.md +36 -0
  21. data/docs/ModerateApi.md +357 -0
  22. data/docs/ModerationAudioRequest.md +28 -0
  23. data/docs/ModerationImage200Response.md +28 -0
  24. data/docs/ModerationImage200ResponseLabelsInner.md +20 -0
  25. data/docs/ModerationImageRequest.md +28 -0
  26. data/docs/ModerationObject200Response.md +36 -0
  27. data/docs/ModerationObject200ResponseAllOfEntitiesInner.md +22 -0
  28. data/docs/ModerationObject200ResponseAllOfFieldsInner.md +22 -0
  29. data/docs/ModerationObject200ResponseAllOfLabelsInner.md +22 -0
  30. data/docs/ModerationObjectRequest.md +28 -0
  31. data/docs/ModerationObjectRequestValue.md +20 -0
  32. data/docs/ModerationObjectRequestValueDataValue.md +22 -0
  33. data/docs/ModerationText200Response.md +64 -0
  34. data/docs/ModerationText200ResponseAllOfAddress.md +28 -0
  35. data/docs/ModerationText200ResponseAllOfEmail.md +28 -0
  36. data/docs/ModerationText200ResponseAllOfName.md +28 -0
  37. data/docs/ModerationText200ResponseAllOfNsfw.md +26 -0
  38. data/docs/ModerationText200ResponseAllOfNsfwLabelScores.md +22 -0
  39. data/docs/ModerationText200ResponseAllOfPhone.md +28 -0
  40. data/docs/ModerationText200ResponseAllOfProfanity.md +28 -0
  41. data/docs/ModerationText200ResponseAllOfPropriety.md +26 -0
  42. data/docs/ModerationText200ResponseAllOfProprietyLabelScores.md +22 -0
  43. data/docs/ModerationText200ResponseAllOfQuality.md +26 -0
  44. data/docs/ModerationText200ResponseAllOfQualityLabelScores.md +24 -0
  45. data/docs/ModerationText200ResponseAllOfRequest.md +20 -0
  46. data/docs/ModerationText200ResponseAllOfSensitive.md +28 -0
  47. data/docs/ModerationText200ResponseAllOfSentiment.md +26 -0
  48. data/docs/ModerationText200ResponseAllOfSentimentLabelScores.md +22 -0
  49. data/docs/ModerationText200ResponseAllOfToxicity.md +26 -0
  50. data/docs/ModerationText200ResponseAllOfToxicityLabelScores.md +30 -0
  51. data/docs/ModerationText200ResponseAllOfUrl.md +28 -0
  52. data/docs/ModerationText200ResponseAllOfUsername.md +28 -0
  53. data/docs/ModerationText200ResponseAllOfWordlist.md +28 -0
  54. data/docs/ModerationText200ResponseAllOfWordlistsInner.md +36 -0
  55. data/docs/ModerationTextRequest.md +28 -0
  56. data/docs/ModerationVideo200Response.md +24 -0
  57. data/docs/ModerationVideoRequest.md +28 -0
  58. data/docs/QueueActionsApi.md +503 -0
  59. data/git_push.sh +57 -0
  60. data/lib/moderation_api/api/account_api.rb +79 -0
  61. data/lib/moderation_api/api/moderate_api.rb +362 -0
  62. data/lib/moderation_api/api/queue_actions_api.rb +492 -0
  63. data/lib/moderation_api/api_client.rb +437 -0
  64. data/lib/moderation_api/api_error.rb +58 -0
  65. data/lib/moderation_api/configuration.rb +392 -0
  66. data/lib/moderation_api/models/account_get200_response.rb +278 -0
  67. data/lib/moderation_api/models/account_get200_response_current_project.rb +237 -0
  68. data/lib/moderation_api/models/actions_create_request.rb +374 -0
  69. data/lib/moderation_api/models/actions_create_request_webhooks_inner.rb +260 -0
  70. data/lib/moderation_api/models/actions_delete200_response.rb +239 -0
  71. data/lib/moderation_api/models/actions_execute200_response.rb +258 -0
  72. data/lib/moderation_api/models/actions_execute_deprecated_request.rb +244 -0
  73. data/lib/moderation_api/models/actions_execute_request.rb +261 -0
  74. data/lib/moderation_api/models/actions_get200_response.rb +408 -0
  75. data/lib/moderation_api/models/actions_get200_response_webhooks_inner.rb +278 -0
  76. data/lib/moderation_api/models/actions_list200_response_inner.rb +396 -0
  77. data/lib/moderation_api/models/actions_list200_response_inner_possible_values_inner.rb +222 -0
  78. data/lib/moderation_api/models/actions_list400_response.rb +248 -0
  79. data/lib/moderation_api/models/actions_list400_response_issues_inner.rb +221 -0
  80. data/lib/moderation_api/models/actions_update_request.rb +367 -0
  81. data/lib/moderation_api/models/moderation_audio_request.rb +302 -0
  82. data/lib/moderation_api/models/moderation_image200_response.rb +296 -0
  83. data/lib/moderation_api/models/moderation_image200_response_labels_inner.rb +301 -0
  84. data/lib/moderation_api/models/moderation_image_request.rb +302 -0
  85. data/lib/moderation_api/models/moderation_object200_response.rb +368 -0
  86. data/lib/moderation_api/models/moderation_object200_response_all_of_entities_inner.rb +251 -0
  87. data/lib/moderation_api/models/moderation_object200_response_all_of_fields_inner.rb +258 -0
  88. data/lib/moderation_api/models/moderation_object200_response_all_of_labels_inner.rb +284 -0
  89. data/lib/moderation_api/models/moderation_object_request.rb +301 -0
  90. data/lib/moderation_api/models/moderation_object_request_value.rb +275 -0
  91. data/lib/moderation_api/models/moderation_object_request_value_data_value.rb +285 -0
  92. data/lib/moderation_api/models/moderation_text200_response.rb +488 -0
  93. data/lib/moderation_api/models/moderation_text200_response_all_of_address.rb +303 -0
  94. data/lib/moderation_api/models/moderation_text200_response_all_of_email.rb +303 -0
  95. data/lib/moderation_api/models/moderation_text200_response_all_of_name.rb +303 -0
  96. data/lib/moderation_api/models/moderation_text200_response_all_of_nsfw.rb +255 -0
  97. data/lib/moderation_api/models/moderation_text200_response_all_of_nsfw_label_scores.rb +235 -0
  98. data/lib/moderation_api/models/moderation_text200_response_all_of_phone.rb +303 -0
  99. data/lib/moderation_api/models/moderation_text200_response_all_of_profanity.rb +303 -0
  100. data/lib/moderation_api/models/moderation_text200_response_all_of_propriety.rb +255 -0
  101. data/lib/moderation_api/models/moderation_text200_response_all_of_propriety_label_scores.rb +235 -0
  102. data/lib/moderation_api/models/moderation_text200_response_all_of_quality.rb +255 -0
  103. data/lib/moderation_api/models/moderation_text200_response_all_of_quality_label_scores.rb +245 -0
  104. data/lib/moderation_api/models/moderation_text200_response_all_of_request.rb +240 -0
  105. data/lib/moderation_api/models/moderation_text200_response_all_of_sensitive.rb +303 -0
  106. data/lib/moderation_api/models/moderation_text200_response_all_of_sentiment.rb +255 -0
  107. data/lib/moderation_api/models/moderation_text200_response_all_of_sentiment_label_scores.rb +235 -0
  108. data/lib/moderation_api/models/moderation_text200_response_all_of_toxicity.rb +262 -0
  109. data/lib/moderation_api/models/moderation_text200_response_all_of_toxicity_label_scores.rb +275 -0
  110. data/lib/moderation_api/models/moderation_text200_response_all_of_url.rb +303 -0
  111. data/lib/moderation_api/models/moderation_text200_response_all_of_username.rb +303 -0
  112. data/lib/moderation_api/models/moderation_text200_response_all_of_wordlist.rb +303 -0
  113. data/lib/moderation_api/models/moderation_text200_response_all_of_wordlists_inner.rb +377 -0
  114. data/lib/moderation_api/models/moderation_text_request.rb +330 -0
  115. data/lib/moderation_api/models/moderation_video200_response.rb +265 -0
  116. data/lib/moderation_api/models/moderation_video_request.rb +302 -0
  117. data/lib/moderation_api/version.rb +15 -0
  118. data/lib/moderation_api.rb +93 -0
  119. data/moderation_api.gemspec +45 -0
  120. data/spec/api/account_api_spec.rb +46 -0
  121. data/spec/api/moderate_api_spec.rb +95 -0
  122. data/spec/api/queue_actions_api_spec.rb +121 -0
  123. data/spec/models/account_get200_response_current_project_spec.rb +42 -0
  124. data/spec/models/account_get200_response_spec.rb +60 -0
  125. data/spec/models/actions_create_request_spec.rb +98 -0
  126. data/spec/models/actions_create_request_webhooks_inner_spec.rb +54 -0
  127. data/spec/models/actions_delete200_response_spec.rb +42 -0
  128. data/spec/models/actions_execute200_response_spec.rb +48 -0
  129. data/spec/models/actions_execute_deprecated_request_spec.rb +48 -0
  130. data/spec/models/actions_execute_request_spec.rb +54 -0
  131. data/spec/models/actions_get200_response_spec.rb +110 -0
  132. data/spec/models/actions_get200_response_webhooks_inner_spec.rb +60 -0
  133. data/spec/models/actions_list200_response_inner_possible_values_inner_spec.rb +36 -0
  134. data/spec/models/actions_list200_response_inner_spec.rb +104 -0
  135. data/spec/models/actions_list400_response_issues_inner_spec.rb +36 -0
  136. data/spec/models/actions_list400_response_spec.rb +48 -0
  137. data/spec/models/actions_update_request_spec.rb +98 -0
  138. data/spec/models/moderation_audio_request_spec.rb +66 -0
  139. data/spec/models/moderation_image200_response_labels_inner_spec.rb +46 -0
  140. data/spec/models/moderation_image200_response_spec.rb +66 -0
  141. data/spec/models/moderation_image_request_spec.rb +66 -0
  142. data/spec/models/moderation_object200_response_all_of_entities_inner_spec.rb +48 -0
  143. data/spec/models/moderation_object200_response_all_of_fields_inner_spec.rb +48 -0
  144. data/spec/models/moderation_object200_response_all_of_labels_inner_spec.rb +48 -0
  145. data/spec/models/moderation_object200_response_spec.rb +90 -0
  146. data/spec/models/moderation_object_request_spec.rb +66 -0
  147. data/spec/models/moderation_object_request_value_data_value_spec.rb +52 -0
  148. data/spec/models/moderation_object_request_value_spec.rb +46 -0
  149. data/spec/models/moderation_text200_response_all_of_address_spec.rb +70 -0
  150. data/spec/models/moderation_text200_response_all_of_email_spec.rb +70 -0
  151. data/spec/models/moderation_text200_response_all_of_name_spec.rb +70 -0
  152. data/spec/models/moderation_text200_response_all_of_nsfw_label_scores_spec.rb +48 -0
  153. data/spec/models/moderation_text200_response_all_of_nsfw_spec.rb +60 -0
  154. data/spec/models/moderation_text200_response_all_of_phone_spec.rb +70 -0
  155. data/spec/models/moderation_text200_response_all_of_profanity_spec.rb +70 -0
  156. data/spec/models/moderation_text200_response_all_of_propriety_label_scores_spec.rb +48 -0
  157. data/spec/models/moderation_text200_response_all_of_propriety_spec.rb +60 -0
  158. data/spec/models/moderation_text200_response_all_of_quality_label_scores_spec.rb +54 -0
  159. data/spec/models/moderation_text200_response_all_of_quality_spec.rb +60 -0
  160. data/spec/models/moderation_text200_response_all_of_request_spec.rb +42 -0
  161. data/spec/models/moderation_text200_response_all_of_sensitive_spec.rb +70 -0
  162. data/spec/models/moderation_text200_response_all_of_sentiment_label_scores_spec.rb +48 -0
  163. data/spec/models/moderation_text200_response_all_of_sentiment_spec.rb +60 -0
  164. data/spec/models/moderation_text200_response_all_of_toxicity_label_scores_spec.rb +72 -0
  165. data/spec/models/moderation_text200_response_all_of_toxicity_spec.rb +60 -0
  166. data/spec/models/moderation_text200_response_all_of_url_spec.rb +70 -0
  167. data/spec/models/moderation_text200_response_all_of_username_spec.rb +70 -0
  168. data/spec/models/moderation_text200_response_all_of_wordlist_spec.rb +70 -0
  169. data/spec/models/moderation_text200_response_all_of_wordlists_inner_spec.rb +94 -0
  170. data/spec/models/moderation_text200_response_spec.rb +174 -0
  171. data/spec/models/moderation_text_request_spec.rb +66 -0
  172. data/spec/models/moderation_video200_response_spec.rb +54 -0
  173. data/spec/models/moderation_video_request_spec.rb +66 -0
  174. data/spec/spec_helper.rb +111 -0
  175. metadata +340 -0
@@ -0,0 +1,265 @@
1
+ =begin
2
+ #Moderation API
3
+
4
+ #API for automated content moderation
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module ModerationAPI
17
+ class ModerationVideo200Response
18
+ # Success if the request was successful
19
+ attr_accessor :status
20
+
21
+ attr_accessor :request
22
+
23
+ # Whether the content was flagged by any models
24
+ attr_accessor :flagged
25
+
26
+ # The ID of the content. Only returned if the content was stored.
27
+ attr_accessor :content_id
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'status' => :'status',
33
+ :'request' => :'request',
34
+ :'flagged' => :'flagged',
35
+ :'content_id' => :'contentId'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'status' => :'String',
48
+ :'request' => :'ModerationText200ResponseAllOfRequest',
49
+ :'flagged' => :'Boolean',
50
+ :'content_id' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ModerationAPI::ModerationVideo200Response` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ModerationAPI::ModerationVideo200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'status')
76
+ self.status = attributes[:'status']
77
+ else
78
+ self.status = nil
79
+ end
80
+
81
+ if attributes.key?(:'request')
82
+ self.request = attributes[:'request']
83
+ else
84
+ self.request = nil
85
+ end
86
+
87
+ if attributes.key?(:'flagged')
88
+ self.flagged = attributes[:'flagged']
89
+ else
90
+ self.flagged = nil
91
+ end
92
+
93
+ if attributes.key?(:'content_id')
94
+ self.content_id = attributes[:'content_id']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
+ invalid_properties = Array.new
103
+ if @status.nil?
104
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
105
+ end
106
+
107
+ if @request.nil?
108
+ invalid_properties.push('invalid value for "request", request cannot be nil.')
109
+ end
110
+
111
+ if @flagged.nil?
112
+ invalid_properties.push('invalid value for "flagged", flagged cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ warn '[DEPRECATED] the `valid?` method is obsolete'
122
+ return false if @status.nil?
123
+ return false if @request.nil?
124
+ return false if @flagged.nil?
125
+ true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ status == o.status &&
134
+ request == o.request &&
135
+ flagged == o.flagged &&
136
+ content_id == o.content_id
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [status, request, flagged, content_id].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ attributes = attributes.transform_keys(&:to_sym)
157
+ transformed_hash = {}
158
+ openapi_types.each_pair do |key, type|
159
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = nil
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[attribute_map[key]].is_a?(Array)
165
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
166
+ end
167
+ elsif !attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
169
+ end
170
+ end
171
+ new(transformed_hash)
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def self._deserialize(type, value)
179
+ case type.to_sym
180
+ when :Time
181
+ Time.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ # models (e.g. Pet) or oneOf
212
+ klass = ModerationAPI.const_get(type)
213
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ end
215
+ end
216
+
217
+ # Returns the string representation of the object
218
+ # @return [String] String presentation of the object
219
+ def to_s
220
+ to_hash.to_s
221
+ end
222
+
223
+ # to_body is an alias to to_hash (backward compatibility)
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_body
226
+ to_hash
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+
263
+ end
264
+
265
+ end
@@ -0,0 +1,302 @@
1
+ =begin
2
+ #Moderation API
3
+
4
+ #API for automated content moderation
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module ModerationAPI
17
+ class ModerationVideoRequest
18
+ # The URL of the video you want to analyze.
19
+ attr_accessor :url
20
+
21
+ # The unique ID of the content in your database.
22
+ attr_accessor :content_id
23
+
24
+ # Do not store the content. The content won't enter the review queue
25
+ attr_accessor :do_not_store
26
+
27
+ # The author of the content.
28
+ attr_accessor :author_id
29
+
30
+ # For example the ID of a chat room or a post
31
+ attr_accessor :context_id
32
+
33
+ # Any metadata you want to store with the content
34
+ attr_accessor :metadata
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'url' => :'url',
40
+ :'content_id' => :'contentId',
41
+ :'do_not_store' => :'doNotStore',
42
+ :'author_id' => :'authorId',
43
+ :'context_id' => :'contextId',
44
+ :'metadata' => :'metadata'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'url' => :'String',
57
+ :'content_id' => :'String',
58
+ :'do_not_store' => :'Boolean',
59
+ :'author_id' => :'String',
60
+ :'context_id' => :'String',
61
+ :'metadata' => :'Hash<String, Object>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ModerationAPI::ModerationVideoRequest` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ModerationAPI::ModerationVideoRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'url')
87
+ self.url = attributes[:'url']
88
+ else
89
+ self.url = nil
90
+ end
91
+
92
+ if attributes.key?(:'content_id')
93
+ self.content_id = attributes[:'content_id']
94
+ end
95
+
96
+ if attributes.key?(:'do_not_store')
97
+ self.do_not_store = attributes[:'do_not_store']
98
+ end
99
+
100
+ if attributes.key?(:'author_id')
101
+ self.author_id = attributes[:'author_id']
102
+ end
103
+
104
+ if attributes.key?(:'context_id')
105
+ self.context_id = attributes[:'context_id']
106
+ end
107
+
108
+ if attributes.key?(:'metadata')
109
+ if (value = attributes[:'metadata']).is_a?(Hash)
110
+ self.metadata = value
111
+ end
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @url.nil?
121
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
122
+ end
123
+
124
+ if !@content_id.nil? && @content_id.to_s.length > 100
125
+ invalid_properties.push('invalid value for "content_id", the character length must be smaller than or equal to 100.')
126
+ end
127
+
128
+ if !@content_id.nil? && @content_id.to_s.length < 1
129
+ invalid_properties.push('invalid value for "content_id", the character length must be great than or equal to 1.')
130
+ end
131
+
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ warn '[DEPRECATED] the `valid?` method is obsolete'
139
+ return false if @url.nil?
140
+ return false if !@content_id.nil? && @content_id.to_s.length > 100
141
+ return false if !@content_id.nil? && @content_id.to_s.length < 1
142
+ true
143
+ end
144
+
145
+ # Custom attribute writer method with validation
146
+ # @param [Object] content_id Value to be assigned
147
+ def content_id=(content_id)
148
+ if content_id.nil?
149
+ fail ArgumentError, 'content_id cannot be nil'
150
+ end
151
+
152
+ if content_id.to_s.length > 100
153
+ fail ArgumentError, 'invalid value for "content_id", the character length must be smaller than or equal to 100.'
154
+ end
155
+
156
+ if content_id.to_s.length < 1
157
+ fail ArgumentError, 'invalid value for "content_id", the character length must be great than or equal to 1.'
158
+ end
159
+
160
+ @content_id = content_id
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ url == o.url &&
169
+ content_id == o.content_id &&
170
+ do_not_store == o.do_not_store &&
171
+ author_id == o.author_id &&
172
+ context_id == o.context_id &&
173
+ metadata == o.metadata
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Integer] Hash code
184
+ def hash
185
+ [url, content_id, do_not_store, author_id, context_id, metadata].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def self.build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+ attributes = attributes.transform_keys(&:to_sym)
194
+ transformed_hash = {}
195
+ openapi_types.each_pair do |key, type|
196
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
197
+ transformed_hash["#{key}"] = nil
198
+ elsif type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[attribute_map[key]].is_a?(Array)
202
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
203
+ end
204
+ elsif !attributes[attribute_map[key]].nil?
205
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
206
+ end
207
+ end
208
+ new(transformed_hash)
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def self._deserialize(type, value)
216
+ case type.to_sym
217
+ when :Time
218
+ Time.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ # models (e.g. Pet) or oneOf
249
+ klass = ModerationAPI.const_get(type)
250
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -0,0 +1,15 @@
1
+ =begin
2
+ #Moderation API
3
+
4
+ #API for automated content moderation
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ module ModerationAPI
14
+ VERSION = '1.2.0'
15
+ end
@@ -0,0 +1,93 @@
1
+ =begin
2
+ #Moderation API
3
+
4
+ #API for automated content moderation
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'moderation_api/api_client'
15
+ require 'moderation_api/api_error'
16
+ require 'moderation_api/version'
17
+ require 'moderation_api/configuration'
18
+
19
+ # Models
20
+ ModerationAPI.autoload :AccountGet200Response, 'moderation_api/models/account_get200_response'
21
+ ModerationAPI.autoload :AccountGet200ResponseCurrentProject, 'moderation_api/models/account_get200_response_current_project'
22
+ ModerationAPI.autoload :ActionsCreateRequest, 'moderation_api/models/actions_create_request'
23
+ ModerationAPI.autoload :ActionsCreateRequestWebhooksInner, 'moderation_api/models/actions_create_request_webhooks_inner'
24
+ ModerationAPI.autoload :ActionsDelete200Response, 'moderation_api/models/actions_delete200_response'
25
+ ModerationAPI.autoload :ActionsExecute200Response, 'moderation_api/models/actions_execute200_response'
26
+ ModerationAPI.autoload :ActionsExecuteDeprecatedRequest, 'moderation_api/models/actions_execute_deprecated_request'
27
+ ModerationAPI.autoload :ActionsExecuteRequest, 'moderation_api/models/actions_execute_request'
28
+ ModerationAPI.autoload :ActionsGet200Response, 'moderation_api/models/actions_get200_response'
29
+ ModerationAPI.autoload :ActionsGet200ResponseWebhooksInner, 'moderation_api/models/actions_get200_response_webhooks_inner'
30
+ ModerationAPI.autoload :ActionsList200ResponseInner, 'moderation_api/models/actions_list200_response_inner'
31
+ ModerationAPI.autoload :ActionsList200ResponseInnerPossibleValuesInner, 'moderation_api/models/actions_list200_response_inner_possible_values_inner'
32
+ ModerationAPI.autoload :ActionsList400Response, 'moderation_api/models/actions_list400_response'
33
+ ModerationAPI.autoload :ActionsList400ResponseIssuesInner, 'moderation_api/models/actions_list400_response_issues_inner'
34
+ ModerationAPI.autoload :ActionsUpdateRequest, 'moderation_api/models/actions_update_request'
35
+ ModerationAPI.autoload :ModerationAudioRequest, 'moderation_api/models/moderation_audio_request'
36
+ ModerationAPI.autoload :ModerationImage200Response, 'moderation_api/models/moderation_image200_response'
37
+ ModerationAPI.autoload :ModerationImage200ResponseLabelsInner, 'moderation_api/models/moderation_image200_response_labels_inner'
38
+ ModerationAPI.autoload :ModerationImageRequest, 'moderation_api/models/moderation_image_request'
39
+ ModerationAPI.autoload :ModerationObject200Response, 'moderation_api/models/moderation_object200_response'
40
+ ModerationAPI.autoload :ModerationObject200ResponseAllOfEntitiesInner, 'moderation_api/models/moderation_object200_response_all_of_entities_inner'
41
+ ModerationAPI.autoload :ModerationObject200ResponseAllOfFieldsInner, 'moderation_api/models/moderation_object200_response_all_of_fields_inner'
42
+ ModerationAPI.autoload :ModerationObject200ResponseAllOfLabelsInner, 'moderation_api/models/moderation_object200_response_all_of_labels_inner'
43
+ ModerationAPI.autoload :ModerationObjectRequest, 'moderation_api/models/moderation_object_request'
44
+ ModerationAPI.autoload :ModerationObjectRequestValue, 'moderation_api/models/moderation_object_request_value'
45
+ ModerationAPI.autoload :ModerationObjectRequestValueDataValue, 'moderation_api/models/moderation_object_request_value_data_value'
46
+ ModerationAPI.autoload :ModerationText200Response, 'moderation_api/models/moderation_text200_response'
47
+ ModerationAPI.autoload :ModerationText200ResponseAllOfAddress, 'moderation_api/models/moderation_text200_response_all_of_address'
48
+ ModerationAPI.autoload :ModerationText200ResponseAllOfEmail, 'moderation_api/models/moderation_text200_response_all_of_email'
49
+ ModerationAPI.autoload :ModerationText200ResponseAllOfName, 'moderation_api/models/moderation_text200_response_all_of_name'
50
+ ModerationAPI.autoload :ModerationText200ResponseAllOfNsfw, 'moderation_api/models/moderation_text200_response_all_of_nsfw'
51
+ ModerationAPI.autoload :ModerationText200ResponseAllOfNsfwLabelScores, 'moderation_api/models/moderation_text200_response_all_of_nsfw_label_scores'
52
+ ModerationAPI.autoload :ModerationText200ResponseAllOfPhone, 'moderation_api/models/moderation_text200_response_all_of_phone'
53
+ ModerationAPI.autoload :ModerationText200ResponseAllOfProfanity, 'moderation_api/models/moderation_text200_response_all_of_profanity'
54
+ ModerationAPI.autoload :ModerationText200ResponseAllOfPropriety, 'moderation_api/models/moderation_text200_response_all_of_propriety'
55
+ ModerationAPI.autoload :ModerationText200ResponseAllOfProprietyLabelScores, 'moderation_api/models/moderation_text200_response_all_of_propriety_label_scores'
56
+ ModerationAPI.autoload :ModerationText200ResponseAllOfQuality, 'moderation_api/models/moderation_text200_response_all_of_quality'
57
+ ModerationAPI.autoload :ModerationText200ResponseAllOfQualityLabelScores, 'moderation_api/models/moderation_text200_response_all_of_quality_label_scores'
58
+ ModerationAPI.autoload :ModerationText200ResponseAllOfRequest, 'moderation_api/models/moderation_text200_response_all_of_request'
59
+ ModerationAPI.autoload :ModerationText200ResponseAllOfSensitive, 'moderation_api/models/moderation_text200_response_all_of_sensitive'
60
+ ModerationAPI.autoload :ModerationText200ResponseAllOfSentiment, 'moderation_api/models/moderation_text200_response_all_of_sentiment'
61
+ ModerationAPI.autoload :ModerationText200ResponseAllOfSentimentLabelScores, 'moderation_api/models/moderation_text200_response_all_of_sentiment_label_scores'
62
+ ModerationAPI.autoload :ModerationText200ResponseAllOfToxicity, 'moderation_api/models/moderation_text200_response_all_of_toxicity'
63
+ ModerationAPI.autoload :ModerationText200ResponseAllOfToxicityLabelScores, 'moderation_api/models/moderation_text200_response_all_of_toxicity_label_scores'
64
+ ModerationAPI.autoload :ModerationText200ResponseAllOfUrl, 'moderation_api/models/moderation_text200_response_all_of_url'
65
+ ModerationAPI.autoload :ModerationText200ResponseAllOfUsername, 'moderation_api/models/moderation_text200_response_all_of_username'
66
+ ModerationAPI.autoload :ModerationText200ResponseAllOfWordlist, 'moderation_api/models/moderation_text200_response_all_of_wordlist'
67
+ ModerationAPI.autoload :ModerationText200ResponseAllOfWordlistsInner, 'moderation_api/models/moderation_text200_response_all_of_wordlists_inner'
68
+ ModerationAPI.autoload :ModerationTextRequest, 'moderation_api/models/moderation_text_request'
69
+ ModerationAPI.autoload :ModerationVideo200Response, 'moderation_api/models/moderation_video200_response'
70
+ ModerationAPI.autoload :ModerationVideoRequest, 'moderation_api/models/moderation_video_request'
71
+
72
+ # APIs
73
+ ModerationAPI.autoload :AccountApi, 'moderation_api/api/account_api'
74
+ ModerationAPI.autoload :ModerateApi, 'moderation_api/api/moderate_api'
75
+ ModerationAPI.autoload :QueueActionsApi, 'moderation_api/api/queue_actions_api'
76
+
77
+ module ModerationAPI
78
+ class << self
79
+ # Customize default settings for the SDK using block.
80
+ # ModerationAPI.configure do |config|
81
+ # config.username = "xxx"
82
+ # config.password = "xxx"
83
+ # end
84
+ # If no block given, return the default Configuration object.
85
+ def configure
86
+ if block_given?
87
+ yield(Configuration.default)
88
+ else
89
+ Configuration.default
90
+ end
91
+ end
92
+ end
93
+ end