| 1 | package Apple::AppStoreConnect; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Crypt::JWT qw(encode_jwt); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | Apple::AppStoreConnect - Apple App Store Connect API client | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | Version 0.13 | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | our $VERSION = '0.13'; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | use Apple::AppStoreConnect; | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | my $asc = Apple::AppStoreConnect->new( | ||||||||||||||||||||||||||||||||||||||||||
| 28 | issuer => $API_key_issuer, # API key issuer ID | ||||||||||||||||||||||||||||||||||||||||||
| 29 | key_id => $key_id, # App Store Connect API key ID | ||||||||||||||||||||||||||||||||||||||||||
| 30 | key => $private_key # Encrypted private key (PEM) | ||||||||||||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | # Custom API request | ||||||||||||||||||||||||||||||||||||||||||
| 34 | my $res = $asc->get(url => $url); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | # List apps / details convenience function | ||||||||||||||||||||||||||||||||||||||||||
| 37 | $res = $asc->get_apps(); # List of apps | ||||||||||||||||||||||||||||||||||||||||||
| 38 | $res = $asc->get_apps(id => $app_id); # App details | ||||||||||||||||||||||||||||||||||||||||||
| 39 | $res = $asc->get_apps(id => $app_id, path => 'customerReviews'); # App reviews | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | # List App Store versions, optionally with localizations | ||||||||||||||||||||||||||||||||||||||||||
| 42 | $res = $asc->get_app_store_versions(id => $app_id, platform => 'IOS'); | ||||||||||||||||||||||||||||||||||||||||||
| 43 | $res = $asc->get_app_store_versions(id => $app_id, localizations => 1); | ||||||||||||||||||||||||||||||||||||||||||
| 44 | $res = $asc->get_app_store_versions(id => $app_id, localizations => 'en-US'); | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | # Latest beta feedback for alerting | ||||||||||||||||||||||||||||||||||||||||||
| 47 | $res = $asc->get_beta_feedback_screenshot_submissions(id => $app_id, platform => 'IOS'); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | $res = $asc->get_beta_feedback_crash_submissions(id => $app_id, crash_log => 1); | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | Apple::AppStoreConnect provides basic access to the Apple App Store Connect API. | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | Please see the L<official API documentation|https://developer.apple.com/documentation/appstoreconnectapi> | ||||||||||||||||||||||||||||||||||||||||||
| 56 | for usage and all possible requests. | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | You can also use it with the L<Apple Store Server API>. | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | =head2 C<new> | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | my $asc = Apple::AppStoreConnect->new( | ||||||||||||||||||||||||||||||||||||||||||
| 65 | key_id => $key_id, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | key => $private_key?, | ||||||||||||||||||||||||||||||||||||||||||
| 67 | key_file => $private_key_pem?, | ||||||||||||||||||||||||||||||||||||||||||
| 68 | issuer => "57246542-96fe-1a63-e053-0824d011072a", | ||||||||||||||||||||||||||||||||||||||||||
| 69 | scope => \@scope?, | ||||||||||||||||||||||||||||||||||||||||||
| 70 | timeout => $timeout_sec?, | ||||||||||||||||||||||||||||||||||||||||||
| 71 | expiration => $expire_secs?, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | ua => $lwp_ua?, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | curl => $use_curl?, | ||||||||||||||||||||||||||||||||||||||||||
| 74 | jwt_payload => {%extra_payload} | ||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | Required parameters: | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | =item * C<key_file> : The encrypted App Store Connect API private key file that you | ||||||||||||||||||||||||||||||||||||||||||
| 82 | create under B<Users and Access> -> B<Keys> on the App Store Connect portal. On the portal | ||||||||||||||||||||||||||||||||||||||||||
| 83 | you download a PKCS8 format file (.p8), which you first need to convert to the PEM format. | ||||||||||||||||||||||||||||||||||||||||||
| 84 | On a Mac you can convert it simply: | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | openssl pkcs8 -nocrypt -in AuthKey_<key_id>.p8 -out AuthKey_<key_id>.pem | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | =item * C<key> : Instead of the C<.pem> file, you can pass its contents directly | ||||||||||||||||||||||||||||||||||||||||||
| 89 | as a string. | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =item * C<key_id> : The ID of the App Store Connect API key created on the App Store | ||||||||||||||||||||||||||||||||||||||||||
| 92 | Connect portal (B<Users and Access> section). | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | =item * C<issuer> : Your API Key B<issuer ID>. Can be found at the top of the API keys | ||||||||||||||||||||||||||||||||||||||||||
| 95 | on the App Store Connect Portal (B<Users and Access> section). | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | Optional parameters: | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | =item * C<scope> : An arrayref that defines the token scope. Example entry: | ||||||||||||||||||||||||||||||||||||||||||
| 104 | C<["GET /v1/apps?filter[platform]=IOS"]>. | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | =item * C<timeout> : Timeout for requests in secs. Default: C<30>. | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | =item * C<ua> : Pass your own L<LWP::UserAgent> to customise the agent string etc. | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | =item * C<curl> : If true, fall back to using the C<curl> command line program. | ||||||||||||||||||||||||||||||||||||||||||
| 111 | This is useful if you have issues adding https support to L<LWP::UserAgent>, which | ||||||||||||||||||||||||||||||||||||||||||
| 112 | is the default method for the API requests. | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | =item * C<expiration> : Token expiration time in seconds. Tokens are cached until | ||||||||||||||||||||||||||||||||||||||||||
| 115 | there are less than 10 minutes left to expiration. Default: C<900> - the API will | ||||||||||||||||||||||||||||||||||||||||||
| 116 | not accept more than 20 minutes expiration time for most requests. | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | =item * C<jwt_payload> : Extra items to append to the JWT payload. Allows extending | ||||||||||||||||||||||||||||||||||||||||||
| 119 | the module to support more/newer versions of Apple APIs. For example, for the Apple | ||||||||||||||||||||||||||||||||||||||||||
| 120 | Store Server API you'd need to add: | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | jwt_payload => {bid => $bundle_id} | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | =head2 C<get> | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | my $res = $asc->get( | ||||||||||||||||||||||||||||||||||||||||||
| 131 | url => $url, | ||||||||||||||||||||||||||||||||||||||||||
| 132 | raw => $raw?, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | params => \%query_params? | ||||||||||||||||||||||||||||||||||||||||||
| 134 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | Fetches the requested API url, by default, it will use L<JSON> to decode it | ||||||||||||||||||||||||||||||||||||||||||
| 137 | directly to a Perl hash, unless you request C<raw> result as a string. | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | Requires L<LWP::UserAgent>, unless the C<curl> option was set. | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | If the request is not successful, it will C<die> throwing the C<< HTTP::Response->status_line >>. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | =item * C<url> : A URL to an API endpoint. Can pass the full URL, e.g. C<url =E<gt> 'https://api.appstoreconnect.apple.com/v1/apps'>, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | or you can omit the part up to I<v1/> (i.e. C<url =E<gt> 'apps'>). | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | =item * C<params> : Any other query params that you need to pass | ||||||||||||||||||||||||||||||||||||||||||
| 149 | (see L<API documentation|https://developer.apple.com/documentation/appstoreconnectapi>). | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | =head2 C<get_response> | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | my $res = $asc->get_response( | ||||||||||||||||||||||||||||||||||||||||||
| 156 | url => $url, | ||||||||||||||||||||||||||||||||||||||||||
| 157 | raw => $raw?, | ||||||||||||||||||||||||||||||||||||||||||
| 158 | params => \%query_params? | ||||||||||||||||||||||||||||||||||||||||||
| 159 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | Same as C<get> except it returns the full L<HTTP::Response> from the API (so you | ||||||||||||||||||||||||||||||||||||||||||
| 162 | can handle bad requests yourself). | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | =head1 CONVENIENCE METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | =head2 C<jwt> | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | my $jwt = $asc->jwt( | ||||||||||||||||||||||||||||||||||||||||||
| 169 | iat => $iat?, | ||||||||||||||||||||||||||||||||||||||||||
| 170 | exp => $exp? | ||||||||||||||||||||||||||||||||||||||||||
| 171 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | Returns the JSON Web Token string in case you need it. Will return a cached one | ||||||||||||||||||||||||||||||||||||||||||
| 174 | if it has more than 5 minutes until expiration and you don't explicitly pass an | ||||||||||||||||||||||||||||||||||||||||||
| 175 | C<exp> argument. | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | =item * C<iat> : Specify the token creation timestamp. Default is C<time()>. | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | =item * C<exp> : Specify the token expiration timestamp. Passing this parameter | ||||||||||||||||||||||||||||||||||||||||||
| 182 | will force the creation of a new token. Default is C<time()+900> (or what you | ||||||||||||||||||||||||||||||||||||||||||
| 183 | specified in the constructor). | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | =head2 C<get_apps> | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | my $res = $asc->get_apps( | ||||||||||||||||||||||||||||||||||||||||||
| 190 | id => $app_id?, | ||||||||||||||||||||||||||||||||||||||||||
| 191 | path => $path?, | ||||||||||||||||||||||||||||||||||||||||||
| 192 | platform => $platform?, | ||||||||||||||||||||||||||||||||||||||||||
| 193 | params => \%query_params? | ||||||||||||||||||||||||||||||||||||||||||
| 194 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | Without arguments it is similar to C<get(url=E<gt>"apps">, fetching the list of apps, | ||||||||||||||||||||||||||||||||||||||||||
| 197 | but does some extra processing to return a Perl hash with app IDs as keys and the | ||||||||||||||||||||||||||||||||||||||||||
| 198 | app attributes as values. | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | There are optional arguments to get details of a specific app or app resource: | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | =item * C<id> : The app ID. Specifying just the id will return the details for a | ||||||||||||||||||||||||||||||||||||||||||
| 205 | single app. | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | =item * C<path> : Requires C<id> and is similar to C<get(url=E<gt>"apps/$app_id/$path")>, | ||||||||||||||||||||||||||||||||||||||||||
| 208 | returning a specific resource type for an app, except it does the convenience processing | ||||||||||||||||||||||||||||||||||||||||||
| 209 | where a hash with the ids of this resource as keys are returned and the attributes | ||||||||||||||||||||||||||||||||||||||||||
| 210 | as values (unless the specific resource does not follow that pattern). | ||||||||||||||||||||||||||||||||||||||||||
| 211 | See API documentation for C<path> support (e.g. C<builds>, C<appAvailability>, | ||||||||||||||||||||||||||||||||||||||||||
| 212 | C<appPriceSchedule>, C<customerReviews> etc.). | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | =item * C<platform> : Optional shortcut for C<filter[platform]>, for example | ||||||||||||||||||||||||||||||||||||||||||
| 215 | C<IOS>, C<MAC_OS>, C<TV_OS>, or C<VISION_OS>. | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | =item * C<params> : Any other query params that you need to pass | ||||||||||||||||||||||||||||||||||||||||||
| 218 | (see L<API documentation|https://developer.apple.com/documentation/appstoreconnectapi>). | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | =head2 C<get_app_store_versions> | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | my $res = $asc->get_app_store_versions( | ||||||||||||||||||||||||||||||||||||||||||
| 225 | id => $app_id, | ||||||||||||||||||||||||||||||||||||||||||
| 226 | platform => $platform?, | ||||||||||||||||||||||||||||||||||||||||||
| 227 | localizations => $localizations?, | ||||||||||||||||||||||||||||||||||||||||||
| 228 | localization_fields => $localization_fields?, | ||||||||||||||||||||||||||||||||||||||||||
| 229 | params => \%query_params? | ||||||||||||||||||||||||||||||||||||||||||
| 230 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | my $versions = $asc->get_app_store_versions( | ||||||||||||||||||||||||||||||||||||||||||
| 233 | id => $app_id, | ||||||||||||||||||||||||||||||||||||||||||
| 234 | platform => 'IOS', | ||||||||||||||||||||||||||||||||||||||||||
| 235 | localization_fields => 'locale,whatsNew', | ||||||||||||||||||||||||||||||||||||||||||
| 236 | params => { | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 'fields[appStoreVersions]' => 'platform,versionString,appVersionState' | ||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | Returns an arrayref of App Store versions for the app, automatically fetching | ||||||||||||||||||||||||||||||||||||||||||
| 242 | all pages. Each entry is a hash of the resource attributes, with C<id> and | ||||||||||||||||||||||||||||||||||||||||||
| 243 | C<type> added. | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | When C<localizations> is requested, one additional API call is made per | ||||||||||||||||||||||||||||||||||||||||||
| 246 | version to fetch its localizations. | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | =item * C<id> : The app ID. | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | =item * C<platform> : Optional shortcut for C<filter[platform]>, for example | ||||||||||||||||||||||||||||||||||||||||||
| 253 | C<IOS>, C<MAC_OS>, C<TV_OS>, or C<VISION_OS>. | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | =item * C<localizations> : If true, each version entry will include a | ||||||||||||||||||||||||||||||||||||||||||
| 256 | C<localizations> arrayref. Passing C<1> fetches all localizations. Passing a | ||||||||||||||||||||||||||||||||||||||||||
| 257 | locale string, for example C<en-US>, fetches only that locale. | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | =item * C<localization_fields> : Optional fields to return for each | ||||||||||||||||||||||||||||||||||||||||||
| 260 | C<appStoreVersionLocalizations> resource, for example C<locale,whatsNew>. If | ||||||||||||||||||||||||||||||||||||||||||
| 261 | specified, C<localizations> defaults to C<1>. | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | =item * C<params> : Any other query params to pass to the | ||||||||||||||||||||||||||||||||||||||||||
| 264 | C<apps/$app_id/appStoreVersions> request. | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | =head2 C<get_beta_feedback_screenshot_submissions> | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | my $res = $asc->get_beta_feedback_screenshot_submissions( | ||||||||||||||||||||||||||||||||||||||||||
| 271 | id => $app_id, | ||||||||||||||||||||||||||||||||||||||||||
| 272 | platform => $platform?, | ||||||||||||||||||||||||||||||||||||||||||
| 273 | limit => $limit?, | ||||||||||||||||||||||||||||||||||||||||||
| 274 | sort => $sort?, | ||||||||||||||||||||||||||||||||||||||||||
| 275 | params => \%query_params? | ||||||||||||||||||||||||||||||||||||||||||
| 276 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | Returns an arrayref of beta feedback screenshot submissions for the app. By | ||||||||||||||||||||||||||||||||||||||||||
| 279 | default, results are sorted newest first using C<-createdDate>, with C<limit> | ||||||||||||||||||||||||||||||||||||||||||
| 280 | set to C<50>. Only up to C<limit> results are returned; pagination is not | ||||||||||||||||||||||||||||||||||||||||||
| 281 | performed. | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | =item * C<id> : The app ID. | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | =item * C<platform> : Optional shortcut for C<filter[appPlatform]>, for example | ||||||||||||||||||||||||||||||||||||||||||
| 288 | C<IOS>, C<MAC_OS>, C<TV_OS>, or C<VISION_OS>. | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | =item * C<limit> : Optional maximum number of results to return. Default C<50>. | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | =item * C<sort> : Optional sort order. Default C<-createdDate>. | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | =item * C<params> : Any other query params to pass to the | ||||||||||||||||||||||||||||||||||||||||||
| 295 | C<apps/$app_id/betaFeedbackScreenshotSubmissions> request, for example | ||||||||||||||||||||||||||||||||||||||||||
| 296 | C<fields[betaFeedbackScreenshotSubmissions]> or C<include>. | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | =head2 C<get_beta_feedback_crash_submissions> | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | my $res = $asc->get_beta_feedback_crash_submissions( | ||||||||||||||||||||||||||||||||||||||||||
| 303 | id => $app_id, | ||||||||||||||||||||||||||||||||||||||||||
| 304 | platform => $platform?, | ||||||||||||||||||||||||||||||||||||||||||
| 305 | limit => $limit?, | ||||||||||||||||||||||||||||||||||||||||||
| 306 | sort => $sort?, | ||||||||||||||||||||||||||||||||||||||||||
| 307 | crash_log => $crash_log?, | ||||||||||||||||||||||||||||||||||||||||||
| 308 | crash_log_fields => $crash_log_fields?, | ||||||||||||||||||||||||||||||||||||||||||
| 309 | params => \%query_params? | ||||||||||||||||||||||||||||||||||||||||||
| 310 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | Returns an arrayref of beta feedback crash submissions for the app. By default, | ||||||||||||||||||||||||||||||||||||||||||
| 313 | results are sorted newest first using C<-createdDate>, with C<limit> set to | ||||||||||||||||||||||||||||||||||||||||||
| 314 | C<50>. Only up to C<limit> results are returned; pagination is not performed. | ||||||||||||||||||||||||||||||||||||||||||
| 315 | If C<crash_log> is true, each returned crash submission includes a C<crashLog> | ||||||||||||||||||||||||||||||||||||||||||
| 316 | hashref with the linked crash log; one additional API call is made per | ||||||||||||||||||||||||||||||||||||||||||
| 317 | submission to fetch it. | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | =item * C<id> : The app ID. | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | =item * C<platform> : Optional shortcut for C<filter[appPlatform]>, for example | ||||||||||||||||||||||||||||||||||||||||||
| 324 | C<IOS>, C<MAC_OS>, C<TV_OS>, or C<VISION_OS>. | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | =item * C<limit> : Optional maximum number of results to return. Default C<50>. | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | =item * C<sort> : Optional sort order. Default C<-createdDate>. | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | =item * C<crash_log> : If true, fetch C<betaFeedbackCrashSubmissions/$id/crashLog> | ||||||||||||||||||||||||||||||||||||||||||
| 331 | for each crash submission and attach it as C<crashLog>. | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | =item * C<crash_log_fields> : Optional fields to return for each C<betaCrashLogs> | ||||||||||||||||||||||||||||||||||||||||||
| 334 | resource, for example C<logText>. | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | =item * C<params> : Any other query params to pass to the | ||||||||||||||||||||||||||||||||||||||||||
| 337 | C<apps/$app_id/betaFeedbackCrashSubmissions> request, for example | ||||||||||||||||||||||||||||||||||||||||||
| 338 | C<fields[betaFeedbackCrashSubmissions]> or C<include>. Passing | ||||||||||||||||||||||||||||||||||||||||||
| 339 | C<fields[betaCrashLogs]> here is also supported; it is applied to the crash log | ||||||||||||||||||||||||||||||||||||||||||
| 340 | request. | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 14 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 14 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 14 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 14 | bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 14 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | ($self->{$_} = $args{$_} || croak("$_ (string) required.")) | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 14 | ▶ | foreach qw/issuer key_id/; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{$_} || croak("$_ (string) required.")
MC/DC100%1/1
$args{$_} || croak("$_ (string) required.")
$args{$_}
Truth table100%2/2
A
A= $args{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 12 | ▶ | unless ($args{key}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 3 | ▶ | croak("key or key_file required.") unless $args{key_file}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 2 | ▶ | open my $fh, '<', $args{key_file} or die "Can't open file $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 1 | $args{key} = do { local $/; <$fh> }; | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 10 | $self->{key} = \$args{key}; | |||||||||||||||||||||||||||||||||||||||||
| 363 | 10 | ▶ | $self->{timeout} = $args{timeout} || 30; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'timeout'} || 30
MC/DC100%1/1
$args{'timeout'} || 30
$args{'timeout'}
Truth table100%2/2
A
A= $args{'timeout'}
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 10 | ▶ | $self->{expiration} = $args{expiration} || 900; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'expiration'} || 900
MC/DC100%1/1
$args{'expiration'} || 900
$args{'expiration'}
Truth table100%2/2
A
A= $args{'expiration'}
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 10 | $self->{$_} = $args{$_} for qw/ua curl scope jwt_payload/; | |||||||||||||||||||||||||||||||||||||||||
| 366 | 10 | $self->{base_url} = "https://api.appstoreconnect.apple.com/v1/"; | |||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 24 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 373 | 24 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 24 | my $resp = $self->get_response(%args); | |||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | 23 | ▶ | unless ($self->{curl}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | 22 | ▶ | die $resp->status_line unless $resp->is_success; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 21 | $resp = $resp->decoded_content; | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | 22 | ▶ | return $args{raw} ? $resp : JSON::decode_json($resp); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 24 | ▶ | sub get_response { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_response: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 387 | 24 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 24 | ▶ | croak("url required") unless $args{url}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 23 | ▶ | $args{url} = $self->{base_url}.$args{url} unless $args{url} =~ /^http/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 23 | my $jwt = $self->jwt; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 23 | my $url = _build_url(%args); | |||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 23 | ▶ | unless ($self->{curl} || $self->{ua}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"curl"} or $self->{"ua"}
MC/DC100%2/2
$self->{"curl"} or $self->{"ua"}
$self->{"curl"}
$self->{"ua"}
Truth table100%3/3
A or B
A= $self->{"curl"}B= $self->{"ua"}
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 2 | require LWP::UserAgent; | |||||||||||||||||||||||||||||||||||||||||
| 397 | $self->{ua} = LWP::UserAgent->new( | ||||||||||||||||||||||||||||||||||||||||||
| 398 | agent => "libwww-perl Apple::AppStoreConnect/$VERSION", | ||||||||||||||||||||||||||||||||||||||||||
| 399 | timeout => $self->{timeout} | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 23 | return _fetch($self->{ua}, $url, $jwt); | |||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | 7 | ▶ | sub get_apps { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_apps: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 407 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 408 | 7 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | my %params = $args{params} ? %{$args{params}} : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 7 | ▶ | $params{'filter[platform]'} = $args{platform} if $args{platform}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 7 | ▶ | $args{params} = \%params if %params; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 7 | $args{url} = $self->{base_url} . 'apps'; | |||||||||||||||||||||||||||||||||||||||||
| 414 | 7 | ▶ | $args{url} .= "/$args{id}" if $args{id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 7 | ▶ | $args{url} .= "/$args{path}" if $args{path}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 7 | my $res = $self->get(%args); | |||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 7 | return _process_data($res); | |||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | 4 | ▶ | sub get_app_store_versions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_app_store_versions: called CC=11 SCAR=24.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 423 | 4 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 4 | ▶ | croak("id required") unless $args{id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | my %params = $args{params} ? %{$args{params}} : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | 3 | ▶ | $params{'filter[platform]'} = $args{platform} if $args{platform}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | 3 | ▶ | $params{limit} ||= 200; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$params{"limit"} ||= 200
MC/DC0%0/1
$params{"limit"} ||= 200
$params{"limit"}
Truth table50%1/2
A
A= $params{"limit"}
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | 3 | my $localizations = $args{localizations}; | |||||||||||||||||||||||||||||||||||||||||
| 431 | 3 | ▶ | $localizations ||= 1 if $args{localization_fields}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$localizations ||= 1
MC/DC0%0/1
$localizations ||= 1
$localizations
Truth table50%1/2
A
A= $localizations
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | 3 | my $versions = _flatten_resources($self->_get_all_pages( | |||||||||||||||||||||||||||||||||||||||||
| 434 | url => "apps/$args{id}/appStoreVersions", | ||||||||||||||||||||||||||||||||||||||||||
| 435 | params => \%params, | ||||||||||||||||||||||||||||||||||||||||||
| 436 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 3 | ▶ | if ($localizations) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 3 | foreach my $version (@$versions) { | |||||||||||||||||||||||||||||||||||||||||
| 440 | 4 | my %localization_params = (limit => 200); | |||||||||||||||||||||||||||||||||||||||||
| 441 | 4 | ▶ | $localization_params{'filter[locale]'} = $localizations | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | unless $localizations eq '1'; | ||||||||||||||||||||||||||||||||||||||||||
| 443 | $localization_params{'fields[appStoreVersionLocalizations]'} = $args{localization_fields} | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 4 | ▶ | if $args{localization_fields}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 4 | $version->{localizations} = _flatten_resources($self->_get_all_pages( | |||||||||||||||||||||||||||||||||||||||||
| 447 | url => "appStoreVersions/$version->{id}/appStoreVersionLocalizations", | ||||||||||||||||||||||||||||||||||||||||||
| 448 | params => \%localization_params, | ||||||||||||||||||||||||||||||||||||||||||
| 449 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 3 | return $versions; | |||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | 2 | ▶ | sub get_beta_feedback_screenshot_submissions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_beta_feedback_screenshot_submissions: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 457 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 458 | 2 | return $self->_get_beta_feedback_submissions( | |||||||||||||||||||||||||||||||||||||||||
| 459 | resource => 'betaFeedbackScreenshotSubmissions', | ||||||||||||||||||||||||||||||||||||||||||
| 460 | @_, | ||||||||||||||||||||||||||||||||||||||||||
| 461 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 2 | ▶ | sub get_beta_feedback_crash_submissions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_beta_feedback_crash_submissions: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 466 | 2 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 2 | ▶ | my %params = $args{params} ? %{$args{params}} : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 2 | my $crash_log_fields = $args{crash_log_fields}; | |||||||||||||||||||||||||||||||||||||||||
| 470 | 2 | ▶ | $crash_log_fields ||= delete $params{'fields[betaCrashLogs]'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$crash_log_fields ||= delete $params{"fields[betaCrashLogs]"}
MC/DC50%1/2
$crash_log_fields ||= delete $params{"fields[betaCrashLogs]"}
$crash_log_fields
delete $params{"fields[betaCrashLogs]"}
Truth table66%2/3
A ||= B
A= $crash_log_fieldsB= delete $params{"fields[betaCrashLogs]"}
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | 2 | $args{params} = \%params; | |||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | 2 | my $crashes = $self->_get_beta_feedback_submissions( | |||||||||||||||||||||||||||||||||||||||||
| 474 | resource => 'betaFeedbackCrashSubmissions', | ||||||||||||||||||||||||||||||||||||||||||
| 475 | %args, | ||||||||||||||||||||||||||||||||||||||||||
| 476 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | 1 | ▶ | if ($args{crash_log}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | 1 | foreach my $crash (@$crashes) { | |||||||||||||||||||||||||||||||||||||||||
| 480 | 1 | my %params; | |||||||||||||||||||||||||||||||||||||||||
| 481 | 1 | ▶ | $params{'fields[betaCrashLogs]'} = $crash_log_fields | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | if $crash_log_fields; | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 1 | my $res = $self->get( | |||||||||||||||||||||||||||||||||||||||||
| 485 | url => "betaFeedbackCrashSubmissions/$crash->{id}/crashLog", | ||||||||||||||||||||||||||||||||||||||||||
| 486 | params => \%params, | ||||||||||||||||||||||||||||||||||||||||||
| 487 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 488 | 1 | $crash->{crashLog} = _flatten_resource($res->{data}); | |||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 1 | return $crashes; | |||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | 26 | ▶ | sub jwt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
jwt: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 26 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 497 | 26 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | # Return cached one | ||||||||||||||||||||||||||||||||||||||||||
| 500 | return $self->{jwt} | ||||||||||||||||||||||||||||||||||||||||||
| 501 | 26 | ▶ | if !$args{exp} && $self->{jwt_exp} && $self->{jwt_exp} >= time() + 300; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not $args{"exp"} and $self->{"jwt_exp"} and $self->{"jwt_exp"} >= time + 300
not $args{"exp"} and $self->{"jwt_exp"}
MC/DC66%2/3
not $args{"exp"} and $self->{"jwt_exp"} and $self->{"jwt_exp"} >= time + 300
not $args{"exp"}
$self->{"jwt_exp"}
$self->{"jwt_exp"} >= time + 300
Truth table75%3/4
not(A) and B and C
A= not $args{"exp"}B= $self->{"jwt_exp"}C= $self->{"jwt_exp"} >= time + 300
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 10 | return $self->_new_jwt(%args); | |||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | 10 | ▶ | sub _new_jwt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new_jwt: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 507 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 508 | 10 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | 10 | ▶ | $args{iat} ||= time(); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"iat"} ||= time
MC/DC100%1/1
$args{"iat"} ||= time
$args{"iat"}
Truth table100%2/2
A
A= $args{"iat"}
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | 10 | ▶ | $self->{jwt_exp} = $args{exp} || (time() + $self->{expiration}); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$args{'exp'} || time + $self->{'expiration'}
MC/DC0%0/2
$args{'exp'} || time + $self->{'expiration'}
$args{'exp'}
time + $self->{'expiration'}
Truth table66%2/3
A || B
A= $args{'exp'}B= time + $self->{'expiration'}
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | my $data = { | ||||||||||||||||||||||||||||||||||||||||||
| 514 | iss => $self->{issuer}, | ||||||||||||||||||||||||||||||||||||||||||
| 515 | aud => "appstoreconnect-v1", | ||||||||||||||||||||||||||||||||||||||||||
| 516 | exp => $self->{jwt_exp}, | ||||||||||||||||||||||||||||||||||||||||||
| 517 | iat => $args{iat}, | ||||||||||||||||||||||||||||||||||||||||||
| 518 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | 10 | ▶ | $data->{scope} = $self->{scope} if $self->{scope}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | $data = { | ||||||||||||||||||||||||||||||||||||||||||
| 522 | %$data, | ||||||||||||||||||||||||||||||||||||||||||
| 523 | 1 | %{$self->{jwt_payload}} | |||||||||||||||||||||||||||||||||||||||||
| 524 | 10 | ▶ | } if $self->{jwt_payload}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | $self->{jwt} = encode_jwt( | ||||||||||||||||||||||||||||||||||||||||||
| 527 | payload => $data, | ||||||||||||||||||||||||||||||||||||||||||
| 528 | alg => 'ES256', | ||||||||||||||||||||||||||||||||||||||||||
| 529 | key => $self->{key}, | ||||||||||||||||||||||||||||||||||||||||||
| 530 | extra_headers => { | ||||||||||||||||||||||||||||||||||||||||||
| 531 | kid => $self->{key_id}, | ||||||||||||||||||||||||||||||||||||||||||
| 532 | 10 | typ => "JWT" | |||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||
| 534 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | 10 | return $self->{jwt}; | |||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | 23 | ▶ | sub _fetch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fetch: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | 23 | my ($ua, $url, $jwt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||
| 542 | 23 | ▶ | return _curl($url, $jwt) unless $ua; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | 22 | return $ua->get($url, Authorization => "Bearer $jwt"); | |||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | 1 | ▶ | sub _curl { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_curl: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | 1 | return `curl "$_[0]" -A "Curl Apple::AppStoreConnect/$VERSION" -s -H 'Authorization: Bearer $_[1]'`; | |||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | 26 | ▶ | sub _build_url { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_url: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 552 | 26 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 553 | 26 | my $url = $args{url}; | |||||||||||||||||||||||||||||||||||||||||
| 554 | 26 | ▶ | return $url unless ref($args{params}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | 14 | my $params = join("&", map {"$_=$args{params}->{$_}"} keys %{$args{params}}); | |||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 14 | ▶ | $url .= "?$params" if $params; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | 14 | return $url; | |||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | 4 | ▶ | sub _get_beta_feedback_submissions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_beta_feedback_submissions: called CC=9 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 565 | 4 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | 4 | ▶ | croak("id required") unless $args{id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 2 | ▶ | croak("resource required") unless $args{resource}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | 2 | ▶ | my %params = $args{params} ? %{$args{params}} : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | 2 | ▶ | $params{'filter[appPlatform]'} = $args{platform} if $args{platform}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | 2 | ▶ | $params{limit} ||= $args{limit} || 50; | ||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$params{"limit"} ||= $args{"limit"} || 50
$args{'limit'} || 50
MC/DC0%0/2
$params{"limit"} ||= $args{"limit"} || 50
$params{"limit"}
$args{'limit'}
Truth table33%1/3
A ||= B
A= $params{"limit"}B= $args{'limit'}
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | 2 | ▶ | $params{sort} ||= $args{sort} || '-createdDate'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$params{"sort"} ||= $args{"sort"} || "-createdDate"
$args{'sort'} || '-createdDate'
MC/DC0%0/2
$params{"sort"} ||= $args{"sort"} || "-createdDate"
$params{"sort"}
$args{'sort'}
Truth table0%0/3
A ||= B
A= $params{"sort"}B= $args{'sort'}
| |||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | 2 | my $res = $self->get( | |||||||||||||||||||||||||||||||||||||||||
| 576 | url => "apps/$args{id}/$args{resource}", | ||||||||||||||||||||||||||||||||||||||||||
| 577 | params => \%params, | ||||||||||||||||||||||||||||||||||||||||||
| 578 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | 2 | return _flatten_resources($res->{data}); | |||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | 7 | ▶ | sub _get_all_pages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_all_pages: called CC=8 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||
| 584 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 585 | 7 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | 7 | my @data; | |||||||||||||||||||||||||||||||||||||||||
| 588 | 7 | ▶ | while ($args{url}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | 8 | my $res = $self->get(%args); | |||||||||||||||||||||||||||||||||||||||||
| 590 | 8 | push @data, @{$res->{data}} | |||||||||||||||||||||||||||||||||||||||||
| 591 | 8 | ▶ | if ref($res) && ref($res->{data}) && ref($res->{data}) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $res and ref $res->{"data"} and ref $res->{"data"} eq "ARRAY"
ref $res and ref $res->{"data"}
MC/DC0%0/3
ref $res and ref $res->{"data"} and ref $res->{"data"} eq "ARRAY"
ref $res
ref $res->{"data"}
ref $res->{"data"} eq "ARRAY"
Truth table25%1/4
A and B and C
A= ref $resB= ref $res->{"data"}C= ref $res->{"data"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | my $next = ref($res) && ref($res->{links}) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||
| 594 | ? $res->{links}->{next} | ||||||||||||||||||||||||||||||||||||||||||
| 595 | 8 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $res and ref $res->{"links"} eq "HASH"
MC/DC50%1/2
ref $res and ref $res->{"links"} eq "HASH"
ref $res
ref $res->{"links"} eq "HASH"
Truth table66%2/3
A and B
A= ref $resB= ref $res->{"links"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 8 | ▶ | last unless $next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||
| 598 | 1 | %args = (url => $next); | |||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | 7 | return \@data; | |||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | 10 | ▶ | sub _flatten_resources { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten_resources: called CC=6 SCAR=19.4
| |||||||||||||||||||||||||||||||||||||||||||
| 605 | 10 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||
| 607 | 10 | ▶ | return $data unless ref($data) && ref($data) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $data and ref $data eq "ARRAY"
MC/DC0%0/2
ref $data and ref $data eq "ARRAY"
ref $data
ref $data eq "ARRAY"
Truth table33%1/3
A and B
A= ref $dataB= ref $data eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | return [ | ||||||||||||||||||||||||||||||||||||||||||
| 610 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 611 | 10 | my $item = $_; | |||||||||||||||||||||||||||||||||||||||||
| 612 | my $res = ref($item->{attributes}) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||
| 613 | 11 | ▶ | ? {%{$item->{attributes}}} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | : {}; | ||||||||||||||||||||||||||||||||||||||||||
| 615 | 11 | ▶ | $res->{id} = $item->{id} if $item->{id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | 11 | ▶ | $res->{type} = $item->{type} if $item->{type}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 617 | 11 | $res; | |||||||||||||||||||||||||||||||||||||||||
| 618 | } @$data | ||||||||||||||||||||||||||||||||||||||||||
| 619 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | 1 | ▶ | sub _flatten_resource { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten_resource: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | 1 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||
| 624 | 1 | my $res = _flatten_resources([$data]); | |||||||||||||||||||||||||||||||||||||||||
| 625 | 1 | return $res->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | 14 | ▶ | sub _process_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_data: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||
| 629 | 14 | my $hash = shift; | |||||||||||||||||||||||||||||||||||||||||
| 630 | 14 | ▶ | if (ref($hash) && ref($hash->{data}) && ref($hash->{data}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
ref $hash and ref $hash->{"data"} and ref $hash->{"data"} eq "ARRAY"
ref $hash and ref $hash->{"data"}
MC/DC66%2/3
ref $hash and ref $hash->{"data"} and ref $hash->{"data"} eq "ARRAY"
ref $hash
ref $hash->{"data"}
ref $hash->{"data"} eq "ARRAY"
Truth table75%3/4
A and B and C
A= ref $hashB= ref $hash->{"data"}C= ref $hash->{"data"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 631 | 9 | my $res; | |||||||||||||||||||||||||||||||||||||||||
| 632 | 9 | foreach my $item (@{$hash->{data}}) { | |||||||||||||||||||||||||||||||||||||||||
| 633 | 9 | ▶ | if ($item->{id} && $item->{attributes}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$item->{"id"} and $item->{"attributes"}
MC/DC100%2/2
$item->{"id"} and $item->{"attributes"}
$item->{"id"}
$item->{"attributes"}
Truth table100%3/3
A and B
A= $item->{"id"}B= $item->{"attributes"}
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | 7 | $res->{$item->{id}} = {%{$item->{attributes}}}; | |||||||||||||||||||||||||||||||||||||||||
| 635 | 7 | ▶ | $res->{$item->{id}}->{type} = $item->{type} if $item->{type}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||
| 638 | 9 | ▶ | return $res if $res; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||
| 640 | 7 | return $hash; | |||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||
| 643 | =head1 NOTES | ||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | =head2 Apple Store Server API | ||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||
| 647 | You can use this module with the L<Apple Store Server API|https://developer.apple.com/documentation/appstoreserverapi> | ||||||||||||||||||||||||||||||||||||||||||
| 648 | by passing your app's bundle ID to the JWT payload. So there is just one addition to the constructor call: | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | my $assa = Apple::AppStoreConnect->new( | ||||||||||||||||||||||||||||||||||||||||||
| 651 | issuer => $API_key_issuer, | ||||||||||||||||||||||||||||||||||||||||||
| 652 | key_id => $key_id, | ||||||||||||||||||||||||||||||||||||||||||
| 653 | key => $private_key, | ||||||||||||||||||||||||||||||||||||||||||
| 654 | jwt_payload => {bid => $bundle_id} | ||||||||||||||||||||||||||||||||||||||||||
| 655 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | You can then pass custon Store Server API requests: | ||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | my $res = $assa->get(url => "https://api.storekit.itunes.apple.com/inApps/v2/history/$transactionId"); | ||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||
| 661 | =head2 POST/PATCH/DELETE requests | ||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||
| 663 | Note that currently only GET requests are implemented, as that is what I needed. | ||||||||||||||||||||||||||||||||||||||||||
| 664 | However, POST/PATCH/DELETE can be added upon request. | ||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||
| 666 | =head2 403 Unauthorized etc errors | ||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||
| 668 | If you suddenly start getting unauthorized errors with a token that should be valid, | ||||||||||||||||||||||||||||||||||||||||||
| 669 | log onto App Store Connect and see if you have any documents pending approval (e.g | ||||||||||||||||||||||||||||||||||||||||||
| 670 | tax documents, new terms etc). | ||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | Dimitrios Kechagias, L<https://metacpan.org/author/DKECHAG> | ||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | Please report any bugs or feature requests either on L<GitHub|https://github.com/dkechag/Apple-AppStoreConnect> (preferred), or on RT (via the email | ||||||||||||||||||||||||||||||||||||||||||
| 679 | C<bug-Apple-AppStoreConnect at rt.cpan.org> or L<web interface|https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Apple-AppStoreConnect>). | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. | ||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | =head1 GIT | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | L<https://github.com/dkechag/Apple-AppStoreConnect> | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | This software is copyright (c) 2023 by Dimitrios Kechagias. | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 692 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||
| 694 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||
| 696 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||