kleister 1.14.1 → 1.15.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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +3 -3
  4. data/lib/kleister/api/auth_api.rb +137 -73
  5. data/lib/kleister/api/fabric_api.rb +37 -42
  6. data/lib/kleister/api/forge_api.rb +37 -42
  7. data/lib/kleister/api/{team_api.rb → group_api.rb} +359 -379
  8. data/lib/kleister/api/minecraft_api.rb +37 -42
  9. data/lib/kleister/api/mod_api.rb +471 -232
  10. data/lib/kleister/api/neoforge_api.rb +37 -42
  11. data/lib/kleister/api/pack_api.rb +215 -240
  12. data/lib/kleister/api/profile_api.rb +16 -16
  13. data/lib/kleister/api/quilt_api.rb +37 -42
  14. data/lib/kleister/api/user_api.rb +259 -279
  15. data/lib/kleister/api_client.rb +1 -1
  16. data/lib/kleister/api_error.rb +1 -1
  17. data/lib/kleister/configuration.rb +1 -8
  18. data/lib/kleister/models/{build_version_params.rb → attach_build_to_version_request.rb} +8 -20
  19. data/lib/kleister/models/{quilt_build_params.rb → attach_minecraft_to_build_request.rb} +8 -20
  20. data/lib/kleister/models/auth_token.rb +1 -1
  21. data/lib/kleister/models/auth_verify.rb +1 -1
  22. data/lib/kleister/models/build.rb +3 -13
  23. data/lib/kleister/models/build_version.rb +2 -3
  24. data/lib/kleister/models/{pack_back.rb → create_build_request.rb} +76 -58
  25. data/lib/kleister/models/{mods.rb → create_group_request.rb} +19 -18
  26. data/lib/kleister/models/{pack_icon.rb → create_mod_request.rb} +48 -54
  27. data/lib/kleister/models/{forge_builds.rb → create_pack_request.rb} +33 -23
  28. data/lib/kleister/models/create_user_request.rb +257 -0
  29. data/lib/kleister/models/{builds.rb → create_version_request.rb} +25 -23
  30. data/lib/kleister/models/{packs.rb → delete_group_from_mod_request.rb} +20 -21
  31. data/lib/kleister/models/delete_group_from_pack_request.rb +219 -0
  32. data/lib/kleister/models/delete_pack_from_group_request.rb +219 -0
  33. data/lib/kleister/models/{users.rb → delete_pack_from_user_request.rb} +20 -21
  34. data/lib/kleister/models/fabric.rb +1 -1
  35. data/lib/kleister/models/forge.rb +1 -1
  36. data/lib/kleister/models/{team.rb → group.rb} +5 -5
  37. data/lib/kleister/models/{team_mod.rb → group_mod.rb} +21 -21
  38. data/lib/kleister/models/{team_pack.rb → group_pack.rb} +21 -21
  39. data/lib/kleister/models/{build_versions.rb → list_build_versions200_response.rb} +56 -18
  40. data/lib/kleister/models/{pack_teams.rb → list_builds200_response.rb} +59 -20
  41. data/lib/kleister/models/{fabric_builds.rb → list_fabric_builds200_response.rb} +56 -18
  42. data/lib/kleister/models/{fabrics.rb → list_fabrics200_response.rb} +52 -13
  43. data/lib/kleister/models/list_forge_builds200_response.rb +266 -0
  44. data/lib/kleister/models/{forges.rb → list_forges200_response.rb} +52 -13
  45. data/lib/kleister/models/list_group_mods200_response.rb +266 -0
  46. data/lib/kleister/models/list_group_packs200_response.rb +266 -0
  47. data/lib/kleister/models/list_group_users200_response.rb +266 -0
  48. data/lib/kleister/models/list_groups200_response.rb +259 -0
  49. data/lib/kleister/models/{minecraft_builds.rb → list_minecraft_builds200_response.rb} +56 -18
  50. data/lib/kleister/models/list_minecrafts200_response.rb +259 -0
  51. data/lib/kleister/models/list_mod_groups200_response.rb +266 -0
  52. data/lib/kleister/models/list_mod_users200_response.rb +266 -0
  53. data/lib/kleister/models/{team_mods.rb → list_mods200_response.rb} +52 -20
  54. data/lib/kleister/models/{neoforge_builds.rb → list_neoforge_builds200_response.rb} +56 -18
  55. data/lib/kleister/models/{neoforges.rb → list_neoforges200_response.rb} +52 -13
  56. data/lib/kleister/models/list_pack_groups200_response.rb +266 -0
  57. data/lib/kleister/models/{pack_users.rb → list_pack_users200_response.rb} +56 -17
  58. data/lib/kleister/models/list_packs200_response.rb +259 -0
  59. data/lib/kleister/models/{mod_teams.rb → list_providers200_response.rb} +31 -23
  60. data/lib/kleister/models/{quilt_builds.rb → list_quilt_builds200_response.rb} +56 -17
  61. data/lib/kleister/models/{quilts.rb → list_quilts200_response.rb} +52 -13
  62. data/lib/kleister/models/list_user_groups200_response.rb +266 -0
  63. data/lib/kleister/models/{user_teams.rb → list_user_mods200_response.rb} +59 -20
  64. data/lib/kleister/models/{user_packs.rb → list_user_packs200_response.rb} +56 -17
  65. data/lib/kleister/models/{team_users.rb → list_users200_response.rb} +52 -20
  66. data/lib/kleister/models/{version_builds.rb → list_version_builds200_response.rb} +56 -18
  67. data/lib/kleister/models/{versions.rb → list_versions200_response.rb} +52 -13
  68. data/lib/kleister/models/{auth_login.rb → login_auth_request.rb} +4 -4
  69. data/lib/kleister/models/minecraft.rb +1 -1
  70. data/lib/kleister/models/mod.rb +10 -3
  71. data/lib/kleister/models/{team_packs.rb → mod_avatar.rb} +32 -23
  72. data/lib/kleister/models/neoforge.rb +1 -1
  73. data/lib/kleister/models/notification.rb +2 -3
  74. data/lib/kleister/models/pack.rb +8 -22
  75. data/lib/kleister/models/{minecrafts.rb → pack_avatar.rb} +34 -18
  76. data/lib/kleister/models/{mod_users.rb → permit_group_mod_request.rb} +29 -25
  77. data/lib/kleister/models/{forge_build_params.rb → permit_group_pack_request.rb} +15 -17
  78. data/lib/kleister/models/{fabric_build_params.rb → permit_pack_group_request.rb} +24 -26
  79. data/lib/kleister/models/{user_mods.rb → permit_pack_user_request.rb} +29 -25
  80. data/lib/kleister/models/profile.rb +20 -20
  81. data/lib/kleister/models/provider.rb +1 -1
  82. data/lib/kleister/models/quilt.rb +1 -1
  83. data/lib/kleister/models/{teams.rb → redirect_auth_request.rb} +20 -21
  84. data/lib/kleister/models/update_profile_request.rb +237 -0
  85. data/lib/kleister/models/update_user_request.rb +253 -0
  86. data/lib/kleister/models/user.rb +1 -1
  87. data/lib/kleister/models/user_auth.rb +1 -1
  88. data/lib/kleister/models/{user_team.rb → user_group.rb} +23 -23
  89. data/lib/kleister/models/user_mod.rb +1 -1
  90. data/lib/kleister/models/user_pack.rb +1 -1
  91. data/lib/kleister/models/validation.rb +1 -1
  92. data/lib/kleister/models/version.rb +3 -11
  93. data/lib/kleister/models/version_file.rb +3 -18
  94. data/lib/kleister/version.rb +2 -2
  95. data/lib/kleister.rb +57 -56
  96. metadata +58 -57
  97. data/lib/kleister/models/minecraft_build_params.rb +0 -233
  98. data/lib/kleister/models/mod_team_params.rb +0 -265
  99. data/lib/kleister/models/mod_user_params.rb +0 -265
  100. data/lib/kleister/models/neoforge_build_params.rb +0 -233
  101. data/lib/kleister/models/pack_logo.rb +0 -275
  102. data/lib/kleister/models/pack_team_params.rb +0 -265
  103. data/lib/kleister/models/pack_user_params.rb +0 -265
  104. data/lib/kleister/models/providers.rb +0 -220
  105. data/lib/kleister/models/team_mod_params.rb +0 -265
  106. data/lib/kleister/models/team_pack_params.rb +0 -265
  107. data/lib/kleister/models/team_user_params.rb +0 -265
  108. data/lib/kleister/models/user_mod_params.rb +0 -265
  109. data/lib/kleister/models/user_pack_params.rb +0 -265
  110. data/lib/kleister/models/user_team_params.rb +0 -265
  111. data/lib/kleister/models/version_build_params.rb +0 -233
