mirror of
https://github.com/nab138/isideload.git
synced 2026-03-02 06:26:16 +01:00
Add docs
This commit is contained in:
@@ -29,6 +29,7 @@ impl Display for TeamSelection {
|
||||
}
|
||||
}
|
||||
|
||||
/// Behavior when the maximum number of development certificates is reached
|
||||
pub enum MaxCertsBehavior {
|
||||
/// If the maximum number of certificates is reached, revoke certs until it is possible to create a new certificate
|
||||
Revoke,
|
||||
@@ -59,26 +60,41 @@ impl SideloaderBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the team selection behavior
|
||||
///
|
||||
/// See [`TeamSelection`] for details.
|
||||
pub fn team_selection(mut self, selection: TeamSelection) -> Self {
|
||||
self.team_selection = Some(selection);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the storage backend for sideloading data
|
||||
///
|
||||
/// An implementation using `keyring` is provided in the `keyring-storage` feature.
|
||||
/// See [`SideloadingStorage`] for details.
|
||||
///
|
||||
/// If not set, either keyring storage or in memory storage (not persisted across runs) will be used depending on if the `keyring-storage` feature is enabled.
|
||||
pub fn storage(mut self, storage: Box<dyn SideloadingStorage>) -> Self {
|
||||
self.storage = Some(storage);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the machine name to use for the development certificate
|
||||
///
|
||||
/// This has no bearing on functionality but can be useful for users to identify where a certificate came from.
|
||||
/// If not set, a default name of "isideload" will be used.
|
||||
pub fn machine_name(mut self, machine_name: String) -> Self {
|
||||
self.machine_name = Some(machine_name);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the behavior for when the maximum number of development certificates is reached
|
||||
pub fn max_certs_behavior(mut self, behavior: MaxCertsBehavior) -> Self {
|
||||
self.max_certs_behavior = Some(behavior);
|
||||
self
|
||||
}
|
||||
|
||||
/// Build the `Sideloader` instance with the provided configuration
|
||||
pub fn build(self) -> Sideloader {
|
||||
Sideloader::new(
|
||||
self.developer_session,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub mod builder;
|
||||
pub mod certificate;
|
||||
pub mod cert_identity;
|
||||
pub mod sideloader;
|
||||
pub use builder::{SideloaderBuilder, TeamSelection};
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::{
|
||||
devices::DevicesApi,
|
||||
teams::{DeveloperTeam, TeamsApi},
|
||||
},
|
||||
sideload::{TeamSelection, builder::MaxCertsBehavior, certificate::CertificateIdentity},
|
||||
sideload::{TeamSelection, builder::MaxCertsBehavior, cert_identity::CertificateIdentity},
|
||||
util::{device::IdeviceInfo, storage::SideloadingStorage},
|
||||
};
|
||||
|
||||
@@ -24,6 +24,9 @@ pub struct Sideloader {
|
||||
}
|
||||
|
||||
impl Sideloader {
|
||||
/// Construct a new `Sideloader` instance with the provided configuration
|
||||
///
|
||||
/// See [`crate::sideload::SideloaderBuilder`] for more details and a more convenient way to construct a `Sideloader`.
|
||||
pub fn new(
|
||||
dev_session: DeveloperSession,
|
||||
apple_email: String,
|
||||
@@ -42,6 +45,7 @@ impl Sideloader {
|
||||
}
|
||||
}
|
||||
|
||||
/// Sign and install an app
|
||||
pub async fn install_app(
|
||||
&mut self,
|
||||
device_provider: &impl IdeviceProvider,
|
||||
@@ -73,6 +77,7 @@ impl Sideloader {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the developer team according to the configured team selection behavior
|
||||
pub async fn get_team(&mut self) -> Result<DeveloperTeam, Report> {
|
||||
let teams = self.dev_session.list_teams().await?;
|
||||
Ok(match teams.len() {
|
||||
|
||||
Reference in New Issue
Block a user