Apple-AppStoreConnect

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

        id                  => $app_id,
        platform            => $platform?,
        localizations       => $localizations?,
        localization_fields => $localization_fields?,
        params              => \%query_params?
    );

    my $versions = $asc->get_app_store_versions(
        id                  => $app_id,
        platform            => 'IOS',
        localization_fields => 'locale,whatsNew',
        params              => {
            'fields[appStoreVersions]' => 'platform,versionString,appVersionState'
        }
    );

Returns an arrayref of App Store versions for the app, automatically fetching
all pages. Each entry is a hash of the resource attributes, with `id` and
`type` added.

When `localizations` is requested, one additional API call is made per
version to fetch its localizations.

- `id` : The app ID.
- `platform` : Optional shortcut for `filter[platform]`, for example
`IOS`, `MAC_OS`, `TV_OS`, or `VISION_OS`.
- `localizations` : If true, each version entry will include a
`localizations` arrayref. Passing `1` fetches all localizations. Passing a
locale string, for example `en-US`, fetches only that locale.
- `localization_fields` : Optional fields to return for each
`appStoreVersionLocalizations` resource, for example `locale,whatsNew`. If
specified, `localizations` defaults to `1`.
- `params` : Any other query params to pass to the
`apps/$app_id/appStoreVersions` request.

## `get_beta_feedback_screenshot_submissions`

    my $res = $asc->get_beta_feedback_screenshot_submissions(
        id       => $app_id,
        platform => $platform?,
        limit    => $limit?,

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

        id                  => $app_id,
        platform            => $platform?,
        localizations       => $localizations?,
        localization_fields => $localization_fields?,
        params              => \%query_params?
    );

    my $versions = $asc->get_app_store_versions(
        id                  => $app_id,
        platform            => 'IOS',
        localization_fields => 'locale,whatsNew',
        params              => {
            'fields[appStoreVersions]' => 'platform,versionString,appVersionState'
        }
    );

Returns an arrayref of App Store versions for the app, automatically fetching
all pages. Each entry is a hash of the resource attributes, with C<id> and
C<type> added.

When C<localizations> is requested, one additional API call is made per

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


=over 4

=item * C<id> : The app ID.

=item * C<platform> : Optional shortcut for C<filter[platform]>, for example
C<IOS>, C<MAC_OS>, C<TV_OS>, or C<VISION_OS>.

=item * C<localizations> : If true, each version entry will include a
C<localizations> arrayref. Passing C<1> fetches all localizations. Passing a
locale string, for example C<en-US>, fetches only that locale.

=item * C<localization_fields> : Optional fields to return for each
C<appStoreVersionLocalizations> resource, for example C<locale,whatsNew>. If
specified, C<localizations> defaults to C<1>.

=item * C<params> : Any other query params to pass to the
C<apps/$app_id/appStoreVersions> request.

=back

=head2 C<get_beta_feedback_screenshot_submissions>

    my $res = $asc->get_beta_feedback_screenshot_submissions(

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

    $localizations ||= 1 if $args{localization_fields};

    my $versions = _flatten_resources($self->_get_all_pages(
        url    => "apps/$args{id}/appStoreVersions",
        params => \%params,
    ));

    if ($localizations) {
        foreach my $version (@$versions) {
            my %localization_params = (limit => 200);
            $localization_params{'filter[locale]'} = $localizations
                unless $localizations eq '1';
            $localization_params{'fields[appStoreVersionLocalizations]'} = $args{localization_fields}
                if $args{localization_fields};

            $version->{localizations} = _flatten_resources($self->_get_all_pages(
                url    => "appStoreVersions/$version->{id}/appStoreVersionLocalizations",
                params => \%localization_params,
            ));
        }
    }

t/simple.t  view on Meta::CPAN

            end
        },
        'get call correct'
    );
};

