Apple-AppStoreConnect

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

        params => \%query_params?
    );

Fetches the requested API url, by default, it will use [JSON](https://metacpan.org/pod/JSON) to decode it
directly to a Perl hash, unless you request `raw` result as a string.

Requires [LWP::UserAgent](https://metacpan.org/pod/LWP%3A%3AUserAgent), unless the `curl` option was set.

If the request is not successful, it will `die` throwing the `HTTP::Response->status_line`.

- `url` : A URL to an API endpoint. Can pass the full URL, e.g. `url => 'https://api.appstoreconnect.apple.com/v1/apps'`,
or you can omit the part up to _v1/_ (i.e. `url => 'apps'`).
- `params` : Any other query params that you need to pass
(see [API documentation](https://developer.apple.com/documentation/appstoreconnectapi)).

## `get_response`

    my $res = $asc->get_response(
        url    => $url,
        raw    => $raw?,
        params => \%query_params?

lib/Apple/AppStoreConnect.pm  view on Meta::CPAN


Fetches the requested API url, by default, it will use L<JSON> to decode it
directly to a Perl hash, unless you request C<raw> result as a string.

Requires L<LWP::UserAgent>, unless the C<curl> option was set.

If the request is not successful, it will C<die> throwing the C<< HTTP::Response->status_line >>.

=over 4
 
=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'>,
or you can omit the part up to I<v1/> (i.e. C<url =E<gt> 'apps'>).

=item * C<params> : Any other query params that you need to pass
(see L<API documentation|https://developer.apple.com/documentation/appstoreconnectapi>).

=back

=head2 C<get_response>

    my $res = $asc->get_response(

t/simple.t  view on Meta::CPAN


    my $list_url = $ua->{calls}->[0]->[0];
    like($list_url, qr#^\Q${base}apps/1/betaFeedbackCrashSubmissions\E\?#, 'Crash request URL');
    like($list_url, qr/(?:^|[?&])limit=25(?:&|$)/, 'Crash request uses limit');
    like($list_url, qr/(?:^|[?&])sort=-createdDate(?:&|$)/, 'Crash request defaults newest first');
    like(
        $list_url,
        qr/(?:^|[?&])fields\[betaFeedbackCrashSubmissions\]=createdDate,comment,deviceModel(?:&|$)/,
        'Crash request passes fields'
    );
    unlike($list_url, qr/fields\[betaCrashLogs\]/, 'Crash log fields not passed to list endpoint');
    is(
        $ua->{calls}->[1]->[0],
        "${base}betaFeedbackCrashSubmissions/c1/crashLog?fields[betaCrashLogs]=logText",
        'Crash log request passes crash log fields'
    );
    is(
        \%request_params,
        {
            'fields[betaFeedbackCrashSubmissions]' => 'createdDate,comment,deviceModel',
            'fields[betaCrashLogs]'                => 'logText',



( run in 2.657 seconds using v1.01-cache-2.11-cpan-ecdf5575e8d )