@@ -5,22 +5,20 @@
5
5
  # The version of the OpenAPI document: 1.0.0-alpha1
6
6
  # Contact: kleister@webhippie.de
7
7
  # Generated by: https://openapi-generator.tech
8
- # Generator version: 7.6.0
8
+ # Generator version: 7.12.0
9
9
  #
10
10
 
11
11
  require 'date'
12
12
  require 'time'
13
13
 
14
14
  module Kleister
15
- # Model to represent list of packs
16
- class Packs
17
- attr_accessor :total, :packs
15
+ class DeleteGroupFromModRequest
16
+ attr_accessor :mod
18
17
 
19
18
  # Attribute mapping from ruby-style variable name to JSON key.
20
19
  def self.attribute_map
21
20
  {
22
- total: :total,
23
- packs: :packs
21
+ mod: :mod
24
22
  }
25
23
  end
26
24
 
@@ -32,8 +30,7 @@ module Kleister
32
30
  # Attribute type mapping.
33
31
  def self.openapi_types
34
32
  {
35
- total: :Integer,
36
- packs: :'Array<Pack>'
33
+ mod: :String
37
34
  }
38
35
  end
39
36
 
@@ -47,38 +44,41 @@ module Kleister
47
44
  # @param [Hash] attributes Model attributes in the form of hash
