fastlane 2.148.1 → 2.150.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +84 -84
  3. data/deliver/lib/deliver.rb +0 -1
  4. data/deliver/lib/deliver/app_screenshot.rb +28 -27
  5. data/deliver/lib/deliver/options.rb +6 -11
  6. data/deliver/lib/deliver/runner.rb +7 -21
  7. data/deliver/lib/deliver/setup.rb +5 -30
  8. data/deliver/lib/deliver/submit_for_review.rb +155 -90
  9. data/deliver/lib/deliver/upload_metadata.rb +355 -143
  10. data/deliver/lib/deliver/upload_price_tier.rb +22 -8
  11. data/deliver/lib/deliver/upload_screenshots.rb +112 -37
  12. data/fastlane/lib/assets/s3_html_template.erb +1 -1
  13. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +42 -2
  14. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  15. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +77 -96
  16. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +3 -2
  17. data/fastlane/lib/fastlane/actions/download_dsyms.rb +7 -1
  18. data/fastlane/lib/fastlane/actions/google_play_track_release_names.rb +74 -0
  19. data/fastlane/lib/fastlane/actions/hipchat.rb +1 -1
  20. data/fastlane/lib/fastlane/actions/set_changelog.rb +23 -20
  21. data/fastlane/lib/fastlane/actions/slack.rb +2 -2
  22. data/fastlane/lib/fastlane/actions/slather.rb +8 -1
  23. data/fastlane/lib/fastlane/actions/spm.rb +7 -0
  24. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +2 -33
  25. data/fastlane/lib/fastlane/lane.rb +3 -3
  26. data/fastlane/lib/fastlane/swift_fastlane_function.rb +22 -5
  27. data/fastlane/lib/fastlane/version.rb +1 -1
  28. data/fastlane/swift/ControlCommand.swift +1 -0
  29. data/fastlane/swift/Deliverfile.swift +1 -1
  30. data/fastlane/swift/Fastlane.swift +79 -22
  31. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/xcshareddata/xcschemes/FastlaneRunner.xcscheme +3 -9
  32. data/fastlane/swift/Gymfile.swift +1 -1
  33. data/fastlane/swift/GymfileProtocol.swift +1 -1
  34. data/fastlane/swift/LaneFileProtocol.swift +2 -5
  35. data/fastlane/swift/Matchfile.swift +1 -1
  36. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  37. data/fastlane/swift/Precheckfile.swift +1 -1
  38. data/fastlane/swift/RubyCommand.swift +29 -6
  39. data/fastlane/swift/RubyCommandable.swift +1 -0
  40. data/fastlane/swift/Runner.swift +85 -13
  41. data/fastlane/swift/Scanfile.swift +1 -1
  42. data/fastlane/swift/ScanfileProtocol.swift +2 -2
  43. data/fastlane/swift/Screengrabfile.swift +1 -1
  44. data/fastlane/swift/Snapshotfile.swift +1 -1
  45. data/fastlane/swift/SnapshotfileProtocol.swift +9 -1
  46. data/fastlane/swift/SocketClient.swift +76 -45
  47. data/fastlane/swift/SocketClientDelegateProtocol.swift +1 -1
  48. data/fastlane/swift/SocketResponse.swift +1 -0
  49. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +1 -3
  50. data/fastlane_core/lib/fastlane_core/pkg_file_analyser.rb +7 -0
  51. data/frameit/lib/frameit/device_types.rb +100 -100
  52. data/gym/lib/gym/options.rb +1 -1
  53. data/match/lib/match/nuke.rb +21 -16
  54. data/match/lib/match/storage/git_storage.rb +4 -0
  55. data/match/lib/match/storage/google_cloud_storage.rb +4 -0
  56. data/match/lib/match/storage/interface.rb +4 -0
  57. data/match/lib/match/storage/s3_storage.rb +4 -0
  58. data/produce/lib/produce/itunes_connect.rb +32 -21
  59. data/produce/lib/produce/options.rb +3 -3
  60. data/scan/lib/scan/options.rb +1 -1
  61. data/scan/lib/scan/test_result_parser.rb +9 -2
  62. data/sigh/lib/assets/resign.sh +7 -7
  63. data/snapshot/lib/assets/SnapshotHelper.swift +5 -5
  64. data/snapshot/lib/assets/SnapshotHelperXcode8.swift +3 -3
  65. data/snapshot/lib/snapshot/options.rb +11 -1
  66. data/snapshot/lib/snapshot/reports_generator.rb +8 -1
  67. data/snapshot/lib/snapshot/test_command_generator.rb +8 -3
  68. data/spaceship/lib/spaceship/.DS_Store +0 -0
  69. data/spaceship/lib/spaceship/client.rb +13 -4
  70. data/spaceship/lib/spaceship/connect_api.rb +25 -2
  71. data/spaceship/lib/spaceship/connect_api/client.rb +97 -31
  72. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +66 -0
  73. data/spaceship/lib/spaceship/connect_api/model.rb +1 -1
  74. data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +113 -0
  75. data/spaceship/lib/spaceship/connect_api/models/app.rb +115 -3
  76. data/spaceship/lib/spaceship/connect_api/models/app_category.rb +94 -0
  77. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +66 -0
  78. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +38 -0
  79. data/spaceship/lib/spaceship/connect_api/models/app_preview.rb +77 -0
  80. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +71 -0
  81. data/spaceship/lib/spaceship/connect_api/models/app_price.rb +22 -0
  82. data/spaceship/lib/spaceship/connect_api/models/app_price_tier.rb +12 -0
  83. data/spaceship/lib/spaceship/connect_api/models/app_review_attachment.rb +81 -0
  84. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +97 -0
  85. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +101 -0
  86. data/spaceship/lib/spaceship/connect_api/models/app_store_review_detail.rb +51 -0
  87. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +182 -0
  88. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +86 -0
  89. data/spaceship/lib/spaceship/connect_api/models/app_store_version_phased_release.rb +36 -0
  90. data/spaceship/lib/spaceship/connect_api/models/app_store_version_submission.rb +26 -0
  91. data/spaceship/lib/spaceship/connect_api/models/build.rb +4 -0
  92. data/spaceship/lib/spaceship/connect_api/models/idfa_declaration.rb +40 -0
  93. data/spaceship/lib/spaceship/connect_api/models/reset_ratings_request.rb +26 -0
  94. data/spaceship/lib/spaceship/connect_api/models/territory.rb +27 -0
  95. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +10 -3
  96. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +33 -0
  97. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +831 -0
  98. data/spaceship/lib/spaceship/errors.rb +3 -0
  99. data/spaceship/lib/spaceship/spaceauth_runner.rb +2 -2
  100. data/supply/lib/supply/client.rb +19 -0
  101. data/supply/lib/supply/reader.rb +16 -0
  102. metadata +51 -42
  103. data/deliver/lib/deliver/upload_assets.rb +0 -27
