Impliment some of app groups

This commit is contained in:
nab138
2026-01-30 13:56:50 -05:00
parent 0554780618
commit 1648537bd0
4 changed files with 83 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ use std::env;
use isideload::{ use isideload::{
anisette::remote_v3::RemoteV3AnisetteProvider, anisette::remote_v3::RemoteV3AnisetteProvider,
auth::apple_account::AppleAccount, auth::apple_account::AppleAccount,
dev::developer_session::{AppIdsApi, DeveloperSession, TeamsApi}, dev::developer_session::{AppGroupsApi, DeveloperSession, TeamsApi},
}; };
use tracing::Level; use tracing::Level;
@@ -60,7 +60,7 @@ async fn main() {
.expect("No developer teams available for this account"); .expect("No developer teams available for this account");
let res = dev_session let res = dev_session
.list_app_ids(team, None) .add_app_group(team, "Example", "group.me.nabdev.example.59AV98CNR7", None)
.await .await
.expect("Failed to add appid"); .expect("Failed to add appid");

View File

@@ -0,0 +1,79 @@
use crate::{
dev::{
developer_session::DeveloperSession,
device_type::{DeveloperDeviceType, dev_url},
teams::DeveloperTeam,
},
util::plist::SensitivePlistAttachment,
};
use plist::{Date, Dictionary, Value};
use plist_macro::plist;
use rootcause::prelude::*;
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AppGroup {
pub name: Option<String>,
pub identifier: String,
pub application_group: String,
}
#[async_trait::async_trait]
pub trait AppGroupsApi {
fn developer_session(&self) -> &DeveloperSession<'_>;
async fn list_app_groups(
&self,
team: &DeveloperTeam,
device_type: impl Into<Option<DeveloperDeviceType>> + Send,
) -> Result<Vec<AppGroup>, Report> {
let body = plist!(dict {
"teamId": &team.team_id,
});
let app_groups: Vec<AppGroup> = self
.developer_session()
.send_dev_request(
&dev_url("listApplicationGroups", device_type),
body,
"applicationGroupList",
)
.await
.context("Failed to list developer app groups")?;
Ok(app_groups)
}
async fn add_app_group(
&self,
team: &DeveloperTeam,
name: &str,
identifier: &str,
device_type: impl Into<Option<DeveloperDeviceType>> + Send,
) -> Result<AppGroup, Report> {
let body = plist!(dict {
"teamId": &team.team_id,
"name": name,
"identifier": identifier,
});
let app_group: AppGroup = self
.developer_session()
.send_dev_request(
&dev_url("addApplicationGroup", device_type),
body,
"applicationGroup",
)
.await
.context("Failed to add developer app group")?;
Ok(app_group)
}
}
impl AppGroupsApi for DeveloperSession<'_> {
fn developer_session(&self) -> &DeveloperSession<'_> {
self
}
}

View File

@@ -14,6 +14,7 @@ use crate::{
util::plist::PlistDataExtract, util::plist::PlistDataExtract,
}; };
pub use super::app_groups::*;
pub use super::app_ids::*; pub use super::app_ids::*;
pub use super::certificates::*; pub use super::certificates::*;
pub use super::device_type::DeveloperDeviceType; pub use super::device_type::DeveloperDeviceType;

View File

@@ -1,3 +1,4 @@
pub mod app_groups;
pub mod app_ids; pub mod app_ids;
pub mod certificates; pub mod certificates;
pub mod developer_session; pub mod developer_session;