48
45
  def initialize(attributes = {})
49
46
  unless attributes.is_a?(Hash)
50
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::Packs` initialize method'
47
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::DeleteGroupFromModRequest` initialize method'
51
48
  end
52
49
 
53
50
  # check to see if the attribute exists and convert string to symbol for hash key
54
51
  attributes = attributes.each_with_object({}) do |(k, v), h|
55
52
  unless self.class.attribute_map.key?(k.to_sym)
56
- raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::Packs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::DeleteGroupFromModRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
54
  end
58
55
 
59
56
  h[k.to_sym] = v
60
57
  end
61
58
 
62
- if attributes.key?(:total)
63
- self.total = attributes[:total]
64
- end
65
-
66
- if attributes.key?(:packs) && (value = attributes[:packs]).is_a?(Array)
67
- self.packs = value
68
- end
59
+ self.mod = if attributes.key?(:mod)
60
+ attributes[:mod]
61
+ end
69
62
  end
70
63
 
71
64
  # Show invalid properties with the reasons. Usually used together with valid?
72
65
  # @return Array for valid properties with the reasons
73
66
  def list_invalid_properties
74
67
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
- []
68
+ invalid_properties = []
69
+ if @mod.nil?
70
+ invalid_properties.push('invalid value for "mod", mod cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
76
74
  end
77
75
 
78
76
  # Check to see if the all the properties in the model are valid
79
77
  # @return true if the model is valid
80
78
  def valid?
81
79
  warn '[DEPRECATED] the `valid?` method is obsolete'
80
+ return false if @mod.nil?
81
+
82
82
  true
83
83
  end
84
84
 
@@ -88,8 +88,7 @@ module Kleister
88
88
  return true if equal?(other)
89
89
 
90
90
  self.class == other.class &&
91
- total == other.total &&
92
- packs == other.packs
91
+ mod == other.mod
93
92
  end
94
93
 
95
94
  # @see the `==` method
@@ -101,7 +100,7 @@ module Kleister
101
100
  # Calculates hash code according to all attributes.
102
101
  # @return [Integer] Hash code
103
102
  def hash
104
- [total, packs].hash
103
+ [mod].hash
105
104
  end
106
105
 
107
106
  # Builds the object from hash
@@ -0,0 +1,219 @@
1
+ # Kleister OpenAPI
2
+ #
3
+ # API definition for Kleister, manage mod packs for Minecraft
4
+ #
5
+ # The version of the OpenAPI document: 1.0.0-alpha1
6
+ # Contact: kleister@webhippie.de
7
+ # Generated by: https://openapi-generator.tech
8
+ # Generator version: 7.12.0
9
+ #
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Kleister
15
+ class DeleteGroupFromPackRequest
16
+ attr_accessor :pack
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ pack: :pack
22
+ }
23
+ end
24
+
25
+ # Returns all the JSON keys this model knows about
26
+ def self.acceptable_attributes
27
+ attribute_map.values
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ pack: :String
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ unless attributes.is_a?(Hash)
47
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::DeleteGroupFromPackRequest` initialize method'
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) do |(k, v), h|
52
+ unless self.class.attribute_map.key?(k.to_sym)
53
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::DeleteGroupFromPackRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+
56
+ h[k.to_sym] = v
57
+ end
58
+
59
+ self.pack = if attributes.key?(:pack)
60
+ attributes[:pack]
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
68
+ invalid_properties = []
69
+ if @pack.nil?
70
+ invalid_properties.push('invalid value for "pack", pack cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ warn '[DEPRECATED] the `valid?` method is obsolete'
80
+ return false if @pack.nil?
81
+
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(other)
88
+ return true if equal?(other)
89
+
90
+ self.class == other.class &&
91
+ pack == other.pack
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(other)
97
+ self == other
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [pack].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ openapi_types.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash[key.to_s] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = Kleister.const_get(type)
169
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+ end
219
+ end
@@ -0,0 +1,219 @@
1
+ # Kleister OpenAPI
2
+ #
3
+ # API definition for Kleister, manage mod packs for Minecraft
4
+ #
5
+ # The version of the OpenAPI document: 1.0.0-alpha1
6
+ # Contact: kleister@webhippie.de
7
+ # Generated by: https://openapi-generator.tech
8
+ # Generator version: 7.12.0
9
+ #
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Kleister
15
+ class DeletePackFromGroupRequest
16
+ attr_accessor :group
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ group: :group
22
+ }
23
+ end
24
+
25
+ # Returns all the JSON keys this model knows about
26
+ def self.acceptable_attributes
27
+ attribute_map.values
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ group: :String
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ unless attributes.is_a?(Hash)
47
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::DeletePackFromGroupRequest` initialize method'
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) do |(k, v), h|
52
+ unless self.class.attribute_map.key?(k.to_sym)
53
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::DeletePackFromGroupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+
56
+ h[k.to_sym] = v
57
+ end
58
+
59
+ self.group = if attributes.key?(:group)
60
+ attributes[:group]
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
68
+ invalid_properties = []
69
+ if @group.nil?
70
+ invalid_properties.push('invalid value for "group", group cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ warn '[DEPRECATED] the `valid?` method is obsolete'
80
+ return false if @group.nil?
81
+
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(other)
88
+ return true if equal?(other)
89
+
90
+ self.class == other.class &&
91
+ group == other.group
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(other)
97
+ self == other
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [group].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ openapi_types.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash[key.to_s] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = Kleister.const_get(type)
169
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+ end
219
+ end
@@ -5,22 +5,20 @@
5
5
  # The version of the OpenAPI document: 1.0.0-alpha1
6
6
  # Contact: kleister@webhippie.de
7
7
  # Generated by: https://openapi-generator.tech
8
- # Generator version: 7.6.0
8
+ # Generator version: 7.12.0
9
9
  #
10
10
 
11
11
  require 'date'
12
12
  require 'time'
13
13
 
14
14
  module Kleister
15
- # Model to represent list of users
16
- class Users
17
- attr_accessor :total, :users
15
+ class DeletePackFromUserRequest
16
+ attr_accessor :user
18
17
 
19
18
  # Attribute mapping from ruby-style variable name to JSON key.
20
19
  def self.attribute_map
21
20
  {
22
- total: :total,
23
- users: :users
21
+ user: :user
24
22
  }
25
23
  end
26
24
 
@@ -32,8 +30,7 @@ module Kleister
32
30
  # Attribute type mapping.
33
31
  def self.openapi_types
34
32
  {
35
- total: :Integer,
36
- users: :'Array<User>'
33
+ user: :String
37
34
  }
38
35
  end
39
36
 
@@ -47,38 +44,41 @@ module Kleister
47
44
  # @param [Hash] attributes Model attributes in the form of hash
48
45
  def initialize(attributes = {})
49
46
  unless attributes.is_a?(Hash)
50
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::Users` initialize method'
47
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::DeletePackFromUserRequest` initialize method'
51
48
  end
52
49
 
53
50
  # check to see if the attribute exists and convert string to symbol for hash key
54
51
  attributes = attributes.each_with_object({}) do |(k, v), h|
55
52
  unless self.class.attribute_map.key?(k.to_sym)
56
- raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::Users`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::DeletePackFromUserRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
54
  end
58
55
 
59
56
  h[k.to_sym] = v
60
57
  end
61
58
 
62
- if attributes.key?(:total)
63
- self.total = attributes[:total]
64
- end
65
-
66
- if attributes.key?(:users) && (value = attributes[:users]).is_a?(Array)
67
- self.users = value
68
- end
59
+ self.user = if attributes.key?(:user)
60
+ attributes[:user]
61
+ end
69
62
  end
70
63
 
71
64
  # Show invalid properties with the reasons. Usually used together with valid?
72
65
  # @return Array for valid properties with the reasons
73
66
  def list_invalid_properties
74
67
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
- []
68
+ invalid_properties = []
69
+ if @user.nil?
70
+ invalid_properties.push('invalid value for "user", user cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
76
74
  end
77
75
 
78
76
  # Check to see if the all the properties in the model are valid
79
77
  # @return true if the model is valid
80
78
  def valid?
81
79
  warn '[DEPRECATED] the `valid?` method is obsolete'
80
+ return false if @user.nil?
81
+
82
82
  true
83
83
  end
84
84
 
@@ -88,8 +88,7 @@ module Kleister
88
88
  return true if equal?(other)
89
89
 
90
90
  self.class == other.class &&
91
- total == other.total &&
92
- users == other.users
91
+ user == other.user
93
92
  end
94
93
 
95
94
  # @see the `==` method
@@ -101,7 +100,7 @@ module Kleister
101
100
  # Calculates hash code according to all attributes.
102
101
  # @return [Integer] Hash code
103
102
  def hash
104
- [total, users].hash
103
+ [user].hash
105
104
  end
106
105
 
107
106
  # Builds the object from hash
@@ -5,7 +5,7 @@
5
5
  # The version of the OpenAPI document: 1.0.0-alpha1
6
6
  # Contact: kleister@webhippie.de
7
7
  # Generated by: https://openapi-generator.tech
8
- # Generator version: 7.6.0
8
+ # Generator version: 7.12.0
9
9
  #
10
10
 
11
11
  require 'date'
@@ -5,7 +5,7 @@
5
5
  # The version of the OpenAPI document: 1.0.0-alpha1
6
6
  # Contact: kleister@webhippie.de
7
7
  # Generated by: https://openapi-generator.tech
8
- # Generator version: 7.6.0
8
+ # Generator version: 7.12.0
9
9
  #
10
10
 
11
11
  require 'date'