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,23 +5,21 @@
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 mod teams
16
- class ModTeams
17
- attr_accessor :mod, :total, :teams
15
+ class ListProviders200Response
16
+ attr_accessor :total, :providers
18
17
 
19
18
  # Attribute mapping from ruby-style variable name to JSON key.
20
19
  def self.attribute_map
21
20
  {
22
- mod: :mod,
23
21
  total: :total,
24
- teams: :teams
22
+ providers: :providers
25
23
  }
26
24
  end
27
25
 
@@ -33,9 +31,8 @@ module Kleister
33
31
  # Attribute type mapping.
34
32
  def self.openapi_types
35
33
  {
36
- mod: :Mod,
37
34
  total: :Integer,
38
- teams: :'Array<TeamMod>'
35
+ providers: :'Array<Provider>'
39
36
  }
40
37
  end
41
38
 
@@ -49,28 +46,28 @@ module Kleister
49
46
  # @param [Hash] attributes Model attributes in the form of hash
50
47
  def initialize(attributes = {})
51
48
  unless attributes.is_a?(Hash)
52
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::ModTeams` initialize method'
49
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::ListProviders200Response` initialize method'
53
50
  end
54
51
 
55
52
  # check to see if the attribute exists and convert string to symbol for hash key
56
53
  attributes = attributes.each_with_object({}) do |(k, v), h|
57
54
  unless self.class.attribute_map.key?(k.to_sym)
58
- raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::ModTeams`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::ListProviders200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
56
  end
60
57
 
61
58
  h[k.to_sym] = v
62
59
  end
63
60
 
64
- if attributes.key?(:mod)
65
- self.mod = attributes[:mod]
66
- end
67
-
68
- if attributes.key?(:total)
69
- self.total = attributes[:total]
70
- end
61
+ self.total = if attributes.key?(:total)
62
+ attributes[:total]
63
+ end
71
64
 
72
- if attributes.key?(:teams) && (value = attributes[:teams]).is_a?(Array)
73
- self.teams = value
65
+ if attributes.key?(:providers)
66
+ if (value = attributes[:providers]).is_a?(Array)
67
+ self.providers = value
68
+ end
69
+ else
70
+ self.providers = nil
74
71
  end
75
72
  end
76
73
 
@@ -78,13 +75,25 @@ module Kleister
78
75
  # @return Array for valid properties with the reasons
79
76
  def list_invalid_properties
80
77
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
- []
78
+ invalid_properties = []
79
+ if @total.nil?
80
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
81
+ end
82
+
83
+ if @providers.nil?
84
+ invalid_properties.push('invalid value for "providers", providers cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
82
88
  end
83
89
 
84
90
  # Check to see if the all the properties in the model are valid
85
91
  # @return true if the model is valid
86
92
  def valid?
87
93
  warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ return false if @total.nil?
95
+ return false if @providers.nil?
96
+
88
97
  true
89
98
  end
90
99
 
@@ -94,9 +103,8 @@ module Kleister
94
103
  return true if equal?(other)
95
104
 
96
105
  self.class == other.class &&
97
- mod == other.mod &&
98
106
  total == other.total &&
99
- teams == other.teams
107
+ providers == other.providers
100
108
  end
101
109
 
102
110
  # @see the `==` method
@@ -108,7 +116,7 @@ module Kleister
108
116
  # Calculates hash code according to all attributes.
109
117
  # @return [Integer] Hash code
110
118
  def hash
111
- [mod, total, teams].hash
119
+ [total, providers].hash
112
120
  end
113
121
 
114
122
  # Builds the object from hash
@@ -5,22 +5,23 @@
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 quilt builds
16
- class QuiltBuilds
17
- attr_accessor :quilt, :total, :builds
15
+ class ListQuiltBuilds200Response
16
+ attr_accessor :total, :limit, :offset, :quilt, :builds
18
17
 
19
18
  # Attribute mapping from ruby-style variable name to JSON key.
20
19
  def self.attribute_map
21
20
  {
22
- quilt: :quilt,
23
21
  total: :total,
22
+ limit: :limit,
23
+ offset: :offset,
24
+ quilt: :quilt,
24
25
  builds: :builds
25
26
  }
26
27
  end
@@ -33,8 +34,10 @@ module Kleister
33
34
  # Attribute type mapping.
34
35
  def self.openapi_types
35
36
  {
36
- quilt: :Quilt,
37
37
  total: :Integer,
38
+ limit: :Integer,
39
+ offset: :Integer,
40
+ quilt: :Quilt,
38
41
  builds: :'Array<Build>'
39
42
  }
40
43
  end
@@ -49,28 +52,40 @@ module Kleister
49
52
  # @param [Hash] attributes Model attributes in the form of hash
50
53
  def initialize(attributes = {})
51
54
  unless attributes.is_a?(Hash)
52
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::QuiltBuilds` initialize method'
55
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::ListQuiltBuilds200Response` initialize method'
53
56
  end
54
57
 
55
58
  # check to see if the attribute exists and convert string to symbol for hash key
56
59
  attributes = attributes.each_with_object({}) do |(k, v), h|
57
60
  unless self.class.attribute_map.key?(k.to_sym)
58
- raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::QuiltBuilds`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::ListQuiltBuilds200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
62
  end
