@smbcloud / smbcloud-ascapi Mirror · read-only / commits / 8faea22
Fork 0

Read-only mirror of github.com/smbcloudXYZ/smbcloud-ascapi.

Mirrored from https://github.com/smbcloudXYZ/smbcloud-ascapi.git

Synced Nov 25, 09:15 UTC

Add asc msstore submissions get

Prints a submission's packages (file name, version, file status, architecture) and the locales it has listings for. It reads the pending submission, else the last published one, unless --submission-id names one. The raw package record can carry a signed upload URL, so only a fixed set of keys is passed through. Before this there was no way to see whether a draft's MSIX had been uploaded without opening Partner Center. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Seto Elkahfi committed Oct 25, 2026 at 20:34 UTC 8faea226495c0c861fae15769e01aeec5c63ce6c
2 files changed +83
crates/cli/src/main.rs
+16
@@ -588,6 +588,14 @@ enum MsStoreSubmissionsCommand {
588 #[arg(long)]
589 product_id: Option<String>,
590 },
591 + /// The packages and listing locales of a submission: the pending one,
592 + /// else the last published one, unless `--submission-id` names one.
593 + Get {
594 + #[arg(long)]
595 + product_id: Option<String>,
596 + #[arg(long)]
597 + submission_id: Option<String>,
598 + },
599 }
600
601 #[derive(Subcommand)]
@@ -1030,6 +1038,14 @@ async fn run_msstore(
1038 .await
1039 .map_err(fail)?,
1040 ),
1041 + MsStoreSubmissionsCommand::Get {
1042 + product_id,
1043 + submission_id,
1044 + } => print_json(
1045 + &msstore::read_submission(&client, product_id.as_deref(), submission_id.as_deref())
1046 + .await
1047 + .map_err(fail)?,
1048 + ),
1049 },
1050 MsStoreCommand::Listings { command } => match command {
1051 MsStoreListingsCommand::Get { product_id, locale } => print_json(
crates/frontend/src/msstore.rs
+67
@@ -100,6 +100,73 @@ pub async fn submission_status(
100 })
101 }
102
103 +#[derive(Debug, Serialize)]
104 +#[serde(rename_all = "camelCase")]
105 +pub struct SubmissionRead {
106 + pub submission_id: String,
107 + /// `pending` or `lastPublished`.
108 + pub source: &'static str,
109 + pub status: Option<String>,
110 + pub packages: Vec<Value>,
111 + pub listing_locales: Vec<String>,
112 +}
113 +
114 +/// The package keys worth showing. The raw package record can carry a signed
115 +/// upload URL, so it is not passed through whole.
116 +const PACKAGE_KEYS: [&str; 5] = ["fileName", "version", "fileStatus", "architecture", "id"];
117 +
118 +/// The packages and listing locales of a submission: the given one, else the
119 +/// pending one, else the last published one.
120 +pub async fn read_submission(
121 + client: &MsStoreClient,
122 + product_id: Option<&str>,
123 + submission_id: Option<&str>,
124 +) -> Result<SubmissionRead, String> {
125 + let product_id = product(client, product_id);
126 + let (id, source) = match submission_id {
127 + Some(id) => (id.to_string(), "requested"),
128 + None => {
129 + let app = client.get_app(product_id).await.map_err(err)?;
130 + match str_at(&app, "/pendingApplicationSubmission/id") {
131 + Some(id) => (id.to_string(), "pending"),
132 + None => match str_at(&app, "/lastPublishedApplicationSubmission/id") {
133 + Some(id) => (id.to_string(), "lastPublished"),
134 + None => return Err("the app has no submission".to_string()),
135 + },
136 + }
137 + }
138 + };
139 + let submission = client.get_submission(product_id, &id).await.map_err(err)?;
140 + let packages = submission
141 + .get("applicationPackages")
142 + .and_then(Value::as_array)
143 + .map(|packages| {
144 + packages
145 + .iter()
146 + .map(|package| {
147 + let kept = PACKAGE_KEYS
148 + .iter()
149 + .filter_map(|key| package.get(*key).map(|v| (key.to_string(), v.clone())))
150 + .collect();
151 + Value::Object(kept)
152 + })
153 + .collect()
154 + })
155 + .unwrap_or_default();
156 + let listing_locales = submission
157 + .get("listings")
158 + .and_then(Value::as_object)
159 + .map(|listings| listings.keys().cloned().collect())
160 + .unwrap_or_default();
161 + Ok(SubmissionRead {
162 + submission_id: id,
163 + source,
164 + status: str_at(&submission, "/status").map(str::to_string),
165 + packages,
166 + listing_locales,
167 + })
168 +}
169 +
170 #[derive(Debug, Serialize)]
171 #[serde(rename_all = "camelCase")]
172 pub struct ListingRead {