pub struct Gpapi { /* private fields */ }
Implementations§
source§impl Gpapi
impl Gpapi
sourcepub fn set_locale<S: Into<String>>(&mut self, locale: S)
pub fn set_locale<S: Into<String>>(&mut self, locale: S)
Set the locale
sourcepub fn set_timezone<S: Into<String>>(&mut self, timezone: S)
pub fn set_timezone<S: Into<String>>(&mut self, timezone: S)
Set the time zone
sourcepub fn set_aas_token<S: Into<String>>(&mut self, aas_token: S)
pub fn set_aas_token<S: Into<String>>(&mut self, aas_token: S)
Set the aas token. This can be requested via request_aas_token
, and is required for most
other actions.
sourcepub async fn request_aas_token<S: Into<String>>(
&mut self,
oauth_token: S
) -> Result<(), GpapiError>
pub async fn request_aas_token<S: Into<String>>( &mut self, oauth_token: S ) -> Result<(), GpapiError>
Request and set the aas token given an oauth token and the associated email.
§Arguments
oauth_token
- An oauth token you previously retrieved separately
sourcepub fn get_aas_token(&self) -> Option<&str>
pub fn get_aas_token(&self) -> Option<&str>
Get the aas token that has been previously set by either request_aas_token
or
set_aas_token
.
sourcepub async fn login(&mut self) -> Result<(), GpapiError>
pub async fn login(&mut self) -> Result<(), GpapiError>
Log in to Google’s Play Store API. This is required for most other actions. The aas token
has to be set via request_aas_token
or set_aas_token
first.
sourcepub async fn download<S: Into<String>>(
&self,
pkg_name: S,
version_code: Option<i32>,
split_if_available: bool,
include_additional_files: bool,
dst_path: &Path,
cb: Option<&Box<dyn Fn(String, u64) -> Box<dyn Fn(u64)>>>
) -> Result<Vec<()>, GpapiError>
pub async fn download<S: Into<String>>( &self, pkg_name: S, version_code: Option<i32>, split_if_available: bool, include_additional_files: bool, dst_path: &Path, cb: Option<&Box<dyn Fn(String, u64) -> Box<dyn Fn(u64)>>> ) -> Result<Vec<()>, GpapiError>
Download a package, given a package ID, optional version code, and filesystem path.
§Arguments
pkg_name
- A string type specifying the package’s app ID, e.g.com.instagram.android
version_code
- An optinal version code, given in i32. If omitted, the latest version will be usedsplit_if_available
- A boolean indicating whether a split APK is desired, if availableinclude_additional_files
- A boolean indicating if additional files should be downloaded as well, if availabledst_path
- A path to download the file to.cb
- An optional callback for reporting information about the download asynchronously. The outer callback takes the filename (String) and total size in bytes of the file (u64) and returns an inner callback. The inner callback takes the position of the current download.
§Errors
If the file already exists for this download, an Err(Error
) result is returned with an
[ErrorKind
] of FileExists.
If additional files or a split APK is to be downloaded but the directory already exists, an
Err(Error
) result is returned with an [ErrorKind
] of DirectoryExists.
If the specified directory is misssing, an Err(Error
) result is returned with an
[ErrorKind
] of DirectoryMissing.
sourcepub async fn get_download_info<S: Into<String>>(
&self,
pkg_name: S,
version_code: Option<i32>
) -> Result<(Option<String>, Vec<(Option<String>, Option<String>)>, Vec<(Option<String>, Option<String>)>), GpapiError>
pub async fn get_download_info<S: Into<String>>( &self, pkg_name: S, version_code: Option<i32> ) -> Result<(Option<String>, Vec<(Option<String>, Option<String>)>, Vec<(Option<String>, Option<String>)>), GpapiError>
Retrieve the download URL(s) and names for a package, given a package ID and optional version code.
§Arguments
pkg_name
- A string type specifying the package’s app ID, e.g.com.instagram.android
version_code
- An optinal version code, given in i32. If omitted, the latest version will be used
§Returns
- An Option
to the full APK download URL, followed by a Vec<(Option , Option )> which corresponds to a list of download URLs and names for the split APK, then followed by another Vec<(Option , Option )> which corresponds to the download URLs and filenames for additional files.
sourcepub async fn details<S: Into<String>>(
&self,
pkg_name: S
) -> Result<Option<DetailsResponse>, Box<dyn Error>>
pub async fn details<S: Into<String>>( &self, pkg_name: S ) -> Result<Option<DetailsResponse>, Box<dyn Error>>
Play Store package detail request (provides more detail than bulk requests).
§Arguments
pkg_name
- A string type specifying the package’s app ID, e.g.com.instagram.android
sourcepub async fn bulk_details(
&self,
pkg_names: &[&str]
) -> Result<Option<BulkDetailsResponse>, GpapiError>
pub async fn bulk_details( &self, pkg_names: &[&str] ) -> Result<Option<BulkDetailsResponse>, GpapiError>
Play Store bulk detail request for multiple apps.
§Arguments
pkg_names
- An array of string types specifying package app IDs
sourcepub async fn accept_tos(
&mut self
) -> Result<Option<AcceptTosResponse>, Box<dyn Error>>
pub async fn accept_tos( &mut self ) -> Result<Option<AcceptTosResponse>, Box<dyn Error>>
Accept the play store terms of service.