Skip to content

Commit 5220e7b

Browse files
algolia-botmillotp
andcommitted
feat(specs): add notification settings to tasks [skip-bc] (generated)
algolia/api-clients-automation#4297 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 113dfb9 commit 5220e7b

File tree

8 files changed

+726
-8
lines changed

8 files changed

+726
-8
lines changed

lib/algolia/api/ingestion_client.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,7 @@ def list_sources(
18621862
# @param source_type [Array<SourceType>] Filters the tasks with the specified source type.
18631863
# @param destination_id [Array<String>] Destination IDs for filtering the list of tasks.
18641864
# @param trigger_type [Array<TriggerType>] Type of task trigger for filtering the list of tasks.
1865+
# @param with_email_notifications [Boolean] If specified, the response only includes tasks with notifications.email.enabled set to this value.
18651866
# @param sort [TaskSortKeys] Property by which to sort the list of tasks. (default to 'createdAt')
18661867
# @param order [OrderKeys] Sort order of the response, ascending or descending. (default to 'desc')
18671868
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
@@ -1875,6 +1876,7 @@ def list_tasks_with_http_info(
18751876
source_type = nil,
18761877
destination_id = nil,
18771878
trigger_type = nil,
1879+
with_email_notifications = nil,
18781880
sort = nil,
18791881
order = nil,
18801882
request_options = {}
@@ -1892,6 +1894,7 @@ def list_tasks_with_http_info(
18921894
end
18931895

18941896
query_params[:triggerType] = @api_client.build_collection_param(trigger_type, :csv) unless trigger_type.nil?
1897+
query_params[:withEmailNotifications] = with_email_notifications unless with_email_notifications.nil?
18951898
query_params[:sort] = sort unless sort.nil?
18961899
query_params[:order] = order unless order.nil?
18971900
query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
@@ -1925,6 +1928,7 @@ def list_tasks_with_http_info(
19251928
# @param source_type [Array<SourceType>] Filters the tasks with the specified source type.
19261929
# @param destination_id [Array<String>] Destination IDs for filtering the list of tasks.
19271930
# @param trigger_type [Array<TriggerType>] Type of task trigger for filtering the list of tasks.
1931+
# @param with_email_notifications [Boolean] If specified, the response only includes tasks with notifications.email.enabled set to this value.
19281932
# @param sort [TaskSortKeys] Property by which to sort the list of tasks. (default to 'createdAt')
19291933
# @param order [OrderKeys] Sort order of the response, ascending or descending. (default to 'desc')
19301934
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
@@ -1938,6 +1942,7 @@ def list_tasks(
19381942
source_type = nil,
19391943
destination_id = nil,
19401944
trigger_type = nil,
1945+
with_email_notifications = nil,
19411946
sort = nil,
19421947
order = nil,
19431948
request_options = {}
@@ -1951,6 +1956,7 @@ def list_tasks(
19511956
source_type,
19521957
destination_id,
19531958
trigger_type,
1959+
with_email_notifications,
19541960
sort,
19551961
order,
19561962
request_options
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2+
3+
require "date"
4+
require "time"
5+
6+
module Algolia
7+
module Ingestion
8+
class EmailNotifications
9+
# Whether to send email notifications, note that this doesn't prevent the task from being blocked.
10+
attr_accessor :enabled
11+
12+
# Attribute mapping from ruby-style variable name to JSON key.
13+
def self.attribute_map
14+
{
15+
:enabled => :enabled
16+
}
17+
end
18+
19+
# Returns all the JSON keys this model knows about
20+
def self.acceptable_attributes
21+
attribute_map.values
22+
end
23+
24+
# Attribute type mapping.
25+
def self.types_mapping
26+
{
27+
:enabled => :"Boolean"
28+
}
29+
end
30+
31+
# List of attributes with nullable: true
32+
def self.openapi_nullable
33+
Set.new(
34+
[]
35+
)
36+
end
37+
38+
# Initializes the object
39+
# @param [Hash] attributes Model attributes in the form of hash
40+
def initialize(attributes = {})
41+
if (!attributes.is_a?(Hash))
42+
raise(
43+
ArgumentError,
44+
"The input argument (attributes) must be a hash in `Algolia::EmailNotifications` initialize method"
45+
)
46+
end
47+
48+
# check to see if the attribute exists and convert string to symbol for hash key
49+
attributes = attributes.each_with_object({}) { |(k, v), h|
50+
if (!self.class.attribute_map.key?(k.to_sym))
51+
raise(
52+
ArgumentError,
53+
"`#{k}` is not a valid attribute in `Algolia::EmailNotifications`. Please check the name to make sure it's valid. List of attributes: " +
54+
self.class.attribute_map.keys.inspect
55+
)
56+
end
57+
58+
h[k.to_sym] = v
59+
}
60+
61+
if attributes.key?(:enabled)
62+
self.enabled = attributes[:enabled]
63+
end
64+
end
65+
66+
# Checks equality by comparing each attribute.
67+
# @param [Object] Object to be compared
68+
def ==(other)
69+
return true if self.equal?(other)
70+
self.class == other.class &&
71+
enabled == other.enabled
72+
end
73+
74+
# @see the `==` method
75+
# @param [Object] Object to be compared
76+
def eql?(other)
77+
self == other
78+
end
79+
80+
# Calculates hash code according to all attributes.
81+
# @return [Integer] Hash code
82+
def hash
83+
[enabled].hash
84+
end
85+
86+
# Builds the object from hash
87+
# @param [Hash] attributes Model attributes in the form of hash
88+
# @return [Object] Returns the model itself
89+
def self.build_from_hash(attributes)
90+
return nil unless attributes.is_a?(Hash)
91+
attributes = attributes.transform_keys(&:to_sym)
92+
transformed_hash = {}
93+
types_mapping.each_pair do |key, type|
94+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
95+
transformed_hash[key.to_sym] = nil
96+
elsif type =~ /\AArray<(.*)>/i
97+
# check to ensure the input is an array given that the attribute
98+
# is documented as an array but the input is not
99+
if attributes[attribute_map[key]].is_a?(Array)
100+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
101+
_deserialize(::Regexp.last_match(1), v)
102+
}
103+
end
104+
elsif !attributes[attribute_map[key]].nil?
105+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
106+
end
107+
end
108+
109+
new(transformed_hash)
110+
end
111+
112+
# Deserializes the data based on type
113+
# @param string type Data type
114+
# @param string value Value to be deserialized
115+
# @return [Object] Deserialized data
116+
def self._deserialize(type, value)
117+
case type.to_sym
118+
when :Time
119+
Time.parse(value)
120+
when :Date
121+
Date.parse(value)
122+
when :String
123+
value.to_s
124+
when :Integer
125+
value.to_i
126+
when :Float
127+
value.to_f
128+
when :Boolean
129+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
130+
true
131+
else
132+
false
133+
end
134+
135+
when :Object
136+
# generic object (usually a Hash), return directly
137+
value
138+
when /\AArray<(?<inner_type>.+)>\z/
139+
inner_type = Regexp.last_match[:inner_type]
140+
value.map { |v| _deserialize(inner_type, v) }
141+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142+
k_type = Regexp.last_match[:k_type]
143+
v_type = Regexp.last_match[:v_type]
144+
{}.tap do |hash|
145+
value.each do |k, v|
146+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147+
end
148+
end
149+
# model
150+
else
151+
# models (e.g. Pet) or oneOf
152+
klass = Algolia::Ingestion.const_get(type)
153+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
154+
.build_from_hash(value)
155+
end
156+
end
157+
158+
# Returns the string representation of the object
159+
# @return [String] String presentation of the object
160+
def to_s
161+
to_hash.to_s
162+
end
163+
164+
# to_body is an alias to to_hash (backward compatibility)
165+
# @return [Hash] Returns the object in the form of hash
166+
def to_body
167+
to_hash
168+
end
169+
170+
def to_json(*_args)
171+
to_hash.to_json
172+
end
173+
174+
# Returns the object in the form of hash
175+
# @return [Hash] Returns the object in the form of hash
176+
def to_hash
177+
hash = {}
178+
self.class.attribute_map.each_pair do |attr, param|
179+
value = send(attr)
180+
if value.nil?
181+
is_nullable = self.class.openapi_nullable.include?(attr)
182+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183+
end
184+
185+
hash[param] = _to_hash(value)
186+
end
187+
188+
hash
189+
end
190+
191+
# Outputs non-array value in the form of hash
192+
# For object, use to_hash. Otherwise, just return the value
193+
# @param [Object] value Any valid value
194+
# @return [Hash] Returns the value in the form of hash
195+
def _to_hash(value)
196+
if value.is_a?(Array)
197+
value.compact.map { |v| _to_hash(v) }
198+
elsif value.is_a?(Hash)
199+
{}.tap do |hash|
200+
value.each { |k, v| hash[k] = _to_hash(v) }
201+
end
202+
elsif value.respond_to?(:to_hash)
203+
value.to_hash
204+
else
205+
value
206+
end
207+
end
208+
209+
end
210+
211+
end
212+
end

0 commit comments

Comments
 (0)