subtest 'get_app_store_versions' => sub {
    my $ua = TestUA->new(
        '{"data":[{"type":"appStoreVersions","id":"v1","attributes":{"versionString":"1.0","platform":"IOS"}}],"links":{"next":"'.$base.'apps/1/appStoreVersions?cursor=abc"}}',
        '{"data":[{"type":"appStoreVersions","id":"v2","attributes":{"versionString":"1.1","platform":"IOS"}}]}',
        '{"data":[{"type":"appStoreVersionLocalizations","id":"l1","attributes":{"locale":"en-US","whatsNew":"One"}},{"type":"appStoreVersionLocalizations","id":"l2","attributes":{"locale":"fr-FR","whatsNew":"Un"}}]}',
        '{"data":[]}'
    );
    my $asc3 = Apple::AppStoreConnect->new(%params, key => $key, ua => $ua);

    my $out = $asc3->get_app_store_versions(
        id            => 1,
        platform      => 'IOS',
        localizations => 1,
    );

t/simple.t  view on Meta::CPAN

        [
            {
                id            => 'v1',
                type          => 'appStoreVersions',
                versionString => '1.0',
                platform      => 'IOS',
                localizations => [
                    {
                        id       => 'l1',
                        type     => 'appStoreVersionLocalizations',
                        locale   => 'en-US',
                        whatsNew => 'One',
                    },
                    {
                        id       => 'l2',
                        type     => 'appStoreVersionLocalizations',
                        locale   => 'fr-FR',
                        whatsNew => 'Un',
                    },
                ],
            },
            {
                id            => 'v2',
                type          => 'appStoreVersions',
                versionString => '1.1',
                platform      => 'IOS',
                localizations => [],

t/simple.t  view on Meta::CPAN

        'Version request uses platform filter and limit'
    );
    is(
        $ua->{calls}->[1]->[0],
        "${base}apps/1/appStoreVersions?cursor=abc",
        'Version request follows next link'
    );
    is(
        $ua->{calls}->[2]->[0],
        "${base}appStoreVersions/v1/appStoreVersionLocalizations?limit=200",
        'Localizations request fetches all locales'
    );
    is(
        $ua->{calls}->[3]->[0],
        "${base}appStoreVersions/v2/appStoreVersionLocalizations?limit=200",
        'Localizations request is made for each version'
    );
};

subtest 'get_app_store_versions with locale' => sub {
    my $ua = TestUA->new(
        '{"data":[{"type":"appStoreVersions","id":"v1","attributes":{"versionString":"1.0"}}]}',
        '{"data":[{"type":"appStoreVersionLocalizations","id":"l1","attributes":{"locale":"en-US","whatsNew":"One"}}]}'
    );
    my $asc3 = Apple::AppStoreConnect->new(%params, key => $key, ua => $ua);

    my $out = $asc3->get_app_store_versions(id => 1, localizations => 'en-US');

    is(
        $out->[0]->{localizations},
        [
            {
                id       => 'l1',
                type     => 'appStoreVersionLocalizations',
                locale   => 'en-US',
                whatsNew => 'One',
            },
        ],
        'Only requested locale returned'
    );
    like(
        $ua->{calls}->[1]->[0],
        qr#^\Q${base}appStoreVersions/v1/appStoreVersionLocalizations\E\?(limit=200&filter\[locale\]=en-US|filter\[locale\]=en-US&limit=200)$#,
        'Locale filter passed to localizations request'
    );
};

subtest 'get_app_store_versions localization fields' => sub {
    my $ua = TestUA->new(
        '{"data":[{"type":"appStoreVersions","id":"v1","attributes":{"versionString":"1.0"}}]}',
        '{"data":[{"type":"appStoreVersionLocalizations","id":"l1","attributes":{"locale":"en-US","whatsNew":"One"}}]}'
    );
    my $asc3 = Apple::AppStoreConnect->new(%params, key => $key, ua => $ua);

    my $out = $asc3->get_app_store_versions(
        id                  => 1,
        localization_fields => 'locale,whatsNew',
    );

    is(
        $out->[0]->{localizations},
        [
            {
                id       => 'l1',
                type     => 'appStoreVersionLocalizations',
                locale   => 'en-US',
                whatsNew => 'One',
            },
        ],
        'Localization fields imply localizations'
    );
    like(
        $ua->{calls}->[1]->[0],
        qr#^\Q${base}appStoreVersions/v1/appStoreVersionLocalizations\E\?(limit=200&fields\[appStoreVersionLocalizations\]=locale,whatsNew|fields\[appStoreVersionLocalizations\]=locale,whatsNew&limit=200)$#,
        'Localization fields passed to localizations request'
    );
};

subtest 'get_beta_feedback_screenshot_submissions' => sub {
    my $ua = TestUA->new(
        '{"data":[{"type":"betaFeedbackScreenshotSubmissions","id":"s1","attributes":{"createdDate":"2026-06-24T10:00:00Z","comment":"Looks wrong","appPlatform":"IOS","screenshots":[{"url":"https://example.com/shot.png","width":1170,"height":2532}]}}...
    );
    my $asc3 = Apple::AppStoreConnect->new(%params, key => $key, ua => $ua);



( run in 0.591 second using v1.01-cache-2.11-cpan-817d5f8af8b )