fastlane 2.189.0 → 2.190.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +92 -92
  3. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +1 -1
  4. data/fastlane/lib/fastlane/actions/bundle_install.rb +13 -1
  5. data/fastlane/lib/fastlane/actions/clean_cocoapods_cache.rb +25 -1
  6. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +2 -2
  7. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +2 -2
  8. data/fastlane/lib/fastlane/actions/zip.rb +86 -22
  9. data/fastlane/lib/fastlane/version.rb +1 -1
  10. data/fastlane/swift/Deliverfile.swift +1 -1
  11. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  12. data/fastlane/swift/Fastlane.swift +44 -10
  13. data/fastlane/swift/Gymfile.swift +1 -1
  14. data/fastlane/swift/GymfileProtocol.swift +1 -1
  15. data/fastlane/swift/Matchfile.swift +1 -1
  16. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  17. data/fastlane/swift/Precheckfile.swift +1 -1
  18. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  19. data/fastlane/swift/Scanfile.swift +1 -1
  20. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  21. data/fastlane/swift/Screengrabfile.swift +1 -1
  22. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  23. data/fastlane/swift/Snapshotfile.swift +1 -1
  24. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  25. data/fastlane/swift/formatting/Brewfile.lock.json +3 -3
  26. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +11 -4
  27. data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +1 -0
  28. data/scan/lib/scan/xcpretty_reporter_options_generator.rb +1 -1
  29. data/sigh/lib/sigh/options.rb +2 -1
  30. data/spaceship/lib/spaceship/client.rb +6 -0
  31. data/spaceship/lib/spaceship/connect_api/models/user.rb +17 -3
  32. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +26 -5
  33. data/spaceship/lib/spaceship/connect_api/testflight/client.rb +3 -0
  34. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +39 -0
  35. data/spaceship/lib/spaceship/connect_api/token.rb +2 -1
  36. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +3 -0
  37. data/spaceship/lib/spaceship/connect_api/users/client.rb +3 -0
  38. data/spaceship/lib/spaceship/connect_api/users/users.rb +24 -2
  39. data/spaceship/lib/spaceship/tunes/tunes_client.rb +3 -0
  40. metadata +21 -21
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.189.0'.freeze
2
+ VERSION = '2.190.0'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  MINIMUM_XCODE_RELEASE = "7.0".freeze
5
5
  RUBOCOP_REQUIREMENT = '1.12.1'.freeze