@@ -0,0 +1,27 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class Territory
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :currency
8
+
9
+ attr_mapping({
10
+ "currency" => "currency"
11
+ })
12
+
13
+ def self.type
14
+ return "territories"
15
+ end
16
+
17
+ #
18
+ # API
19
+ #
20
+
21
+ def self.all(filter: {}, includes: nil, limit: 180, sort: nil)
22
+ resps = Spaceship::ConnectAPI.get_territories(filter: {}, includes: nil, limit: nil, sort: nil).all_pages
23
+ return resps.flat_map(&:to_models)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -285,9 +285,16 @@ module Spaceship
285
285
  Client.instance.get("builds", params)
286
286
  end
287
287
 
288
- def get_build(build_id: nil, includes: nil)
289
- params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
290
- Client.instance.get("builds/#{build_id}", params)
288
+ def get_build(build_id: nil, app_store_version_id: nil, includes: nil)
289
+ if build_id
290
+ params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
291
+ return Client.instance.get("builds/#{build_id}", params)
292
+ elsif app_store_version_id
293
+ params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
294
+ return Client.instance.get("appStoreVersions/#{app_store_version_id}/build", params)
295
+ else
296
+ return nil
297
+ end
291
298
  end
292
299
 
293
300
  def patch_builds(build_id: nil, attributes: {})
