zoom_api/
tsp.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct Tsp {
5    pub client: Client,
6}
7
8impl Tsp {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        Tsp { client }
12    }
13
14    /**
15     * Get account's TSP information.
16     *
17     * This function performs a `GET` to the `/tsp` endpoint.
18     *
19     * Get information on Telephony Service Provider on an account level.<br><br>
20     * **Scopes:** `tsp:read:admin` <br>
21     *  
22     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
23     *
24     * **Prerequisites:**<br>
25     * * A Pro or a higher plan.
26     */
27    pub async fn get(&self) -> ClientResult<crate::Response<crate::types::TspResponse>> {
28        let url = self.client.url("/tsp", None);
29        self.client
30            .get(
31                &url,
32                crate::Message {
33                    body: None,
34                    content_type: None,
35                },
36            )
37            .await
38    }
39    /**
40     * Update account's TSP information.
41     *
42     * This function performs a `PATCH` to the `/tsp` endpoint.
43     *
44     * Update information of the Telephony Service Provider set up on an account.<br>
45     * **Prerequisites**:<br>
46     * TSP account option should be enabled.<br>
47     * **Scopes:** `tsp:write:admin`<br>
48     *  
49     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
50     *
51     */
52    pub async fn update(
53        &self,
54        body: &crate::types::TspUpdateRequest,
55    ) -> ClientResult<crate::Response<()>> {
56        let url = self.client.url("/tsp", None);
57        self.client
58            .patch(
59                &url,
60                crate::Message {
61                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
62                    content_type: Some("application/json".to_string()),
63                },
64            )
65            .await
66    }
67    /**
68     * List user's TSP accounts.
69     *
70     * This function performs a `GET` to the `/users/{userId}/tsp` endpoint.
71     *
72     * A user can have a maximum of two TSP accounts. Use this API to list all TSP accounts of a user.<br><br>
73     * **Scopes:** `tsp:read:admin` `tsp:read`<br>
74     *  
75     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
76     *
77     * **Parameters:**
78     *
79     * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
80     */
81    pub async fn user_ts_ps(
82        &self,
83        user_id: &str,
84    ) -> ClientResult<crate::Response<crate::types::UserTsPsResponse>> {
85        let url = self.client.url(
86            &format!(
87                "/users/{}/tsp",
88                crate::progenitor_support::encode_path(user_id),
89            ),
90            None,
91        );
92        self.client
93            .get(
94                &url,
95                crate::Message {
96                    body: None,
97                    content_type: None,
98                },
99            )
100            .await
101    }
102    /**
103     * Add a user's TSP account.
104     *
105     * This function performs a `POST` to the `/users/{userId}/tsp` endpoint.
106     *
107     * Add a user's TSP account.<br><br>
108     * **Scopes:** `tsp:write:admin` `tsp:write`<br>
109     *  
110     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
111     *
112     *
113     * **Parameters:**
114     *
115     * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
116     */
117    pub async fn user_create(
118        &self,
119        user_id: &str,
120        body: &crate::types::TspAccountsList,
121    ) -> ClientResult<crate::Response<crate::types::TspAccountsList>> {
122        let url = self.client.url(
123            &format!(
124                "/users/{}/tsp",
125                crate::progenitor_support::encode_path(user_id),
126            ),
127            None,
128        );
129        self.client
130            .post(
131                &url,
132                crate::Message {
133                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
134                    content_type: Some("application/json".to_string()),
135                },
136            )
137            .await
138    }
139    /**
140     * Get a user's TSP account.
141     *
142     * This function performs a `GET` to the `/users/{userId}/tsp/{tspId}` endpoint.
143     *
144     * Each user can have a maximum of two TSP accounts. Use this API to retrieve details of a specific TSP account enabled for a specific user.<br><br>
145     * **Scopes:** `tsp:read:admin` `tsp:read`<br>
146     *  
147     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
148     *
149     *
150     * **Parameters:**
151     *
152     * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
153     * * `tsp_id: &str` -- Audio types:<br>`1` - Toll-free Call-in & Call-out.<br>`2` - Toll <br>
154     *  `3` - SIP Connected Audio.
155     */
156    pub async fn user(
157        &self,
158        user_id: &str,
159        tsp_id: &str,
160    ) -> ClientResult<crate::Response<crate::types::TspAccount>> {
161        let url = self.client.url(
162            &format!(
163                "/users/{}/tsp/{}",
164                crate::progenitor_support::encode_path(user_id),
165                crate::progenitor_support::encode_path(tsp_id),
166            ),
167            None,
168        );
169        self.client
170            .get(
171                &url,
172                crate::Message {
173                    body: None,
174                    content_type: None,
175                },
176            )
177            .await
178    }
179    /**
180     * Delete a user's TSP account.
181     *
182     * This function performs a `DELETE` to the `/users/{userId}/tsp/{tspId}` endpoint.
183     *
184     * Delete a user's TSP account.<br><br>
185     * **Scopes:** `tsp:write:admin` `tsp:write`<br>
186     *  
187     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
188     *
189     *
190     * **Parameters:**
191     *
192     * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
193     * * `tsp_id: &str` -- Audio types:<br>`1` - Toll-free Call-in & Call-out.<br>`2` - Toll <br>
194     *  `3` - SIP Connected Audio.
195     */
196    pub async fn user_delete(
197        &self,
198        user_id: &str,
199        tsp_id: &str,
200    ) -> ClientResult<crate::Response<()>> {
201        let url = self.client.url(
202            &format!(
203                "/users/{}/tsp/{}",
204                crate::progenitor_support::encode_path(user_id),
205                crate::progenitor_support::encode_path(tsp_id),
206            ),
207            None,
208        );
209        self.client
210            .delete(
211                &url,
212                crate::Message {
213                    body: None,
214                    content_type: None,
215                },
216            )
217            .await
218    }
219    /**
220     * Update a TSP account.
221     *
222     * This function performs a `PATCH` to the `/users/{userId}/tsp/{tspId}` endpoint.
223     *
224     * Update a user's TSP account.<br><br>
225     * **Scopes:** `tsp:write:admin` `tsp:write`<br>
226     *  
227     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
228     *
229     *
230     * **Parameters:**
231     *
232     * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
233     * * `tsp_id: &str` -- Audio types:<br>`1` - Toll-free Call-in & Call-out.<br>`2` - Toll <br>
234     *  `3` - SIP Connected Audio.
235     */
236    pub async fn user_update(
237        &self,
238        user_id: &str,
239        tsp_id: &str,
240        body: &crate::types::TspAccountData,
241    ) -> ClientResult<crate::Response<()>> {
242        let url = self.client.url(
243            &format!(
244                "/users/{}/tsp/{}",
245                crate::progenitor_support::encode_path(user_id),
246                crate::progenitor_support::encode_path(tsp_id),
247            ),
248            None,
249        );
250        self.client
251            .patch(
252                &url,
253                crate::Message {
254                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
255                    content_type: Some("application/json".to_string()),
256                },
257            )
258            .await
259    }
260    /**
261     * Set global dial-in URL for a TSP user.
262     *
263     * This function performs a `PATCH` to the `/users/{userId}/tsp/settings` endpoint.
264     *
265     * A global dial-in page can provide a list of global access numbers using which audio conferencing can be conducted. By calling this API, you can set the url for the global dial-in page of a user whose Zoom account has TSP and special TSP with third-party audio conferencing options enabled. <p></p>
266     * **Scopes:**`tsp:write:admin` `tsp:write`<br>
267     *  
268     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
269     *
270     *
271     * **Parameters:**
272     *
273     * * `user_id: &str` -- The userId or email address of the user.
274     */
275    pub async fn url_update(
276        &self,
277        user_id: &str,
278        body: &crate::types::TspGlobalDialIn,
279    ) -> ClientResult<crate::Response<()>> {
280        let url = self.client.url(
281            &format!(
282                "/users/{}/tsp/settings",
283                crate::progenitor_support::encode_path(user_id),
284            ),
285            None,
286        );
287        self.client
288            .patch(
289                &url,
290                crate::Message {
291                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
292                    content_type: Some("application/json".to_string()),
293                },
294            )
295            .await
296    }
297}