@@ -17,4 +17,4 @@ public class Deliverfile: DeliverfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.189.0
20
+ // Generated with fastlane 2.190.0
@@ -256,4 +256,4 @@ public extension DeliverfileProtocol {
256
256
 
257
257
  // Please don't remove the lines below
258
258
  // They are used to detect outdated files
259
- // FastlaneRunnerAPIVersion [0.9.77]
259
+ // FastlaneRunnerAPIVersion [0.9.78]
@@ -204,7 +204,7 @@ public func appStoreConnectApiKey(keyId: String,
204
204
  keyFilepath: OptionalConfigValue<String?> = .fastlaneDefault(nil),
205
205
  keyContent: OptionalConfigValue<String?> = .fastlaneDefault(nil),
206
206
  isKeyContentBase64: OptionalConfigValue<Bool> = .fastlaneDefault(false),
207
- duration: Int = 1200,
207
+ duration: Int = 500,
208
208
  inHouse: OptionalConfigValue<Bool> = .fastlaneDefault(false),
209
209
  setSpaceshipToken: OptionalConfigValue<Bool> = .fastlaneDefault(true))
210
210
  {
@@ -1888,6 +1888,8 @@ public func buildAndroidApp(task: OptionalConfigValue<String?> = .fastlaneDefaul
1888
1888
  - trustPolicy: Sets level of security when dealing with signed gems. Accepts `LowSecurity`, `MediumSecurity` and `HighSecurity` as values
1889
1889
  - without: Exclude gems that are part of the specified named group
1890
1890
  - with: Include gems that are part of the specified named group
1891
+ - frozen: Don't allow the Gemfile.lock to be updated after install
1892
+ - redownload: Force download every gem, even if the required versions are already available locally
1891
1893
  */
1892
1894
  public func bundleInstall(binstubs: OptionalConfigValue<String?> = .fastlaneDefault(nil),
1893
1895
  clean: OptionalConfigValue<Bool> = .fastlaneDefault(false),
@@ -1906,7 +1908,9 @@ public func bundleInstall(binstubs: OptionalConfigValue<String?> = .fastlaneDefa
1906
1908
  standalone: OptionalConfigValue<String?> = .fastlaneDefault(nil),
1907
1909
  trustPolicy: OptionalConfigValue<String?> = .fastlaneDefault(nil),
1908
1910
  without: OptionalConfigValue<String?> = .fastlaneDefault(nil),
1909
- with: OptionalConfigValue<String?> = .fastlaneDefault(nil))
1911
+ with: OptionalConfigValue<String?> = .fastlaneDefault(nil),
1912
+ frozen: OptionalConfigValue<Bool> = .fastlaneDefault(false),
1913
+ redownload: OptionalConfigValue<Bool> = .fastlaneDefault(false))
1910
1914
  {
1911
1915
  let binstubsArg = binstubs.asRubyArgument(name: "binstubs", type: nil)
1912
1916
  let cleanArg = clean.asRubyArgument(name: "clean", type: nil)
@@ -1926,6 +1930,8 @@ public func bundleInstall(binstubs: OptionalConfigValue<String?> = .fastlaneDefa
1926
1930
  let trustPolicyArg = trustPolicy.asRubyArgument(name: "trust_policy", type: nil)
1927
1931
  let withoutArg = without.asRubyArgument(name: "without", type: nil)
1928
1932
  let withArg = with.asRubyArgument(name: "with", type: nil)
1933
+ let frozenArg = frozen.asRubyArgument(name: "frozen", type: nil)
1934
+ let redownloadArg = redownload.asRubyArgument(name: "redownload", type: nil)
1929
1935
  let array: [RubyCommand.Argument?] = [binstubsArg,
1930
1936
  cleanArg,
1931
1937
  fullIndexArg,
@@ -1943,7 +1949,9 @@ public func bundleInstall(binstubs: OptionalConfigValue<String?> = .fastlaneDefa
1943
1949
  standaloneArg,
1944
1950
  trustPolicyArg,
1945
1951
  withoutArg,
1946
- withArg]
1952
+ withArg,
1953
+ frozenArg,
1954
+ redownloadArg]
1947
1955
  let args: [RubyCommand.Argument] = array
1948
1956
  .filter { $0?.value != nil }
1949
1957
  .compactMap { $0 }
@@ -2854,11 +2862,29 @@ public func cleanBuildArtifacts(excludePattern: OptionalConfigValue<String?> = .
2854
2862
  /**
2855
2863
  Remove the cache for pods
2856
2864
 
2857
- - parameter name: Pod name to be removed from cache
2865
+ - parameters:
2866
+ - name: Pod name to be removed from cache
2867
+ - noAnsi: Show output without ANSI codes
2868
+ - verbose: Show more debugging information
2869
+ - silent: Show nothing
2870
+ - allowRoot: Allows CocoaPods to run as root
2858
2871
  */
2859
- public func cleanCocoapodsCache(name: OptionalConfigValue<String?> = .fastlaneDefault(nil)) {
2872
+ public func cleanCocoapodsCache(name: OptionalConfigValue<String?> = .fastlaneDefault(nil),
2873
+ noAnsi: OptionalConfigValue<Bool> = .fastlaneDefault(false),
2874
+ verbose: OptionalConfigValue<Bool> = .fastlaneDefault(false),
2875
+ silent: OptionalConfigValue<Bool> = .fastlaneDefault(false),
2876
+ allowRoot: OptionalConfigValue<Bool> = .fastlaneDefault(false))
2877
+ {
2860
2878
  let nameArg = name.asRubyArgument(name: "name", type: nil)
2861
- let array: [RubyCommand.Argument?] = [nameArg]
2879
+ let noAnsiArg = noAnsi.asRubyArgument(name: "no_ansi", type: nil)
2880
+ let verboseArg = verbose.asRubyArgument(name: "verbose", type: nil)
2881
+ let silentArg = silent.asRubyArgument(name: "silent", type: nil)
2882
+ let allowRootArg = allowRoot.asRubyArgument(name: "allow_root", type: nil)
2883
+ let array: [RubyCommand.Argument?] = [nameArg,
2884
+ noAnsiArg,
2885
+ verboseArg,
2886
+ silentArg,
2887
+ allowRootArg]
2862
2888
  let args: [RubyCommand.Argument] = array
2863
2889
  .filter { $0?.value != nil }
2864
2890
  .compactMap { $0 }
@@ -12973,7 +12999,7 @@ public func xcov(workspace: OptionalConfigValue<String?> = .fastlaneDefault(nil)
12973
12999
  coverallsServiceJobId: OptionalConfigValue<String?> = .fastlaneDefault(nil),
12974
13000
  coverallsRepoToken: OptionalConfigValue<String?> = .fastlaneDefault(nil),
12975
13001
  xcconfig: OptionalConfigValue<String?> = .fastlaneDefault(nil),
12976
- ideFoundationPath: String = "/Applications/Xcode-12.5.1.app/Contents/Developer/../Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation",
13002
+ ideFoundationPath: String = "/Applications/Xcode-13.beta.4.app/Contents/Developer/../Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation",
12977
13003
  legacySupport: OptionalConfigValue<Bool> = .fastlaneDefault(false))
12978
13004
  {
12979
13005
  let workspaceArg = workspace.asRubyArgument(name: "workspace", type: nil)
@@ -13087,6 +13113,8 @@ public func xcversion(version: String) {
13087
13113
  - verbose: Enable verbose output of zipped file
13088
13114
  - password: Encrypt the contents of the zip archive using a password
13089
13115
  - symlinks: Store symbolic links as such in the zip archive
13116
+ - include: Array of paths or patterns to include
13117
+ - exclude: Array of paths or patterns to exclude
13090
13118
 
13091
13119
  - returns: The path to the output zip file
13092
13120
  */
@@ -13094,18 +13122,24 @@ public func xcversion(version: String) {
13094
13122
  outputPath: OptionalConfigValue<String?> = .fastlaneDefault(nil),
13095
13123
  verbose: OptionalConfigValue<Bool> = .fastlaneDefault(true),
13096
13124
  password: OptionalConfigValue<String?> = .fastlaneDefault(nil),
13097
- symlinks: OptionalConfigValue<Bool> = .fastlaneDefault(false)) -> String
13125
+ symlinks: OptionalConfigValue<Bool> = .fastlaneDefault(false),
13126
+ include: [String] = [],
13127
+ exclude: [String] = []) -> String
13098
13128
  {
13099
13129
  let pathArg = RubyCommand.Argument(name: "path", value: path, type: nil)
13100
13130
  let outputPathArg = outputPath.asRubyArgument(name: "output_path", type: nil)
13101
13131
  let verboseArg = verbose.asRubyArgument(name: "verbose", type: nil)
13102
13132
  let passwordArg = password.asRubyArgument(name: "password", type: nil)
13103
13133
  let symlinksArg = symlinks.asRubyArgument(name: "symlinks", type: nil)
13134
+ let includeArg = RubyCommand.Argument(name: "include", value: include, type: nil)
13135
+ let excludeArg = RubyCommand.Argument(name: "exclude", value: exclude, type: nil)
13104
13136
  let array: [RubyCommand.Argument?] = [pathArg,
13105
13137
  outputPathArg,
13106
13138
  verboseArg,
13107
13139
  passwordArg,
13108
- symlinksArg]
13140
+ symlinksArg,
13141
+ includeArg,
13142
+ excludeArg]
13109
13143
  let args: [RubyCommand.Argument] = array
13110
13144
  .filter { $0?.value != nil }
13111
13145
  .compactMap { $0 }
@@ -13167,4 +13201,4 @@ public let snapshotfile = Snapshotfile()
13167
13201
 
13168
13202
  // Please don't remove the lines below
13169
13203
  // They are used to detect outdated files
13170
- // FastlaneRunnerAPIVersion [0.9.130]
13204
+ // FastlaneRunnerAPIVersion [0.9.131]
@@ -17,4 +17,4 @@ public class Gymfile: GymfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.189.0
20
+ // Generated with fastlane 2.190.0
@@ -196,4 +196,4 @@ public extension GymfileProtocol {
196
196
 
197
197
  // Please don't remove the lines below
198
198
  // They are used to detect outdated files
199
- // FastlaneRunnerAPIVersion [0.9.80]
199
+ // FastlaneRunnerAPIVersion [0.9.81]
@@ -17,4 +17,4 @@ public class Matchfile: MatchfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.189.0
20
+ // Generated with fastlane 2.190.0
@@ -184,4 +184,4 @@ public extension MatchfileProtocol {
184
184
 
185
185
  // Please don't remove the lines below
186
186
  // They are used to detect outdated files
187
- // FastlaneRunnerAPIVersion [0.9.74]
187
+ // FastlaneRunnerAPIVersion [0.9.75]
@@ -17,4 +17,4 @@ public class Precheckfile: PrecheckfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.189.0
20
+ // Generated with fastlane 2.190.0
@@ -52,4 +52,4 @@ public extension PrecheckfileProtocol {
52
52
 
53
53
  // Please don't remove the lines below
54
54
  // They are used to detect outdated files
55
- // FastlaneRunnerAPIVersion [0.9.73]
55
+ // FastlaneRunnerAPIVersion [0.9.74]
@@ -17,4 +17,4 @@ public class Scanfile: ScanfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.189.0
20
+ // Generated with fastlane 2.190.0
@@ -296,4 +296,4 @@ public extension ScanfileProtocol {
296
296
 
297
297
  // Please don't remove the lines below
298
298
  // They are used to detect outdated files
299
- // FastlaneRunnerAPIVersion [0.9.85]
299
+ // FastlaneRunnerAPIVersion [0.9.86]
@@ -17,4 +17,4 @@ public class Screengrabfile: ScreengrabfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.189.0
20
+ // Generated with fastlane 2.190.0
@@ -96,4 +96,4 @@ public extension ScreengrabfileProtocol {
96
96
 
97
97
  // Please don't remove the lines below
98
98
  // They are used to detect outdated files
99
- // FastlaneRunnerAPIVersion [0.9.75]
99
+ // FastlaneRunnerAPIVersion [0.9.76]
@@ -17,4 +17,4 @@ public class Snapshotfile: SnapshotfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.189.0
20
+ // Generated with fastlane 2.190.0
@@ -200,4 +200,4 @@ public extension SnapshotfileProtocol {
200
200
 
201
201
  // Please don't remove the lines below
202
202
  // They are used to detect outdated files
203
- // FastlaneRunnerAPIVersion [0.9.69]
203
+ // FastlaneRunnerAPIVersion [0.9.70]
@@ -51,11 +51,11 @@
51
51
  "macOS": "11.0"
52
52
  },
53
53
  "monterey": {
54
- "HOMEBREW_VERSION": "3.2.5-13-g89b8619",
54
+ "HOMEBREW_VERSION": "3.2.5-35-g4b6b3c2",
55
55
  "HOMEBREW_PREFIX": "/usr/local",
56
- "Homebrew/homebrew-core": "61ecc3e550752e9348480ec3c221e7f2c6abcac0",
56
+ "Homebrew/homebrew-core": "8482b78bceae40d19a8fc427b9935ce8f177b9b6",
57
57
  "CLT": "13.0.0.0.1.1626155413",
58
- "Xcode": "12.5.1",
58
+ "Xcode": "13.0",
59
59
  "macOS": "12.0"
60
60
  }
61
61
  }
@@ -7,14 +7,17 @@ module FastlaneCore
7
7
  def self.import_file(path, keychain_path, keychain_password: nil, certificate_password: "", skip_set_partition_list: false, output: FastlaneCore::Globals.verbose?)
8
8
  UI.user_error!("Could not find file '#{path}'") unless File.exist?(path)
9
9
 
10
+ password_part = " -P #{certificate_password.shellescape}"
11
+
10
12
  command = "security import #{path.shellescape} -k '#{keychain_path.shellescape}'"
11
- command << " -P #{certificate_password.shellescape}"
13
+ command << password_part
12
14
  command << " -T /usr/bin/codesign" # to not be asked for permission when running a tool like `gym` (before Sierra)
13
15
  command << " -T /usr/bin/security"
14
16
  command << " -T /usr/bin/productbuild" # to not be asked for permission when using an installer cert for macOS
15
17
  command << " 1> /dev/null" unless output
16
18
 
17
- UI.command(command) if output
19
+ sensitive_command = command.gsub(password_part, " -P ********")
20
+ UI.command(sensitive_command) if output
18
21
  Open3.popen3(command) do |stdin, stdout, stderr, thrd|
19
22
  UI.command_output(stdout.read.to_s) if output
20
23
 
@@ -38,17 +41,21 @@ module FastlaneCore
38
41
  # When security supports partition lists, also add the partition IDs
39
42
  # See https://openradar.appspot.com/28524119
40
43
  if Helper.backticks('security -h | grep set-key-partition-list', print: false).length > 0
44
+ password_part = " -k #{keychain_password.to_s.shellescape}"
45
+
41
46
  command = "security set-key-partition-list"
42
47
  command << " -S apple-tool:,apple:,codesign:"
43
48
  command << " -s" # This is a needed in Catalina to prevent "security: SecKeychainItemCopyAccess: A missing value was detected."
44
- command << " -k #{keychain_password.to_s.shellescape}"
49
+ command << password_part
45
50
  command << " #{keychain_path.shellescape}"
46
51
  command << " 1> /dev/null" # always disable stdout. This can be very verbose, and leak potentially sensitive info
47
52
 
48
53
  # Showing loading indicator as this can take some time if a lot of keys installed
49
54
  Helper.show_loading_indicator("Setting key partition list... (this can take a minute if there are a lot of keys installed)")
50
55
 
51
- UI.command(command) if output
56
+ # Strip keychain password from command output
57
+ sensitive_command = command.gsub(password_part, " -k ********")
58
+ UI.command(sensitive_command) if output
52
59
  Open3.popen3(command) do |stdin, stdout, stderr, thrd|
53
60
  unless thrd.value.success?
54
61
  err = stderr.read.to_s.strip
@@ -10,6 +10,7 @@ class String
10
10
  end
11
11
  end
12
12
  Colored::EXTRAS.keys.each do |extra|
13
+ next if extra == 'clear'
13
14
  define_method(extra) do
14
15
  self # do nothing with the string, but return it
15
16
  end
@@ -13,7 +13,7 @@ module Scan
13
13
  Scan.config[:xcpretty_args])
14
14
  end
15
15
 
16
- # Intialize with values from Scan.config matching these param names
16
+ # Initialize with values from Scan.config matching these param names
17
17
  def initialize(open_report, output_types, output_files, output_directory, use_clang_report_name, xcpretty_args)
18
18
  @open_report = open_report
19
19
  @output_types = output_types
@@ -149,7 +149,8 @@ module Sigh
149
149
  env_name: "SIGH_SKIP_CERTIFICATE_VERIFICATION",
150
150
  description: "Skips the verification of the certificates for every existing profiles. This will make sure the provisioning profile can be used on the local machine",
151
151
  is_string: false,
152
- default_value: false),
152
+ default_value: !FastlaneCore::Helper.mac?,
153
+ default_value_dynamic: true),
153
154
  FastlaneCore::ConfigItem.new(key: :platform,
154
155
  short_option: '-p',
155
156
  env_name: "SIGH_PLATFORM",
@@ -41,6 +41,7 @@ module Spaceship
41
41
  attr_accessor :logger
42
42
 
43
43
  attr_accessor :csrf_tokens
44
+ attr_accessor :additional_headers
44
45
 
45
46
  attr_accessor :provider
46
47
 
@@ -717,8 +718,13 @@ module Spaceship
717
718
  @csrf_tokens || {}
718
719
  end
719
720
 
721
+ def additional_headers
722
+ @additional_headers || {}
723
+ end
724
+
720
725
  def request(method, url_or_path = nil, params = nil, headers = {}, auto_paginate = false, &block)
721
726
  headers.merge!(csrf_tokens)
727
+ headers.merge!(additional_headers)
722
728
  headers['User-Agent'] = USER_AGENT
723
729
 
724
730
  # Before encoding the parameters, log them
@@ -16,6 +16,8 @@ module Spaceship
16
16
  attr_accessor :email_vetting_required
17
17
  attr_accessor :notifications
18
18
 
19
+ attr_accessor :visible_apps
20
+
19
21
  attr_mapping({
20
22
  "username" => "username",
21
23
  "firstName" => "first_name",
@@ -27,9 +29,15 @@ module Spaceship
27
29
  "allAppsVisible" => "all_apps_visible",
28
30
  "provisioningAllowed" => "provisioning_allowed",
29
31
  "emailVettingRequired" => "email_vetting_required",
30
- "notifications" => "notifications"
32
+ "notifications" => "notifications",
33
+
34
+ "visibleApps" => "visible_apps"
31
35
  })
32
36
 
37
+ ESSENTIAL_INCLUDES = [
38
+ "visibleApps"
39
+ ].join(",")
40
+
33
41
  def self.type
34
42
  return "users"
35
43
  end
@@ -38,16 +46,22 @@ module Spaceship
38
46
  # API
39
47
  #
40
48
 
41
- def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
49
+ def self.all(client: nil, filter: {}, includes: ESSENTIAL_INCLUDES, limit: nil, sort: nil)
42
50
  client ||= Spaceship::ConnectAPI
43
51
  resps = client.get_users(filter: filter, includes: includes).all_pages
44
52
  return resps.flat_map(&:to_models)
45
53
  end
46
54
 
47
- def self.find(client: nil, email: nil, includes: nil)
55
+ def self.find(client: nil, email: nil, includes: ESSENTIAL_INCLUDES)
48
56
  client ||= Spaceship::ConnectAPI
49
57
  return all(client: client, filter: { email: email }, includes: includes)
50
58
  end
59
+
60
+ def get_visible_apps(client: nil, limit: nil)
61
+ client ||= Spaceship::ConnectAPI
62
+ resp = client.get_user_visible_apps(user_id: id, limit: limit)
63
+ return resp.to_models
64
+ end
51
65
  end
52
66
  end
53
67
  end
@@ -11,15 +11,23 @@ module Spaceship
11
11
  attr_accessor :all_apps_visible
12
12
  attr_accessor :provisioning_allowed
13
13
 
14
+ attr_accessor :visible_apps
15
+
14
16
  attr_mapping({
15
17
  "firstName" => "first_name",
16
18
  "lastName" => "last_name",
17
19
  "email" => "email",
18
20
  "roles" => "roles",
19
21
  "allAppsVisible" => "all_apps_visible",
20
- "provisioningAllowed" => "provisioning_allowed"
22
+ "provisioningAllowed" => "provisioning_allowed",
23
+
24
+ "visibleApps" => "visible_apps"
21
25
  })
22
26
 
27
+ ESSENTIAL_INCLUDES = [
28
+ "visibleApps"
29
+ ].join(",")
30
+
23
31
  module UserRole
24
32
  ADMIN = "ADMIN"
25
33
  FINANCE = "FINANCE"
@@ -42,18 +50,23 @@ module Spaceship
42
50
  # Managing invitations
43
51
  #
44
52
 
45
- def self.all(client: nil, filter: {}, includes: nil, sort: nil)
53
+ def self.all(client: nil, filter: {}, includes: ESSENTIAL_INCLUDES, sort: nil)
46
54
  client ||= Spaceship::ConnectAPI
47
55
  resps = client.get_user_invitations(filter: filter, includes: includes, sort: sort).all_pages
48
56
  return resps.flat_map(&:to_models)
49
57
  end
50
58
 
51
- def self.find(client: nil, email: nil, includes: nil)
59
+ def self.find(client: nil, email: nil, includes: ESSENTIAL_INCLUDES)
52
60
  client ||= Spaceship::ConnectAPI
53
61
  return all(client: client, filter: { email: email }, includes: includes)
54
62
  end
55
63
 
56
- def self.create(client: nil, email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil)
64
+ # Create and post user invitation
65
+ # App Store Connect allows for the following combinations of `all_apps_visible` and `visible_app_ids`:
66
+ # - if `all_apps_visible` is `nil`, you don't have to provide values for `visible_app_ids`
67
+ # - if `all_apps_visible` is true, you must provide values for `visible_app_ids`.
68
+ # - if `all_apps_visible` is false, you must not provide values for `visible_app_ids`.
69
+ def self.create(client: nil, email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil, visible_app_ids: [])
57
70
  client ||= Spaceship::ConnectAPI
58
71
  resp = client.post_user_invitation(
59
72
  email: email,
@@ -61,7 +74,8 @@ module Spaceship
61
74
  last_name: last_name,
62
75
  roles: roles,
63
76
  provisioning_allowed: provisioning_allowed,
64
- all_apps_visible: all_apps_visible
77
+ all_apps_visible: all_apps_visible,
78
+ visible_app_ids: visible_app_ids
65
79
  )
66
80
  return resp.to_models.first
67
81
  end
@@ -70,6 +84,13 @@ module Spaceship
70
84
  client ||= Spaceship::ConnectAPI
71
85
  client.delete_user_invitation(user_invitation_id: id)
72
86
  end
87
+
88
+ # Get visible apps for invited user
89
+ def get_visible_apps(client: nil, limit: nil)
90
+ client ||= Spaceship::ConnectAPI
91
+ resp = client.get_user_invitation_visible_apps(user_invitation_id: id, limit: limit)
92
+ return resp.to_models
93
+ end
73
94
  end
74
95
  end
75
96
  end