@@ -0,0 +1,33 @@
1
+ require_relative '../client'
2
+ require_relative '../../tunes/tunes_client'
3
+
4
+ module Spaceship
5
+ class ConnectAPI
6
+ module Tunes
7
+ class Client < Spaceship::ConnectAPI::Client
8
+ def self.instance
9
+ # Verify there is a token or a client that can be used
10
+ if Spaceship::ConnectAPI.token
11
+ if @client.nil? || @client.token != Spaceship::ConnectAPI.token
12
+ @client = Client.new(token: Spaceship::ConnectAPI.token)
13
+ end
14
+ elsif Spaceship::Tunes.client
15
+ # Initialize new client if new or if team changed
16
+ if @client.nil? || @client.team_id != Spaceship::Tunes.client.team_id
17
+ @client = Client.client_with_authorization_from(Spaceship::Tunes.client)
18
+ end
19
+ end
20
+
21
+ # Need to handle not having a client but this shouldn't ever happen
22
+ raise "Please login using `Spaceship::Tunes.login('user', 'password')`" unless @client
23
+
24
+ @client
25
+ end
26
+
27
+ def self.hostname
28
+ 'https://appstoreconnect.apple.com/iris/v1/'
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,831 @@
1
+ require 'spaceship/connect_api/tunes/client'
2
+
3
+ module Spaceship
4
+ class ConnectAPI
5
+ module Tunes
6
+ #
7
+ # ageRatingDeclarations
8
+ #
9
+
10
+ def get_age_rating_declaration(app_store_version_id: nil)
11
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
12
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/ageRatingDeclaration", params)
13
+ end
14
+
15
+ def patch_age_rating_declaration(age_rating_declaration_id: nil, attributes: nil)
16
+ body = {
17
+ data: {
18
+ type: "ageRatingDeclarations",
19
+ id: age_rating_declaration_id,
20
+ attributes: attributes
21
+ }
22
+ }
23
+
24
+ Client.instance.patch("ageRatingDeclarations/#{age_rating_declaration_id}", body)
25
+ end
26
+
27
+ #
28
+ # app
29
+ #
30
+
31
+ def post_app(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil)
32
+ included = []
33
+ included << {
34
+ type: "appInfos",
35
+ id: "${new-appInfo-id}",
36
+ relationships: {
37
+ appInfoLocalizations: {
38
+ data: [
39
+ {
40
+ type: "appInfoLocalizations",
41
+ id: "${new-appInfoLocalization-id}"
42
+ }
43
+ ]
44
+ }
45
+ }
46
+ }
47
+ included << {
48
+ type: "appInfoLocalizations",
49
+ id: "${new-appInfoLocalization-id}",
50
+ attributes: {
51
+ locale: primary_locale,
52
+ name: name
53
+ }
54
+ }
55
+
56
+ platforms.each do |platform|
57
+ included << {
58
+ type: "appStoreVersions",
59
+ id: "${store-version-#{platform}}",
60
+ attributes: {
61
+ platform: platform,
62
+ versionString: version_string
63
+ },
64
+ relationships: {
65
+ appStoreVersionLocalizations: {
66
+ data: [
67
+ {
68
+ type: "appStoreVersionLocalizations",
69
+ id: "${new-#{platform}VersionLocalization-id}"
70
+ }
71
+ ]
72
+ }
73
+ }
74
+ }
75
+
76
+ included << {
77
+ type: "appStoreVersionLocalizations",
78
+ id: "${new-#{platform}VersionLocalization-id}",
79
+ attributes: {
80
+ locale: primary_locale
81
+ }
82
+ }
83
+ end
84
+
85
+ app_store_verions_data = platforms.map do |platform|
86
+ {
87
+ type: "appStoreVersions",
88
+ id: "${store-version-#{platform}}"
89
+ }
90
+ end
91
+
92
+ relationships = {
93
+ appStoreVersions: {
94
+ data: app_store_verions_data
95
+ },
96
+ appInfos: {
97
+ data: [
98
+ {
99
+ type: "appInfos",
100
+ id: "${new-appInfo-id}"
101
+ }
102
+ ]
103
+ }
104
+ }
105
+
106
+ body = {
107
+ data: {
108
+ type: "apps",
109
+ attributes: {
110
+ sku: sku,
111
+ primaryLocale: primary_locale,
112
+ bundleId: bundle_id
113
+ },
114
+ relationships: relationships
115
+ },
116
+ included: included
117
+ }
118
+
119
+ Client.instance.post("apps", body)
120
+ end
121
+
122
+ def patch_app(app_id: nil, attributes: {}, app_price_tier_id: nil, territory_ids: nil)
123
+ relationships = {}
124
+ included = []
125
+
126
+ # Price tier
127
+ unless app_price_tier_id.nil?
128
+ relationships[:prices] = {
129
+ data: [
130
+ {
131
+ type: "appPrices",
132
+ id: "${price1}"
133
+ }
134
+ ]
135
+ }
136
+
137
+ included << {
138
+ type: "appPrices",
139
+ id: "${price1}",
140
+ attributes: {
141
+ startDate: nil
142
+ },
143
+ relationships: {
144
+ app: {
145
+ data: {
146
+ type: "apps",
147
+ id: app_id
148
+ }
149
+ },
150
+ priceTier: {
151
+ data: {
152
+ type: "appPriceTiers",
153
+ id: app_price_tier_id.to_s
154
+ }
155
+ }
156
+ }
157
+ }
158
+ end
159
+
160
+ # Territories
161
+ territories_data = (territory_ids || []).map do |id|
162
+ { type: "territories", id: id }
163
+ end
164
+ unless territories_data.empty?
165
+ relationships[:availableTerritories] = {
166
+ data: territories_data
167
+ }
168
+ end
169
+
170
+ # Data
171
+ data = {
172
+ type: "apps",
173
+ id: app_id
174
+ }
175
+ data[:attributes] = attributes unless attributes.empty?
176
+ data[:relationships] = relationships unless relationships.empty?
177
+
178
+ # Body
179
+ body = {
180
+ data: data
181
+ }
182
+ body[:included] = included unless included.empty?
183
+
184
+ Client.instance.patch("apps/#{app_id}", body)
185
+ end
186
+
187
+ #
188
+ # appPreview
189
+ #
190
+
191
+ def post_app_preview(app_preview_set_id: nil, attributes: {})
192
+ body = {
193
+ data: {
194
+ type: "appPreviews",
195
+ attributes: attributes,
196
+ relationships: {
197
+ appPreviewSet: {
198
+ data: {
199
+ type: "appPreviewSets",
200
+ id: app_preview_set_id
201
+ }
202
+ }
203
+ }
204
+ }
205
+ }
206
+
207
+ Client.instance.post("appPreviews", body)
208
+ end
209
+
210
+ def patch_app_preview(app_preview_id: nil, attributes: {})
211
+ body = {
212
+ data: {
213
+ type: "appPreviews",
214
+ id: app_preview_id,
215
+ attributes: attributes
216
+ }
217
+ }
218
+
219
+ Client.instance.patch("appPreviews/#{app_preview_id}", body)
220
+ end
221
+
222
+ def delete_app_preview(app_preview_id: nil)
223
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
224
+ Client.instance.delete("appPreviews/#{app_preview_id}", params)
225
+ end
226
+
227
+ #
228
+ # appPreviewSets
229
+ #
230
+
231
+ def get_app_preview_sets(filter: {}, includes: nil, limit: nil, sort: nil)
232
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
233
+ Client.instance.get("appPreviewSets", params)
234
+ end
235
+
236
+ def post_app_preview_set(app_store_version_localization_id: nil, attributes: {})
237
+ body = {
238
+ data: {
239
+ type: "appPreviewSets",
240
+ attributes: attributes,
241
+ relationships: {
242
+ appStoreVersionLocalization: {
243
+ data: {
244
+ type: "appStoreVersionLocalizations",
245
+ id: app_store_version_localization_id
246
+ }
247
+ }
248
+ }
249
+ }
250
+ }
251
+
252
+ Client.instance.post("appPreviewSets", body)
253
+ end
254
+
255
+ #
256
+ # appPrices
257
+ #
258
+
259
+ def get_app_prices(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
260
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
261
+ Client.instance.get("appPrices", params)
262
+ end
263
+
264
+ #
265
+ # appReviewAttachments
266
+ #
267
+
268
+ def get_app_review_attachments(app_store_review_detail_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
269
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
270
+ Client.instance.get("appStoreReviewDetails/#{app_store_review_detail_id}/appReviewAttachments", params)
271
+ end
272
+
273
+ def post_app_review_attachment(app_store_review_detail_id: nil, attributes: {})
274
+ body = {
275
+ data: {
276
+ type: "appReviewAttachments",
277
+ attributes: attributes,
278
+ relationships: {
279
+ appStoreReviewDetail: {
280
+ data: {
281
+ type: "appStoreReviewDetails",
282
+ id: app_store_review_detail_id
283
+ }
284
+ }
285
+ }
286
+ }
287
+ }
288
+
289
+ Client.instance.post("appReviewAttachments", body)
290
+ end
291
+
292
+ def patch_app_review_attachment(app_review_attachment_id: nil, attributes: {})
293
+ body = {
294
+ data: {
295
+ type: "appReviewAttachments",
296
+ id: app_review_attachment_id,
297
+ attributes: attributes
298
+ }
299
+ }
300
+
301
+ Client.instance.patch("appReviewAttachments/#{app_review_attachment_id}", body)
302
+ end
303
+
304
+ def delete_app_review_attachment(app_review_attachment_id: nil)
305
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
306
+ Client.instance.delete("appReviewAttachments/#{app_review_attachment_id}", params)
307
+ end
308
+
309
+ #
310
+ # appScreenshotSets
311
+ #
312
+
313
+ def get_app_screenshot_sets(filter: {}, includes: nil, limit: nil, sort: nil)
314
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
315
+ Client.instance.get("appScreenshotSets", params)
316
+ end
317
+
318
+ def post_app_screenshot_set(app_store_version_localization_id: nil, attributes: {})
319
+ body = {
320
+ data: {
321
+ type: "appScreenshotSets",
322
+ attributes: attributes,
323
+ relationships: {
324
+ appStoreVersionLocalization: {
325
+ data: {
326
+ type: "appStoreVersionLocalizations",
327
+ id: app_store_version_localization_id
328
+ }
329
+ }
330
+ }
331
+ }
332
+ }
333
+
334
+ Client.instance.post("appScreenshotSets", body)
335
+ end
336
+
337
+ #
338
+ # appScreenshots
339
+ #
340
+
341
+ def post_app_screenshot(app_screenshot_set_id: nil, attributes: {})
342
+ body = {
343
+ data: {
344
+ type: "appScreenshots",
345
+ attributes: attributes,
346
+ relationships: {
347
+ appScreenshotSet: {
348
+ data: {
349
+ type: "appScreenshotSets",
350
+ id: app_screenshot_set_id
351
+ }
352
+ }
353
+ }
354
+ }
355
+ }
356
+
357
+ Client.instance.post("appScreenshots", body)
358
+ end
359
+
360
+ def patch_app_screenshot(app_screenshot_id: nil, attributes: {})
361
+ body = {
362
+ data: {
363
+ type: "appScreenshots",
364
+ id: app_screenshot_id,
365
+ attributes: attributes
366
+ }
367
+ }
368
+
369
+ Client.instance.patch("appScreenshots/#{app_screenshot_id}", body)
370
+ end
371
+
372
+ def delete_app_screenshot(app_screenshot_id: nil)
373
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
374
+ Client.instance.delete("appScreenshots/#{app_screenshot_id}", params)
375
+ end
376
+
377
+ #
378
+ # appInfos
379
+ #
380
+
381
+ def get_app_infos(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
382
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
383
+ Client.instance.get("apps/#{app_id}/appInfos", params)
384
+ end
385
+
386
+ def patch_app_info(app_info_id: nil, attributes: {})
387
+ attributes ||= {}
388
+
389
+ data = {
390
+ type: "appInfos",
391
+ id: app_info_id
392
+ }
393
+ data[:attributes] = attributes unless attributes.empty?
394
+
395
+ body = {
396
+ data: data
397
+ }
398
+
399
+ Client.instance.patch("appInfos/#{app_info_id}", body)
400
+ end
401
+
402
+ #
403
+ # Adding the key will create/update (if value) or delete if nil
404
+ # Not including a key will leave as is
405
+ # category_id_map: {
406
+ # primary_category_id: "GAMES",
407
+ # primary_subcategory_one_id: "PUZZLE",
408
+ # primary_subcategory_two_id: "STRATEGY",
409
+ # secondary_category_id: nil,
410
+ # secondary_subcategory_one_id: nil,
411
+ # secondary_subcategory_two_id: nil
412
+ # }
413
+ #
414
+ def patch_app_info_categories(app_info_id: nil, category_id_map: nil)
415
+ category_id_map ||= {}
416
+ primary_category_id = category_id_map[:primary_category_id]
417
+ primary_subcategory_one_id = category_id_map[:primary_subcategory_one_id]
418
+ primary_subcategory_two_id = category_id_map[:primary_subcategory_two_id]
419
+ secondary_category_id = category_id_map[:secondary_category_id]
420
+ secondary_subcategory_one_id = category_id_map[:secondary_subcategory_one_id]
421
+ secondary_subcategory_two_id = category_id_map[:secondary_subcategory_two_id]
422
+
423
+ relationships = {}
424
+
425
+ # Only update if key is included (otherwise category will be removed)
426
+ if category_id_map.include?(:primary_category_id)
427
+ relationships[:primaryCategory] = {
428
+ data: primary_category_id ? { type: "appCategories", id: primary_category_id } : nil
429
+ }
430
+ end
431
+
432
+ # Only update if key is included (otherwise category will be removed)
433
+ if category_id_map.include?(:primary_subcategory_one_id)
434
+ relationships[:primarySubcategoryOne] = {
435
+ data: primary_subcategory_one_id ? { type: "appCategories", id: primary_subcategory_one_id } : nil
436
+ }
437
+ end
438
+
439
+ # Only update if key is included (otherwise category will be removed)
440
+ if category_id_map.include?(:primary_subcategory_two_id)
441
+ relationships[:primarySubcategoryTwo] = {
442
+ data: primary_subcategory_two_id ? { type: "appCategories", id: primary_subcategory_two_id } : nil
443
+ }
444
+ end
445
+
446
+ # Only update if key is included (otherwise category will be removed)
447
+ if category_id_map.include?(:secondary_category_id)
448
+ relationships[:secondaryCategory] = {
449
+ data: secondary_category_id ? { type: "appCategories", id: secondary_category_id } : nil
450
+ }
451
+ end
452
+
453
+ # Only update if key is included (otherwise category will be removed)
454
+ if category_id_map.include?(:secondary_subcategory_one_id)
455
+ relationships[:secondarySubcategoryOne] = {
456
+ data: secondary_subcategory_one_id ? { type: "appCategories", id: secondary_subcategory_one_id } : nil
457
+ }
458
+ end
459
+
460
+ # Only update if key is included (otherwise category will be removed)
461
+ if category_id_map.include?(:secondary_subcategory_two_id)
462
+ relationships[:secondarySubcategoryTwo] = {
463
+ data: secondary_subcategory_two_id ? { type: "appCategories", id: secondary_subcategory_two_id } : nil
464
+ }
465
+ end
466
+
467
+ data = {
468
+ type: "appInfos",
469
+ id: app_info_id
470
+ }
471
+ data[:relationships] = relationships unless relationships.empty?
472
+
473
+ body = {
474
+ data: data
475
+ }
476
+
477
+ Client.instance.patch("appInfos/#{app_info_id}", body)
478
+ end
479
+
480
+ def delete_app_info(app_info_id: nil)
481
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
482
+ Client.instance.delete("appInfos/#{app_info_id}", params)
483
+ end
484
+
485
+ #
486
+ # appInfoLocalizations
487
+ #
488
+
489
+ def get_app_info_localizations(app_info_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
490
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
491
+ Client.instance.get("appInfos/#{app_info_id}/appInfoLocalizations", params)
492
+ end
493
+
494
+ def post_app_info_localization(app_info_id: nil, attributes: {})
495
+ body = {
496
+ data: {
497
+ type: "appInfoLocalizations",
498
+ attributes: attributes,
499
+ relationships: {
500
+ appStoreVersion: {
501
+ data: {
502
+ type: "appStoreVersions",
503
+ id: app_info_id
504
+ }
505
+ }
506
+ }
507
+ }
508
+ }
509
+
510
+ Client.instance.post("appInfoLocalizations", body)
511
+ end
512
+
513
+ def patch_app_info_localization(app_info_localization_id: nil, attributes: {})
514
+ body = {
515
+ data: {
516
+ type: "appInfoLocalizations",
517
+ id: app_info_localization_id,
518
+ attributes: attributes
519
+ }
520
+ }
521
+
522
+ Client.instance.patch("appInfoLocalizations/#{app_info_localization_id}", body)
523
+ end
524
+
525
+ #
526
+ # appStoreReviewDetails
527
+ #
528
+
529
+ def get_app_store_review_detail(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
530
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
531
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreReviewDetail", params)
532
+ end
533
+
534
+ def post_app_store_review_detail(app_store_version_id: nil, attributes: {})
535
+ body = {
536
+ data: {
537
+ type: "appStoreReviewDetails",
538
+ attributes: attributes,
539
+ relationships: {
540
+ appStoreVersion: {
541
+ data: {
542
+ type: "appStoreVersions",
543
+ id: app_store_version_id
544
+ }
545
+ }
546
+ }
547
+ }
548
+ }
549
+
550
+ Client.instance.post("appStoreReviewDetails", body)
551
+ end
552
+
553
+ def patch_app_store_review_detail(app_store_review_detail_id: nil, attributes: {})
554
+ body = {
555
+ data: {
556
+ type: "appStoreReviewDetails",
557
+ id: app_store_review_detail_id,
558
+ attributes: attributes
559
+ }
560
+ }
561
+
562
+ Client.instance.patch("appStoreReviewDetails/#{app_store_review_detail_id}", body)
563
+ end
564
+
565
+ #
566
+ # appStoreVersionLocalizations
567
+ #
568
+
569
+ def get_app_store_version_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
570
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
571
+ Client.instance.get("appStoreVersionLocalizations", params)
572
+ end
573
+
574
+ def post_app_store_version_localization(app_store_version_id: nil, attributes: {})
575
+ body = {
576
+ data: {
577
+ type: "appStoreVersionLocalizations",
578
+ attributes: attributes,
579
+ relationships: {
580
+ appStoreVersion: {
581
+ data: {
582
+ type: "appStoreVersions",
583
+ id: app_store_version_id
584
+ }
585
+ }
586
+ }
587
+ }
588
+ }
589
+
590
+ Client.instance.post("appStoreVersionLocalizations", body)
591
+ end
592
+
593
+ def patch_app_store_version_localization(app_store_version_localization_id: nil, attributes: {})
594
+ body = {
595
+ data: {
596
+ type: "appStoreVersionLocalizations",
597
+ id: app_store_version_localization_id,
598
+ attributes: attributes
599
+ }
600
+ }
601
+
602
+ Client.instance.patch("appStoreVersionLocalizations/#{app_store_version_localization_id}", body)
603
+ end
604
+
605
+ def delete_app_store_version_localization(app_store_version_localization_id: nil)
606
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
607
+ Client.instance.delete("appStoreVersionLocalizations/#{app_store_version_localization_id}", params)
608
+ end
609
+
610
+ #
611
+ # appStoreVersionPhasedReleases
612
+ #
613
+
614
+ def get_app_store_version_phased_release(app_store_version_id: nil)
615
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
616
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreVersionPhasedRelease", params)
617
+ end
618
+
619
+ def post_app_store_version_phased_release(app_store_version_id: nil, attributes: {})
620
+ body = {
621
+ data: {
622
+ type: "appStoreVersionPhasedReleases",
623
+ attributes: attributes,
624
+ relationships: {
625
+ appStoreVersion: {
626
+ data: {
627
+ type: "appStoreVersions",
628
+ id: app_store_version_id
629
+ }
630
+ }
631
+ }
632
+ }
633
+ }
634
+
635
+ Client.instance.post("appStoreVersionPhasedReleases", body)
636
+ end
637
+
638
+ def delete_app_store_version_phased_release(app_store_version_phased_release_id: nil)
639
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
640
+ Client.instance.delete("appStoreVersionPhasedReleases/#{app_store_version_phased_release_id}", params)
641
+ end
642
+
643
+ #
644
+ # appStoreVersions
645
+ #
646
+
647
+ def get_app_store_versions(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
648
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
649
+ Client.instance.get("apps/#{app_id}/appStoreVersions", params)
650
+ end
651
+
652
+ def get_app_store_version(app_store_version_id: nil, includes: nil)
653
+ params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
654
+ Client.instance.get("appStoreVersions/#{app_store_version_id}", params)
655
+ end
656
+
657
+ def post_app_store_version(app_id: nil, attributes: {})
658
+ body = {
659
+ data: {
660
+ type: "appStoreVersions",
661
+ attributes: attributes,
662
+ relationships: {
663
+ app: {
664
+ data: {
665
+ type: "apps",
666
+ id: app_id
667
+ }
668
+ }
669
+ }
670
+ }
671
+ }
672
+
673
+ Client.instance.post("appStoreVersions", body)
674
+ end
675
+
676
+ def patch_app_store_version(app_store_version_id: nil, attributes: {})
677
+ body = {
678
+ data: {
679
+ type: "appStoreVersions",
680
+ id: app_store_version_id,
681
+ attributes: attributes
682
+ }
683
+ }
684
+
685
+ Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
686
+ end
687
+
688
+ def patch_app_store_version_with_build(app_store_version_id: nil, build_id: nil)
689
+ data = nil
690
+ if build_id
691
+ data = {
692
+ type: "builds",
693
+ id: build_id
694
+ }
695
+ end
696
+
697
+ body = {
698
+ data: {
699
+ type: "appStoreVersions",
700
+ id: app_store_version_id,
701
+ relationships: {
702
+ build: {
703
+ data: data
704
+ }
705
+ }
706
+ }
707
+ }
708
+
709
+ Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
710
+ end
711
+
712
+ #
713
+ # appStoreVersionPhasedReleases
714
+ #
715
+
716
+ def get_reset_ratings_request(app_store_version_id: nil)
717
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
718
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/resetRatingsRequest", params)
719
+ end
720
+
721
+ def post_reset_ratings_request(app_store_version_id: nil)
722
+ body = {
723
+ data: {
724
+ type: "resetRatingsRequests",
725
+ relationships: {
726
+ appStoreVersion: {
727
+ data: {
728
+ type: "appStoreVersions",
729
+ id: app_store_version_id
730
+ }
731
+ }
732
+ }
733
+ }
734
+ }
735
+
736
+ Client.instance.post("resetRatingsRequests", body)
737
+ end
738
+
739
+ def delete_reset_ratings_request(reset_ratings_request_id: nil)
740
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
741
+ Client.instance.delete("resetRatingsRequests/#{reset_ratings_request_id}", params)
742
+ end
743
+
744
+ #
745
+ # appStoreVersionSubmissions
746
+ #
747
+
748
+ def get_app_store_version_submission(app_store_version_id: nil)
749
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
750
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreVersionSubmission", params)
751
+ end
752
+
753
+ def post_app_store_version_submission(app_store_version_id: nil)
754
+ body = {
755
+ data: {
756
+ type: "appStoreVersionSubmissions",
757
+ relationships: {
758
+ appStoreVersion: {
759
+ data: {
760
+ type: "appStoreVersions",
761
+ id: app_store_version_id
762
+ }
763
+ }
764
+ }
765
+ }
766
+ }
767
+
768
+ Client.instance.post("appStoreVersionSubmissions", body)
769
+ end
770
+
771
+ def delete_app_store_version_submission(app_store_version_submission_id: nil)
772
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
773
+ Client.instance.delete("appStoreVersionSubmissions/#{app_store_version_submission_id}", params)
774
+ end
775
+
776
+ #
777
+ # idfaDeclarations
778
+ #
779
+
780
+ def get_idfa_declaration(app_store_version_id: nil)
781
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
782
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/idfaDeclaration", params)
783
+ end
784
+
785
+ def post_idfa_declaration(app_store_version_id: nil, attributes: nil)
786
+ body = {
787
+ data: {
788
+ type: "idfaDeclarations",
789
+ attributes: attributes,
790
+ relationships: {
791
+ appStoreVersion: {
792
+ data: {
793
+ type: "appStoreVersions",
794
+ id: app_store_version_id
795
+ }
796
+ }
797
+ }
798
+ }
799
+ }
800
+
801
+ Client.instance.post("idfaDeclarations", body)
802
+ end
803
+
804
+ def patch_idfa_declaration(idfa_declaration_id: nil, attributes: nil)
805
+ body = {
806
+ data: {
807
+ type: "idfaDeclarations",
808
+ id: idfa_declaration_id,
809
+ attributes: attributes
810
+ }
811
+ }
812
+
813
+ Client.instance.patch("idfaDeclarations/#{idfa_declaration_id}", body)
814
+ end
815
+
816
+ def delete_idfa_declaration(idfa_declaration_id: nil)
817
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
818
+ Client.instance.delete("idfaDeclarations/#{idfa_declaration_id}", params)
819
+ end
820
+
821
+ #
822
+ # territories
823
+ #
824
+
825
+ def get_territories(filter: {}, includes: nil, limit: nil, sort: nil)
826
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
827
+ Client.instance.get("territories", params)
828
+ end
829
+ end
830
+ end
831
+ end