60
63
 
61
64
  h[k.to_sym] = v
62
65
  end
63
66
 
67
+ self.total = if attributes.key?(:total)
68
+ attributes[:total]
69
+ end
70
+
71
+ self.limit = if attributes.key?(:limit)
72
+ attributes[:limit]
73
+ end
74
+
75
+ self.offset = if attributes.key?(:offset)
76
+ attributes[:offset]
77
+ end
78
+
64
79
  if attributes.key?(:quilt)
65
80
  self.quilt = attributes[:quilt]
66
81
  end
67
82
 
68
- if attributes.key?(:total)
69
- self.total = attributes[:total]
70
- end
71
-
72
- if attributes.key?(:builds) && (value = attributes[:builds]).is_a?(Array)
73
- self.builds = value
83
+ if attributes.key?(:builds)
84
+ if (value = attributes[:builds]).is_a?(Array)
85
+ self.builds = value
86
+ end
87
+ else
88
+ self.builds = nil
74
89
  end
75
90
  end
76
91
 
@@ -78,13 +93,35 @@ module Kleister
78
93
  # @return Array for valid properties with the reasons
79
94
  def list_invalid_properties
80
95
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
- []
96
+ invalid_properties = []
97
+ if @total.nil?
98
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
99
+ end
100
+
101
+ if @limit.nil?
102
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
103
+ end
104
+
105
+ if @offset.nil?
106
+ invalid_properties.push('invalid value for "offset", offset cannot be nil.')
107
+ end
108
+
109
+ if @builds.nil?
110
+ invalid_properties.push('invalid value for "builds", builds cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
82
114
  end
83
115
 
84
116
  # Check to see if the all the properties in the model are valid
85
117
  # @return true if the model is valid
86
118
  def valid?
87
119
  warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ return false if @total.nil?
121
+ return false if @limit.nil?
122
+ return false if @offset.nil?
123
+ return false if @builds.nil?
124
+
88
125
  true
89
126
  end
90
127
 
@@ -94,8 +131,10 @@ module Kleister
94
131
  return true if equal?(other)
95
132
 
96
133
  self.class == other.class &&
97
- quilt == other.quilt &&
98
134
  total == other.total &&
135
+ limit == other.limit &&
136
+ offset == other.offset &&
137
+ quilt == other.quilt &&
99
138
  builds == other.builds
100
139
  end
101
140
 
@@ -108,7 +147,7 @@ module Kleister
108
147
  # Calculates hash code according to all attributes.
109
148
  # @return [Integer] Hash code
110
149
  def hash
111
- [quilt, total, builds].hash
150
+ [total, limit, offset, quilt, builds].hash
112
151
  end
113
152
 
114
153
  # Builds the object from hash
@@ -5,21 +5,22 @@
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 quilts
16
- class Quilts
17
- attr_accessor :total, :versions
15
+ class ListQuilts200Response
16
+ attr_accessor :total, :limit, :offset, :versions
18
17
 
19
18
  # Attribute mapping from ruby-style variable name to JSON key.
20
19
  def self.attribute_map
21
20
  {
22
21
  total: :total,
22
+ limit: :limit,
23
+ offset: :offset,
23
24
  versions: :versions
24
25
  }
25
26
  end
@@ -33,6 +34,8 @@ module Kleister
33
34
  def self.openapi_types
34
35
  {
35
36
  total: :Integer,
37
+ limit: :Integer,
38
+ offset: :Integer,
36
39
  versions: :'Array<Quilt>'
37
40
  }
38
41
  end
@@ -47,24 +50,36 @@ module Kleister
47
50
  # @param [Hash] attributes Model attributes in the form of hash
48
51
  def initialize(attributes = {})
49
52
  unless attributes.is_a?(Hash)
50
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::Quilts` initialize method'
53
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::ListQuilts200Response` initialize method'
51
54
  end
52
55
 
53
56
  # check to see if the attribute exists and convert string to symbol for hash key
54
57
  attributes = attributes.each_with_object({}) do |(k, v), h|
55
58
  unless self.class.attribute_map.key?(k.to_sym)
56
- raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::Quilts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::ListQuilts200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
60
  end
58
61
 
59
62
  h[k.to_sym] = v
60
63
  end
61
64
 
62
- if attributes.key?(:total)
63
- self.total = attributes[:total]
64
- end
65
+ self.total = if attributes.key?(:total)
66
+ attributes[:total]
67
+ end
68
+
69
+ self.limit = if attributes.key?(:limit)
70
+ attributes[:limit]
71
+ end
65
72
 
66
- if attributes.key?(:versions) && (value = attributes[:versions]).is_a?(Array)
67
- self.versions = value
73
+ self.offset = if attributes.key?(:offset)
74
+ attributes[:offset]
75
+ end
76
+
77
+ if attributes.key?(:versions)
78
+ if (value = attributes[:versions]).is_a?(Array)
79
+ self.versions = value
80
+ end
81
+ else
82
+ self.versions = nil
68
83
  end
69
84
  end
70
85
 
@@ -72,13 +87,35 @@ module Kleister
72
87
  # @return Array for valid properties with the reasons
73
88
  def list_invalid_properties
74
89
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
- []
90
+ invalid_properties = []
91
+ if @total.nil?
92
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
93
+ end
94
+
95
+ if @limit.nil?
96
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
97
+ end
98
+
99
+ if @offset.nil?
100
+ invalid_properties.push('invalid value for "offset", offset cannot be nil.')
101
+ end
102
+
103
+ if @versions.nil?
104
+ invalid_properties.push('invalid value for "versions", versions cannot be nil.')
105
+ end
106
+
107
+ invalid_properties
76
108
  end
77
109
 
78
110
  # Check to see if the all the properties in the model are valid
79
111
  # @return true if the model is valid
80
112
  def valid?
81
113
  warn '[DEPRECATED] the `valid?` method is obsolete'
114
+ return false if @total.nil?
115
+ return false if @limit.nil?
116
+ return false if @offset.nil?
117
+ return false if @versions.nil?
118
+
82
119
  true
83
120
  end
84
121
 
@@ -89,6 +126,8 @@ module Kleister
89
126
 
90
127
  self.class == other.class &&
91
128
  total == other.total &&
129
+ limit == other.limit &&
130
+ offset == other.offset &&
92
131
  versions == other.versions
93
132
  end
94
133
 
@@ -101,7 +140,7 @@ module Kleister
101
140
  # Calculates hash code according to all attributes.
102
141
  # @return [Integer] Hash code
103
142
  def hash
104
- [total, versions].hash
143
+ [total, limit, offset, versions].hash
105
144
  end
106
145
 
107
146
  # Builds the object from hash
@@ -0,0 +1,266 @@
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 ListUserGroups200Response
16
+ attr_accessor :total, :limit, :offset, :user, :groups
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ total: :total,
22
+ limit: :limit,
23
+ offset: :offset,
24
+ user: :user,
25
+ groups: :groups
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ total: :Integer,
38
+ limit: :Integer,
39
+ offset: :Integer,
40
+ user: :User,
41
+ groups: :'Array<UserGroup>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ unless attributes.is_a?(Hash)
55
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Kleister::ListUserGroups200Response` initialize method'
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) do |(k, v), h|
60
+ unless self.class.attribute_map.key?(k.to_sym)
61
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Kleister::ListUserGroups200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+
64
+ h[k.to_sym] = v
65
+ end
66
+
67
+ self.total = if attributes.key?(:total)
68
+ attributes[:total]
69
+ end
70
+
71
+ self.limit = if attributes.key?(:limit)
72
+ attributes[:limit]
73
+ end
74
+
75
+ self.offset = if attributes.key?(:offset)
76
+ attributes[:offset]
77
+ end
78
+
79
+ if attributes.key?(:user)
80
+ self.user = attributes[:user]
81
+ end
82
+
83
+ if attributes.key?(:groups)
84
+ if (value = attributes[:groups]).is_a?(Array)
85
+ self.groups = value
86
+ end
87
+ else
88
+ self.groups = nil
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
96
+ invalid_properties = []
97
+ if @total.nil?
98
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
99
+ end
100
+
101
+ if @limit.nil?
102
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
103
+ end
104
+
105
+ if @offset.nil?
106
+ invalid_properties.push('invalid value for "offset", offset cannot be nil.')
107
+ end
108
+
109
+ if @groups.nil?
110
+ invalid_properties.push('invalid value for "groups", groups cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ return false if @total.nil?
121
+ return false if @limit.nil?
122
+ return false if @offset.nil?
123
+ return false if @groups.nil?
124
+
125
+ true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(other)
131
+ return true if equal?(other)
132
+
133
+ self.class == other.class &&
134
+ total == other.total &&
135
+ limit == other.limit &&
136
+ offset == other.offset &&
137
+ user == other.user &&
138
+ groups == other.groups
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(other)
144
+ self == other
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [total, limit, offset, user, groups].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+
159
+ attributes = attributes.transform_keys(&:to_sym)
160
+ transformed_hash = {}
161
+ openapi_types.each_pair do |key, type|
162
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
163
+ transformed_hash[key.to_s] = nil
164
+ elsif type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[attribute_map[key]].is_a?(Array)
168
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
169
+ end
170
+ elsif !attributes[attribute_map[key]].nil?
171
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
172
+ end
173
+ end
174
+ new(transformed_hash)
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param string type Data type
179
+ # @param string value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def self._deserialize(type, value)
182
+ case type.to_sym
183
+ when :Time
184
+ Time.parse(value)
185
+ when :Date
186
+ Date.parse(value)
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :Boolean
194
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else # model
214
+ # models (e.g. Pet) or oneOf
215
+ klass = Kleister.const_get(type)
216
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+ end
266
+ end