Пример #1
0
    def get_from_build_number(self, bundle_id: str,
                              build_number: str) -> Optional[Build]:
        """Get a build from its build number.

        :param bundle_id: The bundle ID of the app
        :param build_number: The build number for the build to get

        :returns: The build if found, None otherwise
        """

        self.log.info(
            f"Getting build from build number {build_number} for bundle {bundle_id}"
        )

        for build in self.get_builds(build_number=build_number):
            self.log.debug(f"Checking build {build}")

            # TODO use app id directly for this
            assert build.relationships is not None
            related_link = build.relationships["app"].links.related
            assert related_link is not None
            app = next_or_none(
                self.http_client.get(url=related_link, data_type=App))

            if not app:
                break

            if app.bundle_id == bundle_id:
                return build

        return None
Пример #2
0
    def get_build_from_identifier(self, identifier: str) -> Optional[Build]:
        """Get a build from its identifier

        :param identifier: The unique identifier for the build (_not_ the build number)

        :returns: A build if found, None otherwise
        """
        url = self.http_client.generate_url(f"builds/{identifier}")

        return next_or_none(self.http_client.get(url=url, data_type=Build))
Пример #3
0
    def get_beta_detail(self, build: Build) -> Optional[BuildBetaDetail]:
        """Get the build beta details.

        :param build: The build to get the beta details for

        :returns: An iterator to the beta app localizations
        """
        assert build.relationships is not None
        url = build.relationships["buildBetaDetail"].links.related
        return next_or_none(self.http_client.get(url=url, data_type=BuildBetaDetail))
Пример #4
0
    def get_version(self, *, app_id: str,
                    version_string: str) -> Optional[AppStoreVersion]:
        """Get the versions for an app.

        :param app_id: The app ID to get the version for
        :param version_string: The version string to get the version for

        :returns: An AppStoreVersion
        """
        return next_or_none(
            self.get_all(app_id=app_id, version_string=version_string))
Пример #5
0
    def get_idfa(self, *, version_id: str) -> Optional[IdfaDeclaration]:
        """Get the advertising ID declaration.

        :param version_id: The version to get the declaration for

        :returns: The declaration if set, None otherwise
        """
        return next_or_none(
            self.http_client.get(
                endpoint=f"appStoreVersions/{version_id}/idfaDeclaration",
                data_type=IdfaDeclaration,
            ))
Пример #6
0
    def get_app_review_details(
            self, *, version_id: str) -> Optional[AppStoreReviewDetails]:
        """Get the app review details for the version.

        :param version_id: The version ID to get the app review details for

        :returns: The app review details if set, None otherwise
        """
        return next_or_none(
            self.http_client.get(
                endpoint=f"appStoreVersions/{version_id}/appStoreReviewDetail",
                data_type=AppStoreReviewDetails,
            ))
Пример #7
0
    def get(
        self,
        *,
        version_id: str,
    ) -> Optional[AppStoreVersion]:
        """Get the version with the given ID

        :param version_id: The version ID to get

        :returns: An AppStoreVersion if found, None otherwise
        """
        url = self.http_client.generate_url(f"appStoreVersions/{version_id}")

        return next_or_none(
            self.http_client.get(url=url, data_type=AppStoreVersion))
Пример #8
0
    def get_phased_release(
        self,
        *,
        version_id: str,
    ) -> Optional[AppStoreVersionPhasedRelease]:
        """Get the phased release of given app version

        :param version_id: The version ID to query for phased releases

        :returns: An AppStoreVersionPhasedRelease if found, None otherwise
        """
        self.log.debug(f"Getting phased release of {version_id}")
        url = self.http_client.generate_url(
            f"appStoreVersions/{version_id}/appStoreVersionPhasedRelease")

        return next_or_none(
            self.http_client.get(url=url,
                                 data_type=AppStoreVersionPhasedRelease))