1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
use anyhow::Result;
use crate::Client;
pub struct Billing {
pub client: Client,
}
impl Billing {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
Billing { client }
}
/**
* Get billing information.
*
* This function performs a `GET` to the `/accounts/{accountId}/billing` endpoint.
*
* Get [billing information](https://support.zoom.us/hc/en-us/articles/201363263-About-Billing) of a sub account.<br><br>Only master accounts can use this API. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' billing information. Email the partner programs team at **partner-success@zoom.us** for more details.<br>
*
* **Prerequisites:**
* * Pro or a higher paid account with master account option enabled. <br>
*
* **Scope**:`billing:master`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`<br>
*
*
*
* **Parameters:**
*
* * `account_id: &str` -- User's first name.
*/
pub async fn account(&self, account_id: &str) -> Result<crate::types::Contact> {
let url = format!(
"/accounts/{}/billing",
crate::progenitor_support::encode_path(account_id),
);
self.client.get(&url, None).await
}
/**
* Update billing information.
*
* This function performs a `PATCH` to the `/accounts/{accountId}/billing` endpoint.
*
* Update [billing information](https://support.zoom.us/hc/en-us/articles/201363263-About-Billing) of a sub account.<br><br>
* This API can only be used by master accounts that pay all billing charges of their associated sub accounts. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' billing information. Email the partner programs team at **partner-success@zoom.us** for more details.<br><br>
*
* **Prerequisites:**
* * Pro or a higher paid account with master account option enabled. <br>
*
* **Scope**:`billing:master`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
*
*
*
* **Parameters:**
*
* * `account_id: &str` -- User's first name.
*/
pub async fn account_update(
&self,
account_id: &str,
body: &crate::types::BillingContact,
) -> Result<()> {
let url = format!(
"/accounts/{}/billing",
crate::progenitor_support::encode_path(account_id),
);
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Get plan Information.
*
* This function performs a `GET` to the `/accounts/{accountId}/plans` endpoint.
*
* Get plan information of a sub account that is managed by a master account. <br><br>This API can only be used by master accounts that pay all billing charges of their associated Pro or higher sub accounts. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' billing information. Email the partner programs team at **partner-success@zoom.us** for more details.<br><br>
* **Scopes:** `billing:master`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`<br>
*
*
*
*
* **Parameters:**
*
* * `account_id: &str` -- User's first name.
*/
pub async fn account_plans(
&self,
account_id: &str,
) -> Result<crate::types::AccountPlansResponse> {
let url = format!(
"/accounts/{}/plans",
crate::progenitor_support::encode_path(account_id),
);
self.client.get(&url, None).await
}
/**
* Subscribe plans.
*
* This function performs a `POST` to the `/accounts/{accountId}/plans` endpoint.
*
* Subscribe a sub account to a Zoom plan using your master account. This API can only be used by master accounts that pay all billing charges of their associated Pro or higher sub accounts. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' subscriptions. Email the partner programs team at **partner-success@zoom.us** for more details.<br><br>
* **Scopes**: `billing:master`<br>
*
*
* **Parameters:**
*
* * `account_id: &str` -- User's first name.
*/
pub async fn account_plan_create(
&self,
account_id: &str,
body: &crate::types::AccountPlanCreateRequestAllOf,
) -> Result<()> {
let url = format!(
"/accounts/{}/plans",
crate::progenitor_support::encode_path(account_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Update a base plan.
*
* This function performs a `PUT` to the `/accounts/{accountId}/plans/base` endpoint.
*
* Update a base plan of a sub account.
*
* This API can only be used by master accounts that pay all billing charges of their associated Pro or higher subaccounts. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage subaccounts' subscriptions. Email the partner programs team at **partner-success@zoom.us** for more details.
*
* **Scopes:** `billing:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
*
* **Prerequisites:**<br>
* * The subaccount must have a Pro or a higher plan.
*
* **Parameters:**
*
* * `account_id: &str` -- User's first name.
*/
pub async fn account_plan_base_update(
&self,
account_id: &str,
body: &crate::types::PlanBase,
) -> Result<()> {
let url = format!(
"/accounts/{}/plans/base",
crate::progenitor_support::encode_path(account_id),
);
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Update an additional plan.
*
* This function performs a `PUT` to the `/accounts/{accountId}/plans/addons` endpoint.
*
* Update an additional plan for a sub account.
*
* This API can only be used by master accounts that pay all billing charges of their associated Pro or higher sub accounts. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' subscriptions. Email the partner programs team at **partner-success@zoom.us** for more details.<br><br>
* <br>**Prerequisites:**<br>
* * Pro or a higher plan with master account enabled.
* * The sub account must be a paid account. The billing charges for the sub account must be paid by the master account.<br><br>
*
* **Scopes**: `billing:master`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
*
*
*
*
* **Parameters:**
*
* * `account_id: &str` -- User's first name.
*/
pub async fn account_plan_addon_update(
&self,
account_id: &str,
body: &crate::types::PlanBase,
) -> Result<()> {
let url = format!(
"/accounts/{}/plans/addons",
crate::progenitor_support::encode_path(account_id),
);
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Subscribe additional plan.
*
* This function performs a `POST` to the `/accounts/{accountId}/plans/addons` endpoint.
*
* Subscribe a subaccount to a Zoom addon plan. This API can **only** be used by master accounts that pay all billing charges of their associated Pro or higher subaccounts. Zoom allows only approved partners to use [master APIs](https://marketplace.zoom.us/docs/api-reference/master-account-apis) and manage subaccounts' subscriptions. For more information, email the partner programs team at **partner-success@zoom.us**.
*
* **Scopes**: `billing:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
*
* **Prerequisites:**
* * Pro or a higher plan with master account option enabled
* * The subaccount must be a paid account whose billing charges are paid by its master account
*
* **Parameters:**
*
* * `account_id: &str` -- User's first name.
*/
pub async fn account_plan_addon_create(
&self,
account_id: &str,
body: &crate::types::AccountPlanAddonCreateRequestOneOf,
) -> Result<crate::types::AccountPlans> {
let url = format!(
"/accounts/{}/plans/addons",
crate::progenitor_support::encode_path(account_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Cancel a base plan.
*
* This function performs a `PATCH` to the `/accounts/{accountId}/plans/base/status` endpoint.
*
* [Cancel a base plan](https://support.zoom.us/hc/en-us/articles/203634215-How-Do-I-Cancel-My-Subscription-) for a sub account.
*
* This API can only be used by master accounts that pay all billing charges of their associated Pro or higher sub accounts. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' subscriptions. Email the partner programs team at **partner-success@zoom.us** for more details.<br><br>
*
* **Scopes**: `billing:master`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
* **Prerequisites:**<br>
* * The sub account must have a Pro or a higher plan.
*
*
* **Parameters:**
*
* * `account_id: &str` -- User's first name.
*/
pub async fn account_plan_base_delete(
&self,
account_id: &str,
body: &crate::types::AccountPlanBaseDeleteRequest,
) -> Result<()> {
let url = format!(
"/accounts/{}/plans/base/status",
crate::progenitor_support::encode_path(account_id),
);
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Cancel additional plans.
*
* This function performs a `PATCH` to the `/accounts/{accountId}/plans/addons/status` endpoint.
*
* [Cancel additional plan](https://support.zoom.us/hc/en-us/articles/203634215-How-Do-I-Cancel-My-Subscription-) of a sub account. The cancellation does not provide refund for the current subscription. The service remains active for the current session.
*
* This API can only be used by master accounts that pay all billing charges of their associated Pro or higher sub accounts. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' subscriptions. Email the partner programs team at **partner-success@zoom.us** for more details.<br><br>
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
*
* **Prerequisites:**<br>
* * Pro or a higher plan with master account option enabled.
* * The sub account must be a paid account.<br>
* **Scope:** `billing:master`<br>
*
*/
pub async fn account_plan_addon_cancel(
&self,
account_id: &str,
body: &crate::types::AccountPlanAddonCancelRequest,
) -> Result<()> {
let url = format!(
"/accounts/{}/plans/addons/status",
crate::progenitor_support::encode_path(account_id),
);
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Get plan usage.
*
* This function performs a `GET` to the `/accounts/{accountId}/plans/usage` endpoint.
*
* Get information on usage of [plans](https://marketplace.zoom.us/docs/api-reference/other-references/plans) of an account. This API supports regular accounts as well as master and sub accounts. To get plan usage of a regular account, use the `account:read:admin` scope and provide “me” as the value of the `accountId` path parameter.To get plan usage of a master account, provide the keyword "me" as the value of the `accountId` path parameter and use the `billing:master` scope. To get plan usage of a sub account, provide the actual account Id of the sub account as the value of the `accountId` path parameter and use the `billing:master` scope.
*
* **Prerequisite**:<br>
* Account type: master account on a paid Pro, Business or Enterprise plan.<br>
* **Scope:** `billing:master` for master and sub accounts. `account:read:admin` for regular Zoom accounts.<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
*/
pub async fn get_plan_usage(
&self,
account_id: &str,
) -> Result<crate::types::GetPlanUsageResponse> {
let url = format!(
"/accounts/{}/plans/usage",
crate::progenitor_support::encode_path(account_id),
);
self.client.get(&url, None).await
}
/**
* List billing invoices.
*
* This function performs a `GET` to the `/accounts/{accountId}/billing/invoices` endpoint.
*
* List [invoices](https://support.zoom.us/hc/en-us/articles/207276556-Viewing-your-invoice-history#h_6710542f-23cc-4059-9cc7-ff02bec7314e) of a Zoom account.
*
* To list a regular Zoom account's invoices or a master account's invoices, provide `me` as the value of the `accountId` path parameter. To list a sub account's invoices, provide the account ID of the sub account in the `accountId` path parameter.
*
* **Prerequisites:**
* * Account must be enrolled in Pro or a higher plan.<br>
*
* **Scope**:`billing:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
* **Additional Rate Limit:** You can make **one** API request per account(`accountId`) every **five** minutes until the daily limit is reached. This API has a daily limit of **6** requests per account(`accountId`).
*
* **Parameters:**
*
* * `from: chrono::NaiveDate` -- Start date for the invoice query in `yyyy-mm-dd` format. The date range defined by the “from” and “to” parameters should not exceed one year. The range defined should fall within the past three years.
* .
* * `to: chrono::NaiveDate` -- End date for the invoice query in `yyyy-mm-dd` format.
*/
pub async fn account_invoice(
&self,
account_id: &str,
from: chrono::NaiveDate,
to: chrono::NaiveDate,
) -> Result<crate::types::AccountBillingInvoicesResponseData> {
let mut query_args: Vec<(String, String)> = Default::default();
if !from.to_string().is_empty() {
query_args.push(("from".to_string(), from.to_string()));
}
if !to.to_string().is_empty() {
query_args.push(("to".to_string(), to.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!(
"/accounts/{}/billing/invoices?{}",
crate::progenitor_support::encode_path(account_id),
query_
);
self.client.get(&url, None).await
}
/**
* Get invoice details.
*
* This function performs a `GET` to the `/accounts/{accountId}/billing/invoices/{invoiceId}` endpoint.
*
* Get detailed information about a specific [invoice](https://support.zoom.us/hc/en-us/articles/207276556-Viewing-your-invoice-history#h_6710542f-23cc-4059-9cc7-ff02bec7314e). <br>To retrieve a regular Zoom account's invoice details or a master account's invoice details, provide `me` as the value of `accountId` path parameter. To list a sub account's invoice details, provide the account ID of the sub account in the `accountId` path parameter.
*
* **Prerequisites:**
* * Account must be enrolled in Pro or a higher plan. <br>
*
* **Scope**:`billing:master`<br>
* <br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
* **Additional Rate Limit:** You can make **one** API request every **thirty** minutes until the daily limit is reached. This API has a daily limit of **100** requests per **account**.
*/
pub async fn get_account_invoice(
&self,
account_id: &str,
invoice_id: &str,
) -> Result<crate::types::GetAccountBillingInvoiceResponse> {
let url = format!(
"/accounts/{}/billing/invoices/{}",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(invoice_id),
);
self.client.get(&url, None).await
}
/**
* Download an invoice file.
*
* This function performs a `GET` to the `/api/download/billing/invoices/{invoiceId}` endpoint.
*
* Use this API to download a Zoom account’s [billed](https://support.zoom.us/hc/en-us/articles/201363263-About-Billing) invoice file, in PDF format. To get an account’s invoice ID, use the **[List billing invoices](https://marketplace.zoom.us/docs/api-reference/zoom-api/billing/accountbillinginvoices)** API.
*
* **Scopes:** `billing:master`<br>**Rate Limits:**
* * You can make **one** request to this API every **30 minutes** until the daily limit is reached.
* * This API has a daily limit of **100 requests per account**.
*/
pub async fn download_invoice_pdf(&self, invoice_id: &str) -> Result<()> {
let url = format!(
"/api/download/billing/invoices/{}",
crate::progenitor_support::encode_path(invoice_id),
);
self.client.get(&url, None).await
}
}