zoom_api/
billing.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct Billing {
5    pub client: Client,
6}
7
8impl Billing {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        Billing { client }
12    }
13
14    /**
15     * Get billing information.
16     *
17     * This function performs a `GET` to the `/accounts/{accountId}/billing` endpoint.
18     *
19     * 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>
20     *
21     * **Prerequisites:**
22     * * Pro or a higher paid account with master account option enabled. <br>
23     *
24     * **Scope**:`billing:master`<br>
25     * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`<br>
26     *
27     *
28     *
29     * **Parameters:**
30     *
31     * * `account_id: &str` -- User's first name.
32     */
33    pub async fn account(
34        &self,
35        account_id: &str,
36    ) -> ClientResult<crate::Response<crate::types::Contact>> {
37        let url = self.client.url(
38            &format!(
39                "/accounts/{}/billing",
40                crate::progenitor_support::encode_path(account_id),
41            ),
42            None,
43        );
44        self.client
45            .get(
46                &url,
47                crate::Message {
48                    body: None,
49                    content_type: None,
50                },
51            )
52            .await
53    }
54    /**
55     * Update billing information.
56     *
57     * This function performs a `PATCH` to the `/accounts/{accountId}/billing` endpoint.
58     *
59     * Update [billing information](https://support.zoom.us/hc/en-us/articles/201363263-About-Billing) of a sub account.<br><br>
60     * 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>
61     *
62     * **Prerequisites:**
63     * * Pro or a higher paid account with master account option enabled. <br>
64     *
65     * **Scope**:`billing:master`<br>
66     * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
67     *
68     *
69     *
70     * **Parameters:**
71     *
72     * * `account_id: &str` -- User's first name.
73     */
74    pub async fn account_update(
75        &self,
76        account_id: &str,
77        body: &crate::types::BillingContact,
78    ) -> ClientResult<crate::Response<()>> {
79        let url = self.client.url(
80            &format!(
81                "/accounts/{}/billing",
82                crate::progenitor_support::encode_path(account_id),
83            ),
84            None,
85        );
86        self.client
87            .patch(
88                &url,
89                crate::Message {
90                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
91                    content_type: Some("application/json".to_string()),
92                },
93            )
94            .await
95    }
96    /**
97     * Get plan Information.
98     *
99     * This function performs a `GET` to the `/accounts/{accountId}/plans` endpoint.
100     *
101     * 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>
102     * **Scopes:** `billing:master`<br>
103     * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`<br>
104     *
105     *
106     *  
107     *
108     * **Parameters:**
109     *
110     * * `account_id: &str` -- User's first name.
111     */
112    pub async fn account_plans(
113        &self,
114        account_id: &str,
115    ) -> ClientResult<crate::Response<crate::types::AccountPlansResponse>> {
116        let url = self.client.url(
117            &format!(
118                "/accounts/{}/plans",
119                crate::progenitor_support::encode_path(account_id),
120            ),
121            None,
122        );
123        self.client
124            .get(
125                &url,
126                crate::Message {
127                    body: None,
128                    content_type: None,
129                },
130            )
131            .await
132    }
133    /**
134     * Subscribe plans.
135     *
136     * This function performs a `POST` to the `/accounts/{accountId}/plans` endpoint.
137     *
138     * 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>
139     * **Scopes**: `billing:master`<br>
140     *  
141     *
142     * **Parameters:**
143     *
144     * * `account_id: &str` -- User's first name.
145     */
146    pub async fn account_plan_create(
147        &self,
148        account_id: &str,
149        body: &crate::types::AccountPlanCreateRequestAllOf,
150    ) -> ClientResult<crate::Response<()>> {
151        let url = self.client.url(
152            &format!(
153                "/accounts/{}/plans",
154                crate::progenitor_support::encode_path(account_id),
155            ),
156            None,
157        );
158        self.client
159            .post(
160                &url,
161                crate::Message {
162                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
163                    content_type: Some("application/json".to_string()),
164                },
165            )
166            .await
167    }
168    /**
169     * Update a base plan.
170     *
171     * This function performs a `PUT` to the `/accounts/{accountId}/plans/base` endpoint.
172     *
173     * Update a base plan of a sub account.
174     *
175     * 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.
176     *
177     * **Scopes:** `billing:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
178     *
179     * **Prerequisites:**<br>
180     * * The subaccount must have a Pro or a higher plan.
181     *
182     * **Parameters:**
183     *
184     * * `account_id: &str` -- User's first name.
185     */
186    pub async fn account_plan_base_update(
187        &self,
188        account_id: &str,
189        body: &crate::types::PlanBase,
190    ) -> ClientResult<crate::Response<()>> {
191        let url = self.client.url(
192            &format!(
193                "/accounts/{}/plans/base",
194                crate::progenitor_support::encode_path(account_id),
195            ),
196            None,
197        );
198        self.client
199            .put(
200                &url,
201                crate::Message {
202                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
203                    content_type: Some("application/json".to_string()),
204                },
205            )
206            .await
207    }
208    /**
209     * Update an additional plan.
210     *
211     * This function performs a `PUT` to the `/accounts/{accountId}/plans/addons` endpoint.
212     *
213     * Update an additional plan for a sub account.
214     *
215     * 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>
216     * <br>**Prerequisites:**<br>
217     * * Pro or a higher plan with master account enabled.
218     * * The sub account must be a paid account. The billing charges for the sub account must be paid by the master account.<br><br>
219     *
220     * **Scopes**: `billing:master`<br>
221     * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
222     *
223     *
224     *  
225     *
226     * **Parameters:**
227     *
228     * * `account_id: &str` -- User's first name.
229     */
230    pub async fn account_plan_addon_update(
231        &self,
232        account_id: &str,
233        body: &crate::types::PlanBase,
234    ) -> ClientResult<crate::Response<()>> {
235        let url = self.client.url(
236            &format!(
237                "/accounts/{}/plans/addons",
238                crate::progenitor_support::encode_path(account_id),
239            ),
240            None,
241        );
242        self.client
243            .put(
244                &url,
245                crate::Message {
246                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
247                    content_type: Some("application/json".to_string()),
248                },
249            )
250            .await
251    }
252    /**
253     * Subscribe additional plan.
254     *
255     * This function performs a `POST` to the `/accounts/{accountId}/plans/addons` endpoint.
256     *
257     * 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**.
258     *
259     * **Scopes**: `billing:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
260     *
261     * **Prerequisites:**
262     * * Pro or a higher plan with master account option enabled
263     * * The subaccount must be a paid account whose billing charges are paid by its master account
264     *
265     * **Parameters:**
266     *
267     * * `account_id: &str` -- User's first name.
268     */
269    pub async fn account_plan_addon_create(
270        &self,
271        account_id: &str,
272        body: &crate::types::AccountPlanAddonCreateRequestOneOf,
273    ) -> ClientResult<crate::Response<crate::types::AccountPlans>> {
274        let url = self.client.url(
275            &format!(
276                "/accounts/{}/plans/addons",
277                crate::progenitor_support::encode_path(account_id),
278            ),
279            None,
280        );
281        self.client
282            .post(
283                &url,
284                crate::Message {
285                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
286                    content_type: Some("application/json".to_string()),
287                },
288            )
289            .await
290    }
291    /**
292     * Cancel a base plan.
293     *
294     * This function performs a `PATCH` to the `/accounts/{accountId}/plans/base/status` endpoint.
295     *
296     * [Cancel a base plan](https://support.zoom.us/hc/en-us/articles/203634215-How-Do-I-Cancel-My-Subscription-) for a sub account.
297     *
298     * 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>
299     *
300     * **Scopes**: `billing:master`<br>
301     * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
302     * **Prerequisites:**<br>
303     * * The sub account must have a Pro or a higher plan.
304     *  
305     *
306     * **Parameters:**
307     *
308     * * `account_id: &str` -- User's first name.
309     */
310    pub async fn account_plan_base_delete(
311        &self,
312        account_id: &str,
313        body: &crate::types::AccountPlanBaseDeleteRequest,
314    ) -> ClientResult<crate::Response<()>> {
315        let url = self.client.url(
316            &format!(
317                "/accounts/{}/plans/base/status",
318                crate::progenitor_support::encode_path(account_id),
319            ),
320            None,
321        );
322        self.client
323            .patch(
324                &url,
325                crate::Message {
326                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
327                    content_type: Some("application/json".to_string()),
328                },
329            )
330            .await
331    }
332    /**
333     * Cancel additional plans.
334     *
335     * This function performs a `PATCH` to the `/accounts/{accountId}/plans/addons/status` endpoint.
336     *
337     * [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.
338     *
339     * 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>
340     *
341     * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
342     *
343     * **Prerequisites:**<br>
344     * * Pro or a higher plan with master account option enabled.
345     * * The sub account must be a paid account.<br>
346     * **Scope:** `billing:master`<br>
347     *  
348     */
349    pub async fn account_plan_addon_cancel(
350        &self,
351        account_id: &str,
352        body: &crate::types::AccountPlanAddonCancelRequest,
353    ) -> ClientResult<crate::Response<()>> {
354        let url = self.client.url(
355            &format!(
356                "/accounts/{}/plans/addons/status",
357                crate::progenitor_support::encode_path(account_id),
358            ),
359            None,
360        );
361        self.client
362            .patch(
363                &url,
364                crate::Message {
365                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
366                    content_type: Some("application/json".to_string()),
367                },
368            )
369            .await
370    }
371    /**
372     * Get plan usage.
373     *
374     * This function performs a `GET` to the `/accounts/{accountId}/plans/usage` endpoint.
375     *
376     * 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.
377     *
378     * **Prerequisite**:<br>
379     * Account type: master account on a paid Pro, Business or Enterprise plan.<br>
380     * **Scope:** `billing:master` for master and sub accounts. `account:read:admin` for regular Zoom accounts.<br>
381     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
382     */
383    pub async fn get_plan_usage(
384        &self,
385        account_id: &str,
386    ) -> ClientResult<crate::Response<crate::types::GetPlanUsageResponse>> {
387        let url = self.client.url(
388            &format!(
389                "/accounts/{}/plans/usage",
390                crate::progenitor_support::encode_path(account_id),
391            ),
392            None,
393        );
394        self.client
395            .get(
396                &url,
397                crate::Message {
398                    body: None,
399                    content_type: None,
400                },
401            )
402            .await
403    }
404    /**
405     * List billing invoices.
406     *
407     * This function performs a `GET` to the `/accounts/{accountId}/billing/invoices` endpoint.
408     *
409     * 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.
410     *
411     * 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.
412     *
413     * **Prerequisites:**
414     * * Account must be enrolled in Pro or a higher plan.<br>
415     *
416     * **Scope**:`billing:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
417     * **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`).
418     *
419     * **Parameters:**
420     *
421     * * `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.
422     *   .
423     * * `to: chrono::NaiveDate` -- End date for the invoice query in `yyyy-mm-dd` format.
424     */
425    pub async fn account_invoice(
426        &self,
427        account_id: &str,
428        from: chrono::NaiveDate,
429        to: chrono::NaiveDate,
430    ) -> ClientResult<crate::Response<crate::types::AccountBillingInvoicesResponseData>> {
431        let mut query_args: Vec<(String, String)> = Default::default();
432        if !from.to_string().is_empty() {
433            query_args.push(("from".to_string(), from.to_string()));
434        }
435        if !to.to_string().is_empty() {
436            query_args.push(("to".to_string(), to.to_string()));
437        }
438        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
439        let url = self.client.url(
440            &format!(
441                "/accounts/{}/billing/invoices?{}",
442                crate::progenitor_support::encode_path(account_id),
443                query_
444            ),
445            None,
446        );
447        self.client
448            .get(
449                &url,
450                crate::Message {
451                    body: None,
452                    content_type: None,
453                },
454            )
455            .await
456    }
457    /**
458     * Get invoice details.
459     *
460     * This function performs a `GET` to the `/accounts/{accountId}/billing/invoices/{invoiceId}` endpoint.
461     *
462     * 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.
463     *
464     * **Prerequisites:**
465     * * Account must be enrolled in Pro or a higher plan. <br>
466     *
467     * **Scope**:`billing:master`<br>
468     * <br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>
469     * **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**.
470     */
471    pub async fn get_account_invoice(
472        &self,
473        account_id: &str,
474        invoice_id: &str,
475    ) -> ClientResult<crate::Response<crate::types::GetAccountBillingInvoiceResponse>> {
476        let url = self.client.url(
477            &format!(
478                "/accounts/{}/billing/invoices/{}",
479                crate::progenitor_support::encode_path(account_id),
480                crate::progenitor_support::encode_path(invoice_id),
481            ),
482            None,
483        );
484        self.client
485            .get(
486                &url,
487                crate::Message {
488                    body: None,
489                    content_type: None,
490                },
491            )
492            .await
493    }
494    /**
495     * Download an invoice file.
496     *
497     * This function performs a `GET` to the `/api/download/billing/invoices/{invoiceId}` endpoint.
498     *
499     * 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.
500     *
501     * **Scopes:** `billing:master`<br>**Rate Limits:**
502     * * You can make **one** request to this API every **30 minutes** until the daily limit is reached.
503     * * This API has a daily limit of **100 requests per account**.
504     */
505    pub async fn download_invoice_pdf(
506        &self,
507        invoice_id: &str,
508    ) -> ClientResult<crate::Response<()>> {
509        let url = self.client.url(
510            &format!(
511                "/api/download/billing/invoices/{}",
512                crate::progenitor_support::encode_path(invoice_id),
513            ),
514            None,
515        );
516        self.client
517            .get(
518                &url,
519                crate::Message {
520                    body: None,
521                    content_type: None,
522                },
523            )
524            .await
525    }
526}