openapi_github/apis/
teams_api.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`teams_slash_add_member_legacy`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum TeamsSlashAddMemberLegacyError {
22    Status403(models::BasicError),
23    Status404(),
24    Status422(),
25    UnknownValue(serde_json::Value),
26}
27
28/// struct for typed errors of method [`teams_slash_add_or_update_membership_for_user_in_org`]
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum TeamsSlashAddOrUpdateMembershipForUserInOrgError {
32    Status403(),
33    Status422(),
34    UnknownValue(serde_json::Value),
35}
36
37/// struct for typed errors of method [`teams_slash_add_or_update_membership_for_user_legacy`]
38#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum TeamsSlashAddOrUpdateMembershipForUserLegacyError {
41    Status403(),
42    Status404(models::BasicError),
43    Status422(),
44    UnknownValue(serde_json::Value),
45}
46
47/// struct for typed errors of method [`teams_slash_add_or_update_project_permissions_in_org`]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum TeamsSlashAddOrUpdateProjectPermissionsInOrgError {
51    Status403(models::OrgsRemoveOutsideCollaborator422Response),
52    UnknownValue(serde_json::Value),
53}
54
55/// struct for typed errors of method [`teams_slash_add_or_update_project_permissions_legacy`]
56#[derive(Debug, Clone, Serialize, Deserialize)]
57#[serde(untagged)]
58pub enum TeamsSlashAddOrUpdateProjectPermissionsLegacyError {
59    Status403(models::OrgsRemoveOutsideCollaborator422Response),
60    Status404(models::BasicError),
61    Status422(models::ValidationError),
62    UnknownValue(serde_json::Value),
63}
64
65/// struct for typed errors of method [`teams_slash_add_or_update_repo_permissions_in_org`]
66#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum TeamsSlashAddOrUpdateRepoPermissionsInOrgError {
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`teams_slash_add_or_update_repo_permissions_legacy`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum TeamsSlashAddOrUpdateRepoPermissionsLegacyError {
76    Status403(models::BasicError),
77    Status422(models::ValidationError),
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`teams_slash_check_permissions_for_project_in_org`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum TeamsSlashCheckPermissionsForProjectInOrgError {
85    Status404(),
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`teams_slash_check_permissions_for_project_legacy`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum TeamsSlashCheckPermissionsForProjectLegacyError {
93    Status404(),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`teams_slash_check_permissions_for_repo_in_org`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum TeamsSlashCheckPermissionsForRepoInOrgError {
101    Status404(),
102    UnknownValue(serde_json::Value),
103}
104
105/// struct for typed errors of method [`teams_slash_check_permissions_for_repo_legacy`]
106#[derive(Debug, Clone, Serialize, Deserialize)]
107#[serde(untagged)]
108pub enum TeamsSlashCheckPermissionsForRepoLegacyError {
109    Status404(),
110    UnknownValue(serde_json::Value),
111}
112
113/// struct for typed errors of method [`teams_slash_create`]
114#[derive(Debug, Clone, Serialize, Deserialize)]
115#[serde(untagged)]
116pub enum TeamsSlashCreateError {
117    Status403(models::BasicError),
118    Status422(models::ValidationError),
119    UnknownValue(serde_json::Value),
120}
121
122/// struct for typed errors of method [`teams_slash_create_discussion_comment_in_org`]
123#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum TeamsSlashCreateDiscussionCommentInOrgError {
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`teams_slash_create_discussion_comment_legacy`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum TeamsSlashCreateDiscussionCommentLegacyError {
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`teams_slash_create_discussion_in_org`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum TeamsSlashCreateDiscussionInOrgError {
140    UnknownValue(serde_json::Value),
141}
142
143/// struct for typed errors of method [`teams_slash_create_discussion_legacy`]
144#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum TeamsSlashCreateDiscussionLegacyError {
147    UnknownValue(serde_json::Value),
148}
149
150/// struct for typed errors of method [`teams_slash_delete_discussion_comment_in_org`]
151#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum TeamsSlashDeleteDiscussionCommentInOrgError {
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`teams_slash_delete_discussion_comment_legacy`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum TeamsSlashDeleteDiscussionCommentLegacyError {
161    UnknownValue(serde_json::Value),
162}
163
164/// struct for typed errors of method [`teams_slash_delete_discussion_in_org`]
165#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum TeamsSlashDeleteDiscussionInOrgError {
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`teams_slash_delete_discussion_legacy`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum TeamsSlashDeleteDiscussionLegacyError {
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`teams_slash_delete_in_org`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum TeamsSlashDeleteInOrgError {
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`teams_slash_delete_legacy`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum TeamsSlashDeleteLegacyError {
189    Status404(models::BasicError),
190    Status422(models::ValidationError),
191    UnknownValue(serde_json::Value),
192}
193
194/// struct for typed errors of method [`teams_slash_get_by_name`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum TeamsSlashGetByNameError {
198    Status404(models::BasicError),
199    UnknownValue(serde_json::Value),
200}
201
202/// struct for typed errors of method [`teams_slash_get_discussion_comment_in_org`]
203#[derive(Debug, Clone, Serialize, Deserialize)]
204#[serde(untagged)]
205pub enum TeamsSlashGetDiscussionCommentInOrgError {
206    UnknownValue(serde_json::Value),
207}
208
209/// struct for typed errors of method [`teams_slash_get_discussion_comment_legacy`]
210#[derive(Debug, Clone, Serialize, Deserialize)]
211#[serde(untagged)]
212pub enum TeamsSlashGetDiscussionCommentLegacyError {
213    UnknownValue(serde_json::Value),
214}
215
216/// struct for typed errors of method [`teams_slash_get_discussion_in_org`]
217#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum TeamsSlashGetDiscussionInOrgError {
220    UnknownValue(serde_json::Value),
221}
222
223/// struct for typed errors of method [`teams_slash_get_discussion_legacy`]
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum TeamsSlashGetDiscussionLegacyError {
227    UnknownValue(serde_json::Value),
228}
229
230/// struct for typed errors of method [`teams_slash_get_legacy`]
231#[derive(Debug, Clone, Serialize, Deserialize)]
232#[serde(untagged)]
233pub enum TeamsSlashGetLegacyError {
234    Status404(models::BasicError),
235    UnknownValue(serde_json::Value),
236}
237
238/// struct for typed errors of method [`teams_slash_get_member_legacy`]
239#[derive(Debug, Clone, Serialize, Deserialize)]
240#[serde(untagged)]
241pub enum TeamsSlashGetMemberLegacyError {
242    Status404(),
243    UnknownValue(serde_json::Value),
244}
245
246/// struct for typed errors of method [`teams_slash_get_membership_for_user_in_org`]
247#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum TeamsSlashGetMembershipForUserInOrgError {
250    Status404(),
251    UnknownValue(serde_json::Value),
252}
253
254/// struct for typed errors of method [`teams_slash_get_membership_for_user_legacy`]
255#[derive(Debug, Clone, Serialize, Deserialize)]
256#[serde(untagged)]
257pub enum TeamsSlashGetMembershipForUserLegacyError {
258    Status404(models::BasicError),
259    UnknownValue(serde_json::Value),
260}
261
262/// struct for typed errors of method [`teams_slash_list`]
263#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum TeamsSlashListError {
266    Status403(models::BasicError),
267    UnknownValue(serde_json::Value),
268}
269
270/// struct for typed errors of method [`teams_slash_list_child_in_org`]
271#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum TeamsSlashListChildInOrgError {
274    UnknownValue(serde_json::Value),
275}
276
277/// struct for typed errors of method [`teams_slash_list_child_legacy`]
278#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum TeamsSlashListChildLegacyError {
281    Status403(models::BasicError),
282    Status404(models::BasicError),
283    Status422(models::ValidationError),
284    UnknownValue(serde_json::Value),
285}
286
287/// struct for typed errors of method [`teams_slash_list_discussion_comments_in_org`]
288#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum TeamsSlashListDiscussionCommentsInOrgError {
291    UnknownValue(serde_json::Value),
292}
293
294/// struct for typed errors of method [`teams_slash_list_discussion_comments_legacy`]
295#[derive(Debug, Clone, Serialize, Deserialize)]
296#[serde(untagged)]
297pub enum TeamsSlashListDiscussionCommentsLegacyError {
298    UnknownValue(serde_json::Value),
299}
300
301/// struct for typed errors of method [`teams_slash_list_discussions_in_org`]
302#[derive(Debug, Clone, Serialize, Deserialize)]
303#[serde(untagged)]
304pub enum TeamsSlashListDiscussionsInOrgError {
305    UnknownValue(serde_json::Value),
306}
307
308/// struct for typed errors of method [`teams_slash_list_discussions_legacy`]
309#[derive(Debug, Clone, Serialize, Deserialize)]
310#[serde(untagged)]
311pub enum TeamsSlashListDiscussionsLegacyError {
312    UnknownValue(serde_json::Value),
313}
314
315/// struct for typed errors of method [`teams_slash_list_for_authenticated_user`]
316#[derive(Debug, Clone, Serialize, Deserialize)]
317#[serde(untagged)]
318pub enum TeamsSlashListForAuthenticatedUserError {
319    Status403(models::BasicError),
320    Status404(models::BasicError),
321    UnknownValue(serde_json::Value),
322}
323
324/// struct for typed errors of method [`teams_slash_list_members_in_org`]
325#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum TeamsSlashListMembersInOrgError {
328    UnknownValue(serde_json::Value),
329}
330
331/// struct for typed errors of method [`teams_slash_list_members_legacy`]
332#[derive(Debug, Clone, Serialize, Deserialize)]
333#[serde(untagged)]
334pub enum TeamsSlashListMembersLegacyError {
335    Status404(models::BasicError),
336    UnknownValue(serde_json::Value),
337}
338
339/// struct for typed errors of method [`teams_slash_list_pending_invitations_in_org`]
340#[derive(Debug, Clone, Serialize, Deserialize)]
341#[serde(untagged)]
342pub enum TeamsSlashListPendingInvitationsInOrgError {
343    UnknownValue(serde_json::Value),
344}
345
346/// struct for typed errors of method [`teams_slash_list_pending_invitations_legacy`]
347#[derive(Debug, Clone, Serialize, Deserialize)]
348#[serde(untagged)]
349pub enum TeamsSlashListPendingInvitationsLegacyError {
350    UnknownValue(serde_json::Value),
351}
352
353/// struct for typed errors of method [`teams_slash_list_projects_in_org`]
354#[derive(Debug, Clone, Serialize, Deserialize)]
355#[serde(untagged)]
356pub enum TeamsSlashListProjectsInOrgError {
357    UnknownValue(serde_json::Value),
358}
359
360/// struct for typed errors of method [`teams_slash_list_projects_legacy`]
361#[derive(Debug, Clone, Serialize, Deserialize)]
362#[serde(untagged)]
363pub enum TeamsSlashListProjectsLegacyError {
364    Status404(models::BasicError),
365    UnknownValue(serde_json::Value),
366}
367
368/// struct for typed errors of method [`teams_slash_list_repos_in_org`]
369#[derive(Debug, Clone, Serialize, Deserialize)]
370#[serde(untagged)]
371pub enum TeamsSlashListReposInOrgError {
372    UnknownValue(serde_json::Value),
373}
374
375/// struct for typed errors of method [`teams_slash_list_repos_legacy`]
376#[derive(Debug, Clone, Serialize, Deserialize)]
377#[serde(untagged)]
378pub enum TeamsSlashListReposLegacyError {
379    Status404(models::BasicError),
380    UnknownValue(serde_json::Value),
381}
382
383/// struct for typed errors of method [`teams_slash_remove_member_legacy`]
384#[derive(Debug, Clone, Serialize, Deserialize)]
385#[serde(untagged)]
386pub enum TeamsSlashRemoveMemberLegacyError {
387    Status404(),
388    UnknownValue(serde_json::Value),
389}
390
391/// struct for typed errors of method [`teams_slash_remove_membership_for_user_in_org`]
392#[derive(Debug, Clone, Serialize, Deserialize)]
393#[serde(untagged)]
394pub enum TeamsSlashRemoveMembershipForUserInOrgError {
395    Status403(),
396    UnknownValue(serde_json::Value),
397}
398
399/// struct for typed errors of method [`teams_slash_remove_membership_for_user_legacy`]
400#[derive(Debug, Clone, Serialize, Deserialize)]
401#[serde(untagged)]
402pub enum TeamsSlashRemoveMembershipForUserLegacyError {
403    Status403(),
404    UnknownValue(serde_json::Value),
405}
406
407/// struct for typed errors of method [`teams_slash_remove_project_in_org`]
408#[derive(Debug, Clone, Serialize, Deserialize)]
409#[serde(untagged)]
410pub enum TeamsSlashRemoveProjectInOrgError {
411    UnknownValue(serde_json::Value),
412}
413
414/// struct for typed errors of method [`teams_slash_remove_project_legacy`]
415#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum TeamsSlashRemoveProjectLegacyError {
418    Status404(models::BasicError),
419    Status422(models::ValidationError),
420    UnknownValue(serde_json::Value),
421}
422
423/// struct for typed errors of method [`teams_slash_remove_repo_in_org`]
424#[derive(Debug, Clone, Serialize, Deserialize)]
425#[serde(untagged)]
426pub enum TeamsSlashRemoveRepoInOrgError {
427    UnknownValue(serde_json::Value),
428}
429
430/// struct for typed errors of method [`teams_slash_remove_repo_legacy`]
431#[derive(Debug, Clone, Serialize, Deserialize)]
432#[serde(untagged)]
433pub enum TeamsSlashRemoveRepoLegacyError {
434    UnknownValue(serde_json::Value),
435}
436
437/// struct for typed errors of method [`teams_slash_update_discussion_comment_in_org`]
438#[derive(Debug, Clone, Serialize, Deserialize)]
439#[serde(untagged)]
440pub enum TeamsSlashUpdateDiscussionCommentInOrgError {
441    UnknownValue(serde_json::Value),
442}
443
444/// struct for typed errors of method [`teams_slash_update_discussion_comment_legacy`]
445#[derive(Debug, Clone, Serialize, Deserialize)]
446#[serde(untagged)]
447pub enum TeamsSlashUpdateDiscussionCommentLegacyError {
448    UnknownValue(serde_json::Value),
449}
450
451/// struct for typed errors of method [`teams_slash_update_discussion_in_org`]
452#[derive(Debug, Clone, Serialize, Deserialize)]
453#[serde(untagged)]
454pub enum TeamsSlashUpdateDiscussionInOrgError {
455    UnknownValue(serde_json::Value),
456}
457
458/// struct for typed errors of method [`teams_slash_update_discussion_legacy`]
459#[derive(Debug, Clone, Serialize, Deserialize)]
460#[serde(untagged)]
461pub enum TeamsSlashUpdateDiscussionLegacyError {
462    UnknownValue(serde_json::Value),
463}
464
465/// struct for typed errors of method [`teams_slash_update_in_org`]
466#[derive(Debug, Clone, Serialize, Deserialize)]
467#[serde(untagged)]
468pub enum TeamsSlashUpdateInOrgError {
469    Status403(models::BasicError),
470    Status404(models::BasicError),
471    Status422(models::ValidationError),
472    UnknownValue(serde_json::Value),
473}
474
475/// struct for typed errors of method [`teams_slash_update_legacy`]
476#[derive(Debug, Clone, Serialize, Deserialize)]
477#[serde(untagged)]
478pub enum TeamsSlashUpdateLegacyError {
479    Status403(models::BasicError),
480    Status404(models::BasicError),
481    Status422(models::ValidationError),
482    UnknownValue(serde_json::Value),
483}
484
485
486/// The \"Add team member\" endpoint (described below) is deprecated.  We recommend using the [Add or update team membership for a user](https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user) endpoint instead. It allows you to invite new organization members to your teams.  Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.  To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization.  **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see \"[Synchronizing teams between your identity provider and GitHub](https://docs.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/).\"  Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see \"[HTTP method](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#http-method).\"
487pub async fn teams_slash_add_member_legacy(configuration: &configuration::Configuration, team_id: i32, username: &str) -> Result<(), Error<TeamsSlashAddMemberLegacyError>> {
488    let local_var_configuration = configuration;
489
490    let local_var_client = &local_var_configuration.client;
491
492    let local_var_uri_str = format!("{}/teams/{team_id}/members/{username}", local_var_configuration.base_path, team_id=team_id, username=crate::apis::urlencode(username));
493    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
494
495    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
496        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
497    }
498
499    let local_var_req = local_var_req_builder.build()?;
500    let local_var_resp = local_var_client.execute(local_var_req).await?;
501
502    let local_var_status = local_var_resp.status();
503    let local_var_content = local_var_resp.text().await?;
504
505    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
506        Ok(())
507    } else {
508        let local_var_entity: Option<TeamsSlashAddMemberLegacyError> = serde_json::from_str(&local_var_content).ok();
509        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
510        Err(Error::ResponseError(local_var_error))
511    }
512}
513
514/// Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team.  Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.  **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see \"[Synchronizing teams between your identity provider and GitHub](https://docs.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/).\"  An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the \"pending\" state until the person accepts the invitation, at which point the membership will transition to the \"active\" state and the user will be added as a member of the team.  If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/memberships/{username}`.
515pub async fn teams_slash_add_or_update_membership_for_user_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, username: &str, teams_add_or_update_membership_for_user_in_org_request: Option<models::TeamsAddOrUpdateMembershipForUserInOrgRequest>) -> Result<models::TeamMembership, Error<TeamsSlashAddOrUpdateMembershipForUserInOrgError>> {
516    let local_var_configuration = configuration;
517
518    let local_var_client = &local_var_configuration.client;
519
520    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/memberships/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), username=crate::apis::urlencode(username));
521    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
522
523    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
524        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
525    }
526    local_var_req_builder = local_var_req_builder.json(&teams_add_or_update_membership_for_user_in_org_request);
527
528    let local_var_req = local_var_req_builder.build()?;
529    let local_var_resp = local_var_client.execute(local_var_req).await?;
530
531    let local_var_status = local_var_resp.status();
532    let local_var_content = local_var_resp.text().await?;
533
534    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
535        serde_json::from_str(&local_var_content).map_err(Error::from)
536    } else {
537        let local_var_entity: Option<TeamsSlashAddOrUpdateMembershipForUserInOrgError> = serde_json::from_str(&local_var_content).ok();
538        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
539        Err(Error::ResponseError(local_var_error))
540    }
541}
542
543/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team membership for a user](https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user) endpoint.  Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.  If the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer.  **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see \"[Synchronizing teams between your identity provider and GitHub](https://docs.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/).\"  If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the \"pending\" state until the user accepts the invitation, at which point the membership will transition to the \"active\" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner.  If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.
544pub async fn teams_slash_add_or_update_membership_for_user_legacy(configuration: &configuration::Configuration, team_id: i32, username: &str, teams_add_or_update_membership_for_user_in_org_request: Option<models::TeamsAddOrUpdateMembershipForUserInOrgRequest>) -> Result<models::TeamMembership, Error<TeamsSlashAddOrUpdateMembershipForUserLegacyError>> {
545    let local_var_configuration = configuration;
546
547    let local_var_client = &local_var_configuration.client;
548
549    let local_var_uri_str = format!("{}/teams/{team_id}/memberships/{username}", local_var_configuration.base_path, team_id=team_id, username=crate::apis::urlencode(username));
550    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
551
552    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
553        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
554    }
555    local_var_req_builder = local_var_req_builder.json(&teams_add_or_update_membership_for_user_in_org_request);
556
557    let local_var_req = local_var_req_builder.build()?;
558    let local_var_resp = local_var_client.execute(local_var_req).await?;
559
560    let local_var_status = local_var_resp.status();
561    let local_var_content = local_var_resp.text().await?;
562
563    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
564        serde_json::from_str(&local_var_content).map_err(Error::from)
565    } else {
566        let local_var_entity: Option<TeamsSlashAddOrUpdateMembershipForUserLegacyError> = serde_json::from_str(&local_var_content).ok();
567        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
568        Err(Error::ResponseError(local_var_error))
569    }
570}
571
572/// Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have `admin` permissions for the project. The project and team must be part of the same organization.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
573pub async fn teams_slash_add_or_update_project_permissions_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, project_id: i32, teams_add_or_update_project_permissions_in_org_request: Option<models::TeamsAddOrUpdateProjectPermissionsInOrgRequest>) -> Result<(), Error<TeamsSlashAddOrUpdateProjectPermissionsInOrgError>> {
574    let local_var_configuration = configuration;
575
576    let local_var_client = &local_var_configuration.client;
577
578    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/projects/{project_id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), project_id=project_id);
579    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
580
581    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
582        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
583    }
584    local_var_req_builder = local_var_req_builder.json(&teams_add_or_update_project_permissions_in_org_request);
585
586    let local_var_req = local_var_req_builder.build()?;
587    let local_var_resp = local_var_client.execute(local_var_req).await?;
588
589    let local_var_status = local_var_resp.status();
590    let local_var_content = local_var_resp.text().await?;
591
592    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
593        Ok(())
594    } else {
595        let local_var_entity: Option<TeamsSlashAddOrUpdateProjectPermissionsInOrgError> = serde_json::from_str(&local_var_content).ok();
596        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
597        Err(Error::ResponseError(local_var_error))
598    }
599}
600
601/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team project permissions](https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions) endpoint.  Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have `admin` permissions for the project. The project and team must be part of the same organization.
602pub async fn teams_slash_add_or_update_project_permissions_legacy(configuration: &configuration::Configuration, team_id: i32, project_id: i32, teams_add_or_update_project_permissions_legacy_request: Option<models::TeamsAddOrUpdateProjectPermissionsLegacyRequest>) -> Result<(), Error<TeamsSlashAddOrUpdateProjectPermissionsLegacyError>> {
603    let local_var_configuration = configuration;
604
605    let local_var_client = &local_var_configuration.client;
606
607    let local_var_uri_str = format!("{}/teams/{team_id}/projects/{project_id}", local_var_configuration.base_path, team_id=team_id, project_id=project_id);
608    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
609
610    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
611        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
612    }
613    local_var_req_builder = local_var_req_builder.json(&teams_add_or_update_project_permissions_legacy_request);
614
615    let local_var_req = local_var_req_builder.build()?;
616    let local_var_resp = local_var_client.execute(local_var_req).await?;
617
618    let local_var_status = local_var_resp.status();
619    let local_var_content = local_var_resp.text().await?;
620
621    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
622        Ok(())
623    } else {
624        let local_var_entity: Option<TeamsSlashAddOrUpdateProjectPermissionsLegacyError> = serde_json::from_str(&local_var_content).ok();
625        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
626        Err(Error::ResponseError(local_var_error))
627    }
628}
629
630/// To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a `422 Unprocessable Entity` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see \"[HTTP method](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#http-method).\"  **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.  For more information about the permission levels, see \"[Repository permission levels for an organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)\".
631pub async fn teams_slash_add_or_update_repo_permissions_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, owner: &str, repo: &str, teams_add_or_update_repo_permissions_in_org_request: Option<models::TeamsAddOrUpdateRepoPermissionsInOrgRequest>) -> Result<(), Error<TeamsSlashAddOrUpdateRepoPermissionsInOrgError>> {
632    let local_var_configuration = configuration;
633
634    let local_var_client = &local_var_configuration.client;
635
636    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
637    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
638
639    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
640        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
641    }
642    local_var_req_builder = local_var_req_builder.json(&teams_add_or_update_repo_permissions_in_org_request);
643
644    let local_var_req = local_var_req_builder.build()?;
645    let local_var_resp = local_var_client.execute(local_var_req).await?;
646
647    let local_var_status = local_var_resp.status();
648    let local_var_content = local_var_resp.text().await?;
649
650    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
651        Ok(())
652    } else {
653        let local_var_entity: Option<TeamsSlashAddOrUpdateRepoPermissionsInOrgError> = serde_json::from_str(&local_var_content).ok();
654        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
655        Err(Error::ResponseError(local_var_error))
656    }
657}
658
659/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new \"[Add or update team repository permissions](https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions)\" endpoint.  To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a `422 Unprocessable Entity` status if you attempt to add a repository to a team that is not owned by the organization.  Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see \"[HTTP method](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#http-method).\"
660pub async fn teams_slash_add_or_update_repo_permissions_legacy(configuration: &configuration::Configuration, team_id: i32, owner: &str, repo: &str, teams_add_or_update_repo_permissions_legacy_request: Option<models::TeamsAddOrUpdateRepoPermissionsLegacyRequest>) -> Result<(), Error<TeamsSlashAddOrUpdateRepoPermissionsLegacyError>> {
661    let local_var_configuration = configuration;
662
663    let local_var_client = &local_var_configuration.client;
664
665    let local_var_uri_str = format!("{}/teams/{team_id}/repos/{owner}/{repo}", local_var_configuration.base_path, team_id=team_id, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
666    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
667
668    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
669        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
670    }
671    local_var_req_builder = local_var_req_builder.json(&teams_add_or_update_repo_permissions_legacy_request);
672
673    let local_var_req = local_var_req_builder.build()?;
674    let local_var_resp = local_var_client.execute(local_var_req).await?;
675
676    let local_var_status = local_var_resp.status();
677    let local_var_content = local_var_resp.text().await?;
678
679    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
680        Ok(())
681    } else {
682        let local_var_entity: Option<TeamsSlashAddOrUpdateRepoPermissionsLegacyError> = serde_json::from_str(&local_var_content).ok();
683        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
684        Err(Error::ResponseError(local_var_error))
685    }
686}
687
688/// Checks whether a team has `read`, `write`, or `admin` permissions for an organization project. The response includes projects inherited from a parent team.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
689pub async fn teams_slash_check_permissions_for_project_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, project_id: i32) -> Result<models::TeamProject, Error<TeamsSlashCheckPermissionsForProjectInOrgError>> {
690    let local_var_configuration = configuration;
691
692    let local_var_client = &local_var_configuration.client;
693
694    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/projects/{project_id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), project_id=project_id);
695    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
696
697    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
698        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
699    }
700
701    let local_var_req = local_var_req_builder.build()?;
702    let local_var_resp = local_var_client.execute(local_var_req).await?;
703
704    let local_var_status = local_var_resp.status();
705    let local_var_content = local_var_resp.text().await?;
706
707    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
708        serde_json::from_str(&local_var_content).map_err(Error::from)
709    } else {
710        let local_var_entity: Option<TeamsSlashCheckPermissionsForProjectInOrgError> = serde_json::from_str(&local_var_content).ok();
711        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
712        Err(Error::ResponseError(local_var_error))
713    }
714}
715
716/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a project](https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project) endpoint.  Checks whether a team has `read`, `write`, or `admin` permissions for an organization project. The response includes projects inherited from a parent team.
717pub async fn teams_slash_check_permissions_for_project_legacy(configuration: &configuration::Configuration, team_id: i32, project_id: i32) -> Result<models::TeamProject, Error<TeamsSlashCheckPermissionsForProjectLegacyError>> {
718    let local_var_configuration = configuration;
719
720    let local_var_client = &local_var_configuration.client;
721
722    let local_var_uri_str = format!("{}/teams/{team_id}/projects/{project_id}", local_var_configuration.base_path, team_id=team_id, project_id=project_id);
723    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
724
725    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
726        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
727    }
728
729    let local_var_req = local_var_req_builder.build()?;
730    let local_var_resp = local_var_client.execute(local_var_req).await?;
731
732    let local_var_status = local_var_resp.status();
733    let local_var_content = local_var_resp.text().await?;
734
735    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
736        serde_json::from_str(&local_var_content).map_err(Error::from)
737    } else {
738        let local_var_entity: Option<TeamsSlashCheckPermissionsForProjectLegacyError> = serde_json::from_str(&local_var_content).ok();
739        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
740        Err(Error::ResponseError(local_var_error))
741    }
742}
743
744/// Checks whether a team has `admin`, `push`, `maintain`, `triage`, or `pull` permission for a repository. Repositories inherited through a parent team will also be checked.  You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `application/vnd.github.v3.repository+json` accept header.  If a team doesn't have permission for the repository, you will receive a `404 Not Found` response status.  If the repository is private, you must have at least `read` permission for that repository, and your token must have the `repo` or `admin:org` scope. Otherwise, you will receive a `404 Not Found` response status.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.
745pub async fn teams_slash_check_permissions_for_repo_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, owner: &str, repo: &str) -> Result<models::TeamRepository, Error<TeamsSlashCheckPermissionsForRepoInOrgError>> {
746    let local_var_configuration = configuration;
747
748    let local_var_client = &local_var_configuration.client;
749
750    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
751    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
752
753    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
754        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
755    }
756
757    let local_var_req = local_var_req_builder.build()?;
758    let local_var_resp = local_var_client.execute(local_var_req).await?;
759
760    let local_var_status = local_var_resp.status();
761    let local_var_content = local_var_resp.text().await?;
762
763    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
764        serde_json::from_str(&local_var_content).map_err(Error::from)
765    } else {
766        let local_var_entity: Option<TeamsSlashCheckPermissionsForRepoInOrgError> = serde_json::from_str(&local_var_content).ok();
767        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
768        Err(Error::ResponseError(local_var_error))
769    }
770}
771
772/// **Note**: Repositories inherited through a parent team will also be checked.  **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a repository](https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository) endpoint.  You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `Accept` header:
773pub async fn teams_slash_check_permissions_for_repo_legacy(configuration: &configuration::Configuration, team_id: i32, owner: &str, repo: &str) -> Result<models::TeamRepository, Error<TeamsSlashCheckPermissionsForRepoLegacyError>> {
774    let local_var_configuration = configuration;
775
776    let local_var_client = &local_var_configuration.client;
777
778    let local_var_uri_str = format!("{}/teams/{team_id}/repos/{owner}/{repo}", local_var_configuration.base_path, team_id=team_id, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
779    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
780
781    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
782        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
783    }
784
785    let local_var_req = local_var_req_builder.build()?;
786    let local_var_resp = local_var_client.execute(local_var_req).await?;
787
788    let local_var_status = local_var_resp.status();
789    let local_var_content = local_var_resp.text().await?;
790
791    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
792        serde_json::from_str(&local_var_content).map_err(Error::from)
793    } else {
794        let local_var_entity: Option<TeamsSlashCheckPermissionsForRepoLegacyError> = serde_json::from_str(&local_var_content).ok();
795        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
796        Err(Error::ResponseError(local_var_error))
797    }
798}
799
800/// To create a team, the authenticated user must be a member or owner of `{org}`. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see \"[Setting team creation permissions](https://docs.github.com/articles/setting-team-creation-permissions-in-your-organization).\"  When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of `maintainers`. For more information, see \"[About teams](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/about-teams)\".
801pub async fn teams_slash_create(configuration: &configuration::Configuration, org: &str, teams_create_request: models::TeamsCreateRequest) -> Result<models::TeamFull, Error<TeamsSlashCreateError>> {
802    let local_var_configuration = configuration;
803
804    let local_var_client = &local_var_configuration.client;
805
806    let local_var_uri_str = format!("{}/orgs/{org}/teams", local_var_configuration.base_path, org=crate::apis::urlencode(org));
807    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
808
809    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
810        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
811    }
812    local_var_req_builder = local_var_req_builder.json(&teams_create_request);
813
814    let local_var_req = local_var_req_builder.build()?;
815    let local_var_resp = local_var_client.execute(local_var_req).await?;
816
817    let local_var_status = local_var_resp.status();
818    let local_var_content = local_var_resp.text().await?;
819
820    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
821        serde_json::from_str(&local_var_content).map_err(Error::from)
822    } else {
823        let local_var_entity: Option<TeamsSlashCreateError> = serde_json::from_str(&local_var_content).ok();
824        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
825        Err(Error::ResponseError(local_var_error))
826    }
827}
828
829/// Creates a new comment on a team discussion.  This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see \"[Rate limits for the API](https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits)\" and \"[Best practices for using the REST API](https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api).\"  **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments`.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
830pub async fn teams_slash_create_discussion_comment_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, teams_create_discussion_comment_in_org_request: models::TeamsCreateDiscussionCommentInOrgRequest) -> Result<models::TeamDiscussionComment, Error<TeamsSlashCreateDiscussionCommentInOrgError>> {
831    let local_var_configuration = configuration;
832
833    let local_var_client = &local_var_configuration.client;
834
835    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number);
836    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
837
838    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
839        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
840    }
841    local_var_req_builder = local_var_req_builder.json(&teams_create_discussion_comment_in_org_request);
842
843    let local_var_req = local_var_req_builder.build()?;
844    let local_var_resp = local_var_client.execute(local_var_req).await?;
845
846    let local_var_status = local_var_resp.status();
847    let local_var_content = local_var_resp.text().await?;
848
849    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
850        serde_json::from_str(&local_var_content).map_err(Error::from)
851    } else {
852        let local_var_entity: Option<TeamsSlashCreateDiscussionCommentInOrgError> = serde_json::from_str(&local_var_content).ok();
853        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
854        Err(Error::ResponseError(local_var_error))
855    }
856}
857
858/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Create a discussion comment](https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment) endpoint.  Creates a new comment on a team discussion.  This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see \"[Rate limits for the API](https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits)\" and \"[Best practices for using the REST API](https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api).\"  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
859pub async fn teams_slash_create_discussion_comment_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, teams_create_discussion_comment_in_org_request: models::TeamsCreateDiscussionCommentInOrgRequest) -> Result<models::TeamDiscussionComment, Error<TeamsSlashCreateDiscussionCommentLegacyError>> {
860    let local_var_configuration = configuration;
861
862    let local_var_client = &local_var_configuration.client;
863
864    let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/comments", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number);
865    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
866
867    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
868        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
869    }
870    local_var_req_builder = local_var_req_builder.json(&teams_create_discussion_comment_in_org_request);
871
872    let local_var_req = local_var_req_builder.build()?;
873    let local_var_resp = local_var_client.execute(local_var_req).await?;
874
875    let local_var_status = local_var_resp.status();
876    let local_var_content = local_var_resp.text().await?;
877
878    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
879        serde_json::from_str(&local_var_content).map_err(Error::from)
880    } else {
881        let local_var_entity: Option<TeamsSlashCreateDiscussionCommentLegacyError> = serde_json::from_str(&local_var_content).ok();
882        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
883        Err(Error::ResponseError(local_var_error))
884    }
885}
886
887/// Creates a new discussion post on a team's page.  This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see \"[Rate limits for the API](https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits)\" and \"[Best practices for using the REST API](https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api).\"  **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/{org_id}/team/{team_id}/discussions`.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
888pub async fn teams_slash_create_discussion_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, teams_create_discussion_in_org_request: models::TeamsCreateDiscussionInOrgRequest) -> Result<models::TeamDiscussion, Error<TeamsSlashCreateDiscussionInOrgError>> {
889    let local_var_configuration = configuration;
890
891    let local_var_client = &local_var_configuration.client;
892
893    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
894    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
895
896    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
897        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
898    }
899    local_var_req_builder = local_var_req_builder.json(&teams_create_discussion_in_org_request);
900
901    let local_var_req = local_var_req_builder.build()?;
902    let local_var_resp = local_var_client.execute(local_var_req).await?;
903
904    let local_var_status = local_var_resp.status();
905    let local_var_content = local_var_resp.text().await?;
906
907    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
908        serde_json::from_str(&local_var_content).map_err(Error::from)
909    } else {
910        let local_var_entity: Option<TeamsSlashCreateDiscussionInOrgError> = serde_json::from_str(&local_var_content).ok();
911        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
912        Err(Error::ResponseError(local_var_error))
913    }
914}
915
916/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`Create a discussion`](https://docs.github.com/rest/teams/discussions#create-a-discussion) endpoint.  Creates a new discussion post on a team's page.  This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see \"[Rate limits for the API](https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits)\" and \"[Best practices for using the REST API](https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api).\"  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
917pub async fn teams_slash_create_discussion_legacy(configuration: &configuration::Configuration, team_id: i32, teams_create_discussion_in_org_request: models::TeamsCreateDiscussionInOrgRequest) -> Result<models::TeamDiscussion, Error<TeamsSlashCreateDiscussionLegacyError>> {
918    let local_var_configuration = configuration;
919
920    let local_var_client = &local_var_configuration.client;
921
922    let local_var_uri_str = format!("{}/teams/{team_id}/discussions", local_var_configuration.base_path, team_id=team_id);
923    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
924
925    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
926        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
927    }
928    local_var_req_builder = local_var_req_builder.json(&teams_create_discussion_in_org_request);
929
930    let local_var_req = local_var_req_builder.build()?;
931    let local_var_resp = local_var_client.execute(local_var_req).await?;
932
933    let local_var_status = local_var_resp.status();
934    let local_var_content = local_var_resp.text().await?;
935
936    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
937        serde_json::from_str(&local_var_content).map_err(Error::from)
938    } else {
939        let local_var_entity: Option<TeamsSlashCreateDiscussionLegacyError> = serde_json::from_str(&local_var_content).ok();
940        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
941        Err(Error::ResponseError(local_var_error))
942    }
943}
944
945/// Deletes a comment on a team discussion.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
946pub async fn teams_slash_delete_discussion_comment_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32) -> Result<(), Error<TeamsSlashDeleteDiscussionCommentInOrgError>> {
947    let local_var_configuration = configuration;
948
949    let local_var_client = &local_var_configuration.client;
950
951    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number, comment_number=comment_number);
952    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
953
954    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
955        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
956    }
957
958    let local_var_req = local_var_req_builder.build()?;
959    let local_var_resp = local_var_client.execute(local_var_req).await?;
960
961    let local_var_status = local_var_resp.status();
962    let local_var_content = local_var_resp.text().await?;
963
964    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
965        Ok(())
966    } else {
967        let local_var_entity: Option<TeamsSlashDeleteDiscussionCommentInOrgError> = serde_json::from_str(&local_var_content).ok();
968        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
969        Err(Error::ResponseError(local_var_error))
970    }
971}
972
973/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a discussion comment](https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment) endpoint.  Deletes a comment on a team discussion.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
974pub async fn teams_slash_delete_discussion_comment_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, comment_number: i32) -> Result<(), Error<TeamsSlashDeleteDiscussionCommentLegacyError>> {
975    let local_var_configuration = configuration;
976
977    let local_var_client = &local_var_configuration.client;
978
979    let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number, comment_number=comment_number);
980    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
981
982    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
983        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
984    }
985
986    let local_var_req = local_var_req_builder.build()?;
987    let local_var_resp = local_var_client.execute(local_var_req).await?;
988
989    let local_var_status = local_var_resp.status();
990    let local_var_content = local_var_resp.text().await?;
991
992    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
993        Ok(())
994    } else {
995        let local_var_entity: Option<TeamsSlashDeleteDiscussionCommentLegacyError> = serde_json::from_str(&local_var_content).ok();
996        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
997        Err(Error::ResponseError(local_var_error))
998    }
999}
1000
1001/// Delete a discussion from a team's page.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
1002pub async fn teams_slash_delete_discussion_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32) -> Result<(), Error<TeamsSlashDeleteDiscussionInOrgError>> {
1003    let local_var_configuration = configuration;
1004
1005    let local_var_client = &local_var_configuration.client;
1006
1007    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number);
1008    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1009
1010    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1011        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1012    }
1013
1014    let local_var_req = local_var_req_builder.build()?;
1015    let local_var_resp = local_var_client.execute(local_var_req).await?;
1016
1017    let local_var_status = local_var_resp.status();
1018    let local_var_content = local_var_resp.text().await?;
1019
1020    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1021        Ok(())
1022    } else {
1023        let local_var_entity: Option<TeamsSlashDeleteDiscussionInOrgError> = serde_json::from_str(&local_var_content).ok();
1024        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1025        Err(Error::ResponseError(local_var_error))
1026    }
1027}
1028
1029/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`Delete a discussion`](https://docs.github.com/rest/teams/discussions#delete-a-discussion) endpoint.  Delete a discussion from a team's page.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
1030pub async fn teams_slash_delete_discussion_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32) -> Result<(), Error<TeamsSlashDeleteDiscussionLegacyError>> {
1031    let local_var_configuration = configuration;
1032
1033    let local_var_client = &local_var_configuration.client;
1034
1035    let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number);
1036    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1037
1038    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1039        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1040    }
1041
1042    let local_var_req = local_var_req_builder.build()?;
1043    let local_var_resp = local_var_client.execute(local_var_req).await?;
1044
1045    let local_var_status = local_var_resp.status();
1046    let local_var_content = local_var_resp.text().await?;
1047
1048    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1049        Ok(())
1050    } else {
1051        let local_var_entity: Option<TeamsSlashDeleteDiscussionLegacyError> = serde_json::from_str(&local_var_content).ok();
1052        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1053        Err(Error::ResponseError(local_var_error))
1054    }
1055}
1056
1057/// To delete a team, the authenticated user must be an organization owner or team maintainer.  If you are an organization owner, deleting a parent team will delete all of its child teams as well.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}`.
1058pub async fn teams_slash_delete_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str) -> Result<(), Error<TeamsSlashDeleteInOrgError>> {
1059    let local_var_configuration = configuration;
1060
1061    let local_var_client = &local_var_configuration.client;
1062
1063    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
1064    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1065
1066    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1067        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1068    }
1069
1070    let local_var_req = local_var_req_builder.build()?;
1071    let local_var_resp = local_var_client.execute(local_var_req).await?;
1072
1073    let local_var_status = local_var_resp.status();
1074    let local_var_content = local_var_resp.text().await?;
1075
1076    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1077        Ok(())
1078    } else {
1079        let local_var_entity: Option<TeamsSlashDeleteInOrgError> = serde_json::from_str(&local_var_content).ok();
1080        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1081        Err(Error::ResponseError(local_var_error))
1082    }
1083}
1084
1085/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a team](https://docs.github.com/rest/teams/teams#delete-a-team) endpoint.  To delete a team, the authenticated user must be an organization owner or team maintainer.  If you are an organization owner, deleting a parent team will delete all of its child teams as well.
1086pub async fn teams_slash_delete_legacy(configuration: &configuration::Configuration, team_id: i32) -> Result<(), Error<TeamsSlashDeleteLegacyError>> {
1087    let local_var_configuration = configuration;
1088
1089    let local_var_client = &local_var_configuration.client;
1090
1091    let local_var_uri_str = format!("{}/teams/{team_id}", local_var_configuration.base_path, team_id=team_id);
1092    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1093
1094    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1095        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1096    }
1097
1098    let local_var_req = local_var_req_builder.build()?;
1099    let local_var_resp = local_var_client.execute(local_var_req).await?;
1100
1101    let local_var_status = local_var_resp.status();
1102    let local_var_content = local_var_resp.text().await?;
1103
1104    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1105        Ok(())
1106    } else {
1107        let local_var_entity: Option<TeamsSlashDeleteLegacyError> = serde_json::from_str(&local_var_content).ok();
1108        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1109        Err(Error::ResponseError(local_var_error))
1110    }
1111}
1112
1113/// Gets a team using the team's `slug`. To create the `slug`, GitHub replaces special characters in the `name` string, changes all words to lowercase, and replaces spaces with a `-` separator. For example, `\"My TEam Näme\"` would become `my-team-name`.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}`.
1114pub async fn teams_slash_get_by_name(configuration: &configuration::Configuration, org: &str, team_slug: &str) -> Result<models::TeamFull, Error<TeamsSlashGetByNameError>> {
1115    let local_var_configuration = configuration;
1116
1117    let local_var_client = &local_var_configuration.client;
1118
1119    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
1120    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1121
1122    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1123        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1124    }
1125
1126    let local_var_req = local_var_req_builder.build()?;
1127    let local_var_resp = local_var_client.execute(local_var_req).await?;
1128
1129    let local_var_status = local_var_resp.status();
1130    let local_var_content = local_var_resp.text().await?;
1131
1132    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1133        serde_json::from_str(&local_var_content).map_err(Error::from)
1134    } else {
1135        let local_var_entity: Option<TeamsSlashGetByNameError> = serde_json::from_str(&local_var_content).ok();
1136        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1137        Err(Error::ResponseError(local_var_error))
1138    }
1139}
1140
1141/// Get a specific comment on a team discussion.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.  OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
1142pub async fn teams_slash_get_discussion_comment_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32) -> Result<models::TeamDiscussionComment, Error<TeamsSlashGetDiscussionCommentInOrgError>> {
1143    let local_var_configuration = configuration;
1144
1145    let local_var_client = &local_var_configuration.client;
1146
1147    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number, comment_number=comment_number);
1148    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1149
1150    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1151        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1152    }
1153
1154    let local_var_req = local_var_req_builder.build()?;
1155    let local_var_resp = local_var_client.execute(local_var_req).await?;
1156
1157    let local_var_status = local_var_resp.status();
1158    let local_var_content = local_var_resp.text().await?;
1159
1160    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1161        serde_json::from_str(&local_var_content).map_err(Error::from)
1162    } else {
1163        let local_var_entity: Option<TeamsSlashGetDiscussionCommentInOrgError> = serde_json::from_str(&local_var_content).ok();
1164        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1165        Err(Error::ResponseError(local_var_error))
1166    }
1167}
1168
1169/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion comment](https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment) endpoint.  Get a specific comment on a team discussion.  OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
1170pub async fn teams_slash_get_discussion_comment_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, comment_number: i32) -> Result<models::TeamDiscussionComment, Error<TeamsSlashGetDiscussionCommentLegacyError>> {
1171    let local_var_configuration = configuration;
1172
1173    let local_var_client = &local_var_configuration.client;
1174
1175    let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number, comment_number=comment_number);
1176    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1177
1178    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1179        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1180    }
1181
1182    let local_var_req = local_var_req_builder.build()?;
1183    let local_var_resp = local_var_client.execute(local_var_req).await?;
1184
1185    let local_var_status = local_var_resp.status();
1186    let local_var_content = local_var_resp.text().await?;
1187
1188    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1189        serde_json::from_str(&local_var_content).map_err(Error::from)
1190    } else {
1191        let local_var_entity: Option<TeamsSlashGetDiscussionCommentLegacyError> = serde_json::from_str(&local_var_content).ok();
1192        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1193        Err(Error::ResponseError(local_var_error))
1194    }
1195}
1196
1197/// Get a specific discussion on a team's page.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.  OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
1198pub async fn teams_slash_get_discussion_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32) -> Result<models::TeamDiscussion, Error<TeamsSlashGetDiscussionInOrgError>> {
1199    let local_var_configuration = configuration;
1200
1201    let local_var_client = &local_var_configuration.client;
1202
1203    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number);
1204    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1205
1206    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1207        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1208    }
1209
1210    let local_var_req = local_var_req_builder.build()?;
1211    let local_var_resp = local_var_client.execute(local_var_req).await?;
1212
1213    let local_var_status = local_var_resp.status();
1214    let local_var_content = local_var_resp.text().await?;
1215
1216    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1217        serde_json::from_str(&local_var_content).map_err(Error::from)
1218    } else {
1219        let local_var_entity: Option<TeamsSlashGetDiscussionInOrgError> = serde_json::from_str(&local_var_content).ok();
1220        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1221        Err(Error::ResponseError(local_var_error))
1222    }
1223}
1224
1225/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion](https://docs.github.com/rest/teams/discussions#get-a-discussion) endpoint.  Get a specific discussion on a team's page.  OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
1226pub async fn teams_slash_get_discussion_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32) -> Result<models::TeamDiscussion, Error<TeamsSlashGetDiscussionLegacyError>> {
1227    let local_var_configuration = configuration;
1228
1229    let local_var_client = &local_var_configuration.client;
1230
1231    let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number);
1232    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1233
1234    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1235        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1236    }
1237
1238    let local_var_req = local_var_req_builder.build()?;
1239    let local_var_resp = local_var_client.execute(local_var_req).await?;
1240
1241    let local_var_status = local_var_resp.status();
1242    let local_var_content = local_var_resp.text().await?;
1243
1244    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1245        serde_json::from_str(&local_var_content).map_err(Error::from)
1246    } else {
1247        let local_var_entity: Option<TeamsSlashGetDiscussionLegacyError> = serde_json::from_str(&local_var_content).ok();
1248        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1249        Err(Error::ResponseError(local_var_error))
1250    }
1251}
1252
1253/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the [Get a team by name](https://docs.github.com/rest/teams/teams#get-a-team-by-name) endpoint.
1254pub async fn teams_slash_get_legacy(configuration: &configuration::Configuration, team_id: i32) -> Result<models::TeamFull, Error<TeamsSlashGetLegacyError>> {
1255    let local_var_configuration = configuration;
1256
1257    let local_var_client = &local_var_configuration.client;
1258
1259    let local_var_uri_str = format!("{}/teams/{team_id}", local_var_configuration.base_path, team_id=team_id);
1260    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1261
1262    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1263        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1264    }
1265
1266    let local_var_req = local_var_req_builder.build()?;
1267    let local_var_resp = local_var_client.execute(local_var_req).await?;
1268
1269    let local_var_status = local_var_resp.status();
1270    let local_var_content = local_var_resp.text().await?;
1271
1272    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1273        serde_json::from_str(&local_var_content).map_err(Error::from)
1274    } else {
1275        let local_var_entity: Option<TeamsSlashGetLegacyError> = serde_json::from_str(&local_var_content).ok();
1276        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1277        Err(Error::ResponseError(local_var_error))
1278    }
1279}
1280
1281/// The \"Get team member\" endpoint (described below) is deprecated.  We recommend using the [Get team membership for a user](https://docs.github.com/rest/teams/members#get-team-membership-for-a-user) endpoint instead. It allows you to get both active and pending memberships.  To list members in a team, the team must be visible to the authenticated user.
1282pub async fn teams_slash_get_member_legacy(configuration: &configuration::Configuration, team_id: i32, username: &str) -> Result<(), Error<TeamsSlashGetMemberLegacyError>> {
1283    let local_var_configuration = configuration;
1284
1285    let local_var_client = &local_var_configuration.client;
1286
1287    let local_var_uri_str = format!("{}/teams/{team_id}/members/{username}", local_var_configuration.base_path, team_id=team_id, username=crate::apis::urlencode(username));
1288    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1289
1290    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1291        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1292    }
1293
1294    let local_var_req = local_var_req_builder.build()?;
1295    let local_var_resp = local_var_client.execute(local_var_req).await?;
1296
1297    let local_var_status = local_var_resp.status();
1298    let local_var_content = local_var_resp.text().await?;
1299
1300    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1301        Ok(())
1302    } else {
1303        let local_var_entity: Option<TeamsSlashGetMemberLegacyError> = serde_json::from_str(&local_var_content).ok();
1304        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1305        Err(Error::ResponseError(local_var_error))
1306    }
1307}
1308
1309/// Team members will include the members of child teams.  To get a user's membership with a team, the team must be visible to the authenticated user.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/memberships/{username}`.  **Note:** The response contains the `state` of the membership and the member's `role`.  The `role` for organization owners is set to `maintainer`. For more information about `maintainer` roles, see [Create a team](https://docs.github.com/rest/teams/teams#create-a-team).
1310pub async fn teams_slash_get_membership_for_user_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, username: &str) -> Result<models::TeamMembership, Error<TeamsSlashGetMembershipForUserInOrgError>> {
1311    let local_var_configuration = configuration;
1312
1313    let local_var_client = &local_var_configuration.client;
1314
1315    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/memberships/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), username=crate::apis::urlencode(username));
1316    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1317
1318    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1319        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1320    }
1321
1322    let local_var_req = local_var_req_builder.build()?;
1323    let local_var_resp = local_var_client.execute(local_var_req).await?;
1324
1325    let local_var_status = local_var_resp.status();
1326    let local_var_content = local_var_resp.text().await?;
1327
1328    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1329        serde_json::from_str(&local_var_content).map_err(Error::from)
1330    } else {
1331        let local_var_entity: Option<TeamsSlashGetMembershipForUserInOrgError> = serde_json::from_str(&local_var_content).ok();
1332        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1333        Err(Error::ResponseError(local_var_error))
1334    }
1335}
1336
1337/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get team membership for a user](https://docs.github.com/rest/teams/members#get-team-membership-for-a-user) endpoint.  Team members will include the members of child teams.  To get a user's membership with a team, the team must be visible to the authenticated user.  **Note:** The response contains the `state` of the membership and the member's `role`.  The `role` for organization owners is set to `maintainer`. For more information about `maintainer` roles, see [Create a team](https://docs.github.com/rest/teams/teams#create-a-team).
1338pub async fn teams_slash_get_membership_for_user_legacy(configuration: &configuration::Configuration, team_id: i32, username: &str) -> Result<models::TeamMembership, Error<TeamsSlashGetMembershipForUserLegacyError>> {
1339    let local_var_configuration = configuration;
1340
1341    let local_var_client = &local_var_configuration.client;
1342
1343    let local_var_uri_str = format!("{}/teams/{team_id}/memberships/{username}", local_var_configuration.base_path, team_id=team_id, username=crate::apis::urlencode(username));
1344    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1345
1346    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1347        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1348    }
1349
1350    let local_var_req = local_var_req_builder.build()?;
1351    let local_var_resp = local_var_client.execute(local_var_req).await?;
1352
1353    let local_var_status = local_var_resp.status();
1354    let local_var_content = local_var_resp.text().await?;
1355
1356    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1357        serde_json::from_str(&local_var_content).map_err(Error::from)
1358    } else {
1359        let local_var_entity: Option<TeamsSlashGetMembershipForUserLegacyError> = serde_json::from_str(&local_var_content).ok();
1360        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1361        Err(Error::ResponseError(local_var_error))
1362    }
1363}
1364
1365/// Lists all teams in an organization that are visible to the authenticated user.
1366pub async fn teams_slash_list(configuration: &configuration::Configuration, org: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Team>, Error<TeamsSlashListError>> {
1367    let local_var_configuration = configuration;
1368
1369    let local_var_client = &local_var_configuration.client;
1370
1371    let local_var_uri_str = format!("{}/orgs/{org}/teams", local_var_configuration.base_path, org=crate::apis::urlencode(org));
1372    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1373
1374    if let Some(ref local_var_str) = per_page {
1375        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1376    }
1377    if let Some(ref local_var_str) = page {
1378        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1379    }
1380    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1381        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1382    }
1383
1384    let local_var_req = local_var_req_builder.build()?;
1385    let local_var_resp = local_var_client.execute(local_var_req).await?;
1386
1387    let local_var_status = local_var_resp.status();
1388    let local_var_content = local_var_resp.text().await?;
1389
1390    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1391        serde_json::from_str(&local_var_content).map_err(Error::from)
1392    } else {
1393        let local_var_entity: Option<TeamsSlashListError> = serde_json::from_str(&local_var_content).ok();
1394        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1395        Err(Error::ResponseError(local_var_error))
1396    }
1397}
1398
1399/// Lists the child teams of the team specified by `{team_slug}`.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/teams`.
1400pub async fn teams_slash_list_child_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Team>, Error<TeamsSlashListChildInOrgError>> {
1401    let local_var_configuration = configuration;
1402
1403    let local_var_client = &local_var_configuration.client;
1404
1405    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/teams", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
1406    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1407
1408    if let Some(ref local_var_str) = per_page {
1409        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1410    }
1411    if let Some(ref local_var_str) = page {
1412        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1413    }
1414    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1415        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1416    }
1417
1418    let local_var_req = local_var_req_builder.build()?;
1419    let local_var_resp = local_var_client.execute(local_var_req).await?;
1420
1421    let local_var_status = local_var_resp.status();
1422    let local_var_content = local_var_resp.text().await?;
1423
1424    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1425        serde_json::from_str(&local_var_content).map_err(Error::from)
1426    } else {
1427        let local_var_entity: Option<TeamsSlashListChildInOrgError> = serde_json::from_str(&local_var_content).ok();
1428        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1429        Err(Error::ResponseError(local_var_error))
1430    }
1431}
1432
1433/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List child teams`](https://docs.github.com/rest/teams/teams#list-child-teams) endpoint.
1434pub async fn teams_slash_list_child_legacy(configuration: &configuration::Configuration, team_id: i32, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Team>, Error<TeamsSlashListChildLegacyError>> {
1435    let local_var_configuration = configuration;
1436
1437    let local_var_client = &local_var_configuration.client;
1438
1439    let local_var_uri_str = format!("{}/teams/{team_id}/teams", local_var_configuration.base_path, team_id=team_id);
1440    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1441
1442    if let Some(ref local_var_str) = per_page {
1443        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1444    }
1445    if let Some(ref local_var_str) = page {
1446        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1447    }
1448    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1449        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1450    }
1451
1452    let local_var_req = local_var_req_builder.build()?;
1453    let local_var_resp = local_var_client.execute(local_var_req).await?;
1454
1455    let local_var_status = local_var_resp.status();
1456    let local_var_content = local_var_resp.text().await?;
1457
1458    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1459        serde_json::from_str(&local_var_content).map_err(Error::from)
1460    } else {
1461        let local_var_entity: Option<TeamsSlashListChildLegacyError> = serde_json::from_str(&local_var_content).ok();
1462        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1463        Err(Error::ResponseError(local_var_error))
1464    }
1465}
1466
1467/// List all comments on a team discussion.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments`.  OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
1468pub async fn teams_slash_list_discussion_comments_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, direction: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::TeamDiscussionComment>, Error<TeamsSlashListDiscussionCommentsInOrgError>> {
1469    let local_var_configuration = configuration;
1470
1471    let local_var_client = &local_var_configuration.client;
1472
1473    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number);
1474    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1475
1476    if let Some(ref local_var_str) = direction {
1477        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
1478    }
1479    if let Some(ref local_var_str) = per_page {
1480        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1481    }
1482    if let Some(ref local_var_str) = page {
1483        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1484    }
1485    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1486        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1487    }
1488
1489    let local_var_req = local_var_req_builder.build()?;
1490    let local_var_resp = local_var_client.execute(local_var_req).await?;
1491
1492    let local_var_status = local_var_resp.status();
1493    let local_var_content = local_var_resp.text().await?;
1494
1495    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1496        serde_json::from_str(&local_var_content).map_err(Error::from)
1497    } else {
1498        let local_var_entity: Option<TeamsSlashListDiscussionCommentsInOrgError> = serde_json::from_str(&local_var_content).ok();
1499        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1500        Err(Error::ResponseError(local_var_error))
1501    }
1502}
1503
1504/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List discussion comments](https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments) endpoint.  List all comments on a team discussion.  OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
1505pub async fn teams_slash_list_discussion_comments_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, direction: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::TeamDiscussionComment>, Error<TeamsSlashListDiscussionCommentsLegacyError>> {
1506    let local_var_configuration = configuration;
1507
1508    let local_var_client = &local_var_configuration.client;
1509
1510    let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/comments", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number);
1511    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1512
1513    if let Some(ref local_var_str) = direction {
1514        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
1515    }
1516    if let Some(ref local_var_str) = per_page {
1517        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1518    }
1519    if let Some(ref local_var_str) = page {
1520        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1521    }
1522    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1523        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1524    }
1525
1526    let local_var_req = local_var_req_builder.build()?;
1527    let local_var_resp = local_var_client.execute(local_var_req).await?;
1528
1529    let local_var_status = local_var_resp.status();
1530    let local_var_content = local_var_resp.text().await?;
1531
1532    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1533        serde_json::from_str(&local_var_content).map_err(Error::from)
1534    } else {
1535        let local_var_entity: Option<TeamsSlashListDiscussionCommentsLegacyError> = serde_json::from_str(&local_var_content).ok();
1536        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1537        Err(Error::ResponseError(local_var_error))
1538    }
1539}
1540
1541/// List all discussions on a team's page.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions`.  OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
1542pub async fn teams_slash_list_discussions_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, direction: Option<&str>, per_page: Option<i32>, page: Option<i32>, pinned: Option<&str>) -> Result<Vec<models::TeamDiscussion>, Error<TeamsSlashListDiscussionsInOrgError>> {
1543    let local_var_configuration = configuration;
1544
1545    let local_var_client = &local_var_configuration.client;
1546
1547    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
1548    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1549
1550    if let Some(ref local_var_str) = direction {
1551        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
1552    }
1553    if let Some(ref local_var_str) = per_page {
1554        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1555    }
1556    if let Some(ref local_var_str) = page {
1557        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1558    }
1559    if let Some(ref local_var_str) = pinned {
1560        local_var_req_builder = local_var_req_builder.query(&[("pinned", &local_var_str.to_string())]);
1561    }
1562    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1563        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1564    }
1565
1566    let local_var_req = local_var_req_builder.build()?;
1567    let local_var_resp = local_var_client.execute(local_var_req).await?;
1568
1569    let local_var_status = local_var_resp.status();
1570    let local_var_content = local_var_resp.text().await?;
1571
1572    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1573        serde_json::from_str(&local_var_content).map_err(Error::from)
1574    } else {
1575        let local_var_entity: Option<TeamsSlashListDiscussionsInOrgError> = serde_json::from_str(&local_var_content).ok();
1576        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1577        Err(Error::ResponseError(local_var_error))
1578    }
1579}
1580
1581/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List discussions`](https://docs.github.com/rest/teams/discussions#list-discussions) endpoint.  List all discussions on a team's page.  OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
1582pub async fn teams_slash_list_discussions_legacy(configuration: &configuration::Configuration, team_id: i32, direction: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::TeamDiscussion>, Error<TeamsSlashListDiscussionsLegacyError>> {
1583    let local_var_configuration = configuration;
1584
1585    let local_var_client = &local_var_configuration.client;
1586
1587    let local_var_uri_str = format!("{}/teams/{team_id}/discussions", local_var_configuration.base_path, team_id=team_id);
1588    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1589
1590    if let Some(ref local_var_str) = direction {
1591        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
1592    }
1593    if let Some(ref local_var_str) = per_page {
1594        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1595    }
1596    if let Some(ref local_var_str) = page {
1597        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1598    }
1599    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1600        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1601    }
1602
1603    let local_var_req = local_var_req_builder.build()?;
1604    let local_var_resp = local_var_client.execute(local_var_req).await?;
1605
1606    let local_var_status = local_var_resp.status();
1607    let local_var_content = local_var_resp.text().await?;
1608
1609    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1610        serde_json::from_str(&local_var_content).map_err(Error::from)
1611    } else {
1612        let local_var_entity: Option<TeamsSlashListDiscussionsLegacyError> = serde_json::from_str(&local_var_content).ok();
1613        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1614        Err(Error::ResponseError(local_var_error))
1615    }
1616}
1617
1618/// List all of the teams across all of the organizations to which the authenticated user belongs.  OAuth app tokens and personal access tokens (classic) need the `user`, `repo`, or `read:org` scope to use this endpoint.  When using a fine-grained personal access token, the resource owner of the token must be a single organization, and the response will only include the teams from that organization.
1619pub async fn teams_slash_list_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::TeamFull>, Error<TeamsSlashListForAuthenticatedUserError>> {
1620    let local_var_configuration = configuration;
1621
1622    let local_var_client = &local_var_configuration.client;
1623
1624    let local_var_uri_str = format!("{}/user/teams", local_var_configuration.base_path);
1625    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1626
1627    if let Some(ref local_var_str) = per_page {
1628        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1629    }
1630    if let Some(ref local_var_str) = page {
1631        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1632    }
1633    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1634        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1635    }
1636
1637    let local_var_req = local_var_req_builder.build()?;
1638    let local_var_resp = local_var_client.execute(local_var_req).await?;
1639
1640    let local_var_status = local_var_resp.status();
1641    let local_var_content = local_var_resp.text().await?;
1642
1643    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1644        serde_json::from_str(&local_var_content).map_err(Error::from)
1645    } else {
1646        let local_var_entity: Option<TeamsSlashListForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1647        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1648        Err(Error::ResponseError(local_var_error))
1649    }
1650}
1651
1652/// Team members will include the members of child teams.  To list members in a team, the team must be visible to the authenticated user.
1653pub async fn teams_slash_list_members_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, role: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SimpleUser>, Error<TeamsSlashListMembersInOrgError>> {
1654    let local_var_configuration = configuration;
1655
1656    let local_var_client = &local_var_configuration.client;
1657
1658    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/members", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
1659    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1660
1661    if let Some(ref local_var_str) = role {
1662        local_var_req_builder = local_var_req_builder.query(&[("role", &local_var_str.to_string())]);
1663    }
1664    if let Some(ref local_var_str) = per_page {
1665        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1666    }
1667    if let Some(ref local_var_str) = page {
1668        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1669    }
1670    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1671        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1672    }
1673
1674    let local_var_req = local_var_req_builder.build()?;
1675    let local_var_resp = local_var_client.execute(local_var_req).await?;
1676
1677    let local_var_status = local_var_resp.status();
1678    let local_var_content = local_var_resp.text().await?;
1679
1680    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1681        serde_json::from_str(&local_var_content).map_err(Error::from)
1682    } else {
1683        let local_var_entity: Option<TeamsSlashListMembersInOrgError> = serde_json::from_str(&local_var_content).ok();
1684        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1685        Err(Error::ResponseError(local_var_error))
1686    }
1687}
1688
1689/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List team members`](https://docs.github.com/rest/teams/members#list-team-members) endpoint.  Team members will include the members of child teams.
1690pub async fn teams_slash_list_members_legacy(configuration: &configuration::Configuration, team_id: i32, role: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SimpleUser>, Error<TeamsSlashListMembersLegacyError>> {
1691    let local_var_configuration = configuration;
1692
1693    let local_var_client = &local_var_configuration.client;
1694
1695    let local_var_uri_str = format!("{}/teams/{team_id}/members", local_var_configuration.base_path, team_id=team_id);
1696    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1697
1698    if let Some(ref local_var_str) = role {
1699        local_var_req_builder = local_var_req_builder.query(&[("role", &local_var_str.to_string())]);
1700    }
1701    if let Some(ref local_var_str) = per_page {
1702        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1703    }
1704    if let Some(ref local_var_str) = page {
1705        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1706    }
1707    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1708        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1709    }
1710
1711    let local_var_req = local_var_req_builder.build()?;
1712    let local_var_resp = local_var_client.execute(local_var_req).await?;
1713
1714    let local_var_status = local_var_resp.status();
1715    let local_var_content = local_var_resp.text().await?;
1716
1717    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1718        serde_json::from_str(&local_var_content).map_err(Error::from)
1719    } else {
1720        let local_var_entity: Option<TeamsSlashListMembersLegacyError> = serde_json::from_str(&local_var_content).ok();
1721        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1722        Err(Error::ResponseError(local_var_error))
1723    }
1724}
1725
1726/// The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/invitations`.
1727pub async fn teams_slash_list_pending_invitations_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::OrganizationInvitation>, Error<TeamsSlashListPendingInvitationsInOrgError>> {
1728    let local_var_configuration = configuration;
1729
1730    let local_var_client = &local_var_configuration.client;
1731
1732    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/invitations", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
1733    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1734
1735    if let Some(ref local_var_str) = per_page {
1736        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1737    }
1738    if let Some(ref local_var_str) = page {
1739        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1740    }
1741    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1742        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1743    }
1744
1745    let local_var_req = local_var_req_builder.build()?;
1746    let local_var_resp = local_var_client.execute(local_var_req).await?;
1747
1748    let local_var_status = local_var_resp.status();
1749    let local_var_content = local_var_resp.text().await?;
1750
1751    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1752        serde_json::from_str(&local_var_content).map_err(Error::from)
1753    } else {
1754        let local_var_entity: Option<TeamsSlashListPendingInvitationsInOrgError> = serde_json::from_str(&local_var_content).ok();
1755        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1756        Err(Error::ResponseError(local_var_error))
1757    }
1758}
1759
1760/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List pending team invitations`](https://docs.github.com/rest/teams/members#list-pending-team-invitations) endpoint.  The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`.
1761pub async fn teams_slash_list_pending_invitations_legacy(configuration: &configuration::Configuration, team_id: i32, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::OrganizationInvitation>, Error<TeamsSlashListPendingInvitationsLegacyError>> {
1762    let local_var_configuration = configuration;
1763
1764    let local_var_client = &local_var_configuration.client;
1765
1766    let local_var_uri_str = format!("{}/teams/{team_id}/invitations", local_var_configuration.base_path, team_id=team_id);
1767    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1768
1769    if let Some(ref local_var_str) = per_page {
1770        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1771    }
1772    if let Some(ref local_var_str) = page {
1773        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1774    }
1775    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1776        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1777    }
1778
1779    let local_var_req = local_var_req_builder.build()?;
1780    let local_var_resp = local_var_client.execute(local_var_req).await?;
1781
1782    let local_var_status = local_var_resp.status();
1783    let local_var_content = local_var_resp.text().await?;
1784
1785    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1786        serde_json::from_str(&local_var_content).map_err(Error::from)
1787    } else {
1788        let local_var_entity: Option<TeamsSlashListPendingInvitationsLegacyError> = serde_json::from_str(&local_var_content).ok();
1789        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1790        Err(Error::ResponseError(local_var_error))
1791    }
1792}
1793
1794/// Lists the organization projects for a team.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/projects`.
1795pub async fn teams_slash_list_projects_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::TeamProject>, Error<TeamsSlashListProjectsInOrgError>> {
1796    let local_var_configuration = configuration;
1797
1798    let local_var_client = &local_var_configuration.client;
1799
1800    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/projects", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
1801    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1802
1803    if let Some(ref local_var_str) = per_page {
1804        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1805    }
1806    if let Some(ref local_var_str) = page {
1807        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1808    }
1809    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1810        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1811    }
1812
1813    let local_var_req = local_var_req_builder.build()?;
1814    let local_var_resp = local_var_client.execute(local_var_req).await?;
1815
1816    let local_var_status = local_var_resp.status();
1817    let local_var_content = local_var_resp.text().await?;
1818
1819    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1820        serde_json::from_str(&local_var_content).map_err(Error::from)
1821    } else {
1822        let local_var_entity: Option<TeamsSlashListProjectsInOrgError> = serde_json::from_str(&local_var_content).ok();
1823        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1824        Err(Error::ResponseError(local_var_error))
1825    }
1826}
1827
1828/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List team projects`](https://docs.github.com/rest/teams/teams#list-team-projects) endpoint.  Lists the organization projects for a team.
1829pub async fn teams_slash_list_projects_legacy(configuration: &configuration::Configuration, team_id: i32, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::TeamProject>, Error<TeamsSlashListProjectsLegacyError>> {
1830    let local_var_configuration = configuration;
1831
1832    let local_var_client = &local_var_configuration.client;
1833
1834    let local_var_uri_str = format!("{}/teams/{team_id}/projects", local_var_configuration.base_path, team_id=team_id);
1835    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1836
1837    if let Some(ref local_var_str) = per_page {
1838        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1839    }
1840    if let Some(ref local_var_str) = page {
1841        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1842    }
1843    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1844        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1845    }
1846
1847    let local_var_req = local_var_req_builder.build()?;
1848    let local_var_resp = local_var_client.execute(local_var_req).await?;
1849
1850    let local_var_status = local_var_resp.status();
1851    let local_var_content = local_var_resp.text().await?;
1852
1853    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1854        serde_json::from_str(&local_var_content).map_err(Error::from)
1855    } else {
1856        let local_var_entity: Option<TeamsSlashListProjectsLegacyError> = serde_json::from_str(&local_var_content).ok();
1857        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1858        Err(Error::ResponseError(local_var_error))
1859    }
1860}
1861
1862/// Lists a team's repositories visible to the authenticated user.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos`.
1863pub async fn teams_slash_list_repos_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::MinimalRepository>, Error<TeamsSlashListReposInOrgError>> {
1864    let local_var_configuration = configuration;
1865
1866    let local_var_client = &local_var_configuration.client;
1867
1868    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/repos", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
1869    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1870
1871    if let Some(ref local_var_str) = per_page {
1872        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1873    }
1874    if let Some(ref local_var_str) = page {
1875        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1876    }
1877    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1878        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1879    }
1880
1881    let local_var_req = local_var_req_builder.build()?;
1882    let local_var_resp = local_var_client.execute(local_var_req).await?;
1883
1884    let local_var_status = local_var_resp.status();
1885    let local_var_content = local_var_resp.text().await?;
1886
1887    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1888        serde_json::from_str(&local_var_content).map_err(Error::from)
1889    } else {
1890        let local_var_entity: Option<TeamsSlashListReposInOrgError> = serde_json::from_str(&local_var_content).ok();
1891        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1892        Err(Error::ResponseError(local_var_error))
1893    }
1894}
1895
1896/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List team repositories](https://docs.github.com/rest/teams/teams#list-team-repositories) endpoint.
1897pub async fn teams_slash_list_repos_legacy(configuration: &configuration::Configuration, team_id: i32, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::MinimalRepository>, Error<TeamsSlashListReposLegacyError>> {
1898    let local_var_configuration = configuration;
1899
1900    let local_var_client = &local_var_configuration.client;
1901
1902    let local_var_uri_str = format!("{}/teams/{team_id}/repos", local_var_configuration.base_path, team_id=team_id);
1903    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1904
1905    if let Some(ref local_var_str) = per_page {
1906        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1907    }
1908    if let Some(ref local_var_str) = page {
1909        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1910    }
1911    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1912        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1913    }
1914
1915    let local_var_req = local_var_req_builder.build()?;
1916    let local_var_resp = local_var_client.execute(local_var_req).await?;
1917
1918    let local_var_status = local_var_resp.status();
1919    let local_var_content = local_var_resp.text().await?;
1920
1921    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1922        serde_json::from_str(&local_var_content).map_err(Error::from)
1923    } else {
1924        let local_var_entity: Option<TeamsSlashListReposLegacyError> = serde_json::from_str(&local_var_content).ok();
1925        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1926        Err(Error::ResponseError(local_var_error))
1927    }
1928}
1929
1930/// The \"Remove team member\" endpoint (described below) is deprecated.  We recommend using the [Remove team membership for a user](https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user) endpoint instead. It allows you to remove both active and pending memberships.  Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.  To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team.  **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see \"[Synchronizing teams between your identity provider and GitHub](https://docs.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/).\"
1931pub async fn teams_slash_remove_member_legacy(configuration: &configuration::Configuration, team_id: i32, username: &str) -> Result<(), Error<TeamsSlashRemoveMemberLegacyError>> {
1932    let local_var_configuration = configuration;
1933
1934    let local_var_client = &local_var_configuration.client;
1935
1936    let local_var_uri_str = format!("{}/teams/{team_id}/members/{username}", local_var_configuration.base_path, team_id=team_id, username=crate::apis::urlencode(username));
1937    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1938
1939    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1940        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1941    }
1942
1943    let local_var_req = local_var_req_builder.build()?;
1944    let local_var_resp = local_var_client.execute(local_var_req).await?;
1945
1946    let local_var_status = local_var_resp.status();
1947    let local_var_content = local_var_resp.text().await?;
1948
1949    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1950        Ok(())
1951    } else {
1952        let local_var_entity: Option<TeamsSlashRemoveMemberLegacyError> = serde_json::from_str(&local_var_content).ok();
1953        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1954        Err(Error::ResponseError(local_var_error))
1955    }
1956}
1957
1958/// To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team.  Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.  **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see \"[Synchronizing teams between your identity provider and GitHub](https://docs.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/).\"  **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/memberships/{username}`.
1959pub async fn teams_slash_remove_membership_for_user_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, username: &str) -> Result<(), Error<TeamsSlashRemoveMembershipForUserInOrgError>> {
1960    let local_var_configuration = configuration;
1961
1962    let local_var_client = &local_var_configuration.client;
1963
1964    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/memberships/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), username=crate::apis::urlencode(username));
1965    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1966
1967    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1968        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1969    }
1970
1971    let local_var_req = local_var_req_builder.build()?;
1972    let local_var_resp = local_var_client.execute(local_var_req).await?;
1973
1974    let local_var_status = local_var_resp.status();
1975    let local_var_content = local_var_resp.text().await?;
1976
1977    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1978        Ok(())
1979    } else {
1980        let local_var_entity: Option<TeamsSlashRemoveMembershipForUserInOrgError> = serde_json::from_str(&local_var_content).ok();
1981        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1982        Err(Error::ResponseError(local_var_error))
1983    }
1984}
1985
1986/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove team membership for a user](https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user) endpoint.  Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.  To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team.  **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see \"[Synchronizing teams between your identity provider and GitHub](https://docs.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/).\"
1987pub async fn teams_slash_remove_membership_for_user_legacy(configuration: &configuration::Configuration, team_id: i32, username: &str) -> Result<(), Error<TeamsSlashRemoveMembershipForUserLegacyError>> {
1988    let local_var_configuration = configuration;
1989
1990    let local_var_client = &local_var_configuration.client;
1991
1992    let local_var_uri_str = format!("{}/teams/{team_id}/memberships/{username}", local_var_configuration.base_path, team_id=team_id, username=crate::apis::urlencode(username));
1993    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1994
1995    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1996        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1997    }
1998
1999    let local_var_req = local_var_req_builder.build()?;
2000    let local_var_resp = local_var_client.execute(local_var_req).await?;
2001
2002    let local_var_status = local_var_resp.status();
2003    let local_var_content = local_var_resp.text().await?;
2004
2005    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2006        Ok(())
2007    } else {
2008        let local_var_entity: Option<TeamsSlashRemoveMembershipForUserLegacyError> = serde_json::from_str(&local_var_content).ok();
2009        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2010        Err(Error::ResponseError(local_var_error))
2011    }
2012}
2013
2014/// Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have `read` access to both the team and project, or `admin` access to the team or project. This endpoint removes the project from the team, but does not delete the project.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
2015pub async fn teams_slash_remove_project_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, project_id: i32) -> Result<(), Error<TeamsSlashRemoveProjectInOrgError>> {
2016    let local_var_configuration = configuration;
2017
2018    let local_var_client = &local_var_configuration.client;
2019
2020    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/projects/{project_id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), project_id=project_id);
2021    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2022
2023    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2024        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2025    }
2026
2027    let local_var_req = local_var_req_builder.build()?;
2028    let local_var_resp = local_var_client.execute(local_var_req).await?;
2029
2030    let local_var_status = local_var_resp.status();
2031    let local_var_content = local_var_resp.text().await?;
2032
2033    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2034        Ok(())
2035    } else {
2036        let local_var_entity: Option<TeamsSlashRemoveProjectInOrgError> = serde_json::from_str(&local_var_content).ok();
2037        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2038        Err(Error::ResponseError(local_var_error))
2039    }
2040}
2041
2042/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a project from a team](https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team) endpoint.  Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have `read` access to both the team and project, or `admin` access to the team or project. **Note:** This endpoint removes the project from the team, but does not delete it.
2043pub async fn teams_slash_remove_project_legacy(configuration: &configuration::Configuration, team_id: i32, project_id: i32) -> Result<(), Error<TeamsSlashRemoveProjectLegacyError>> {
2044    let local_var_configuration = configuration;
2045
2046    let local_var_client = &local_var_configuration.client;
2047
2048    let local_var_uri_str = format!("{}/teams/{team_id}/projects/{project_id}", local_var_configuration.base_path, team_id=team_id, project_id=project_id);
2049    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2050
2051    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2052        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2053    }
2054
2055    let local_var_req = local_var_req_builder.build()?;
2056    let local_var_resp = local_var_client.execute(local_var_req).await?;
2057
2058    let local_var_status = local_var_resp.status();
2059    let local_var_content = local_var_resp.text().await?;
2060
2061    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2062        Ok(())
2063    } else {
2064        let local_var_entity: Option<TeamsSlashRemoveProjectLegacyError> = serde_json::from_str(&local_var_content).ok();
2065        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2066        Err(Error::ResponseError(local_var_error))
2067    }
2068}
2069
2070/// If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.
2071pub async fn teams_slash_remove_repo_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, owner: &str, repo: &str) -> Result<(), Error<TeamsSlashRemoveRepoInOrgError>> {
2072    let local_var_configuration = configuration;
2073
2074    let local_var_client = &local_var_configuration.client;
2075
2076    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
2077    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2078
2079    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2080        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2081    }
2082
2083    let local_var_req = local_var_req_builder.build()?;
2084    let local_var_resp = local_var_client.execute(local_var_req).await?;
2085
2086    let local_var_status = local_var_resp.status();
2087    let local_var_content = local_var_resp.text().await?;
2088
2089    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2090        Ok(())
2091    } else {
2092        let local_var_entity: Option<TeamsSlashRemoveRepoInOrgError> = serde_json::from_str(&local_var_content).ok();
2093        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2094        Err(Error::ResponseError(local_var_error))
2095    }
2096}
2097
2098/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a repository from a team](https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team) endpoint.  If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team.
2099pub async fn teams_slash_remove_repo_legacy(configuration: &configuration::Configuration, team_id: i32, owner: &str, repo: &str) -> Result<(), Error<TeamsSlashRemoveRepoLegacyError>> {
2100    let local_var_configuration = configuration;
2101
2102    let local_var_client = &local_var_configuration.client;
2103
2104    let local_var_uri_str = format!("{}/teams/{team_id}/repos/{owner}/{repo}", local_var_configuration.base_path, team_id=team_id, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
2105    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2106
2107    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2108        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2109    }
2110
2111    let local_var_req = local_var_req_builder.build()?;
2112    let local_var_resp = local_var_client.execute(local_var_req).await?;
2113
2114    let local_var_status = local_var_resp.status();
2115    let local_var_content = local_var_resp.text().await?;
2116
2117    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2118        Ok(())
2119    } else {
2120        let local_var_entity: Option<TeamsSlashRemoveRepoLegacyError> = serde_json::from_str(&local_var_content).ok();
2121        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2122        Err(Error::ResponseError(local_var_error))
2123    }
2124}
2125
2126/// Edits the body text of a discussion comment.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
2127pub async fn teams_slash_update_discussion_comment_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, teams_create_discussion_comment_in_org_request: models::TeamsCreateDiscussionCommentInOrgRequest) -> Result<models::TeamDiscussionComment, Error<TeamsSlashUpdateDiscussionCommentInOrgError>> {
2128    let local_var_configuration = configuration;
2129
2130    let local_var_client = &local_var_configuration.client;
2131
2132    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number, comment_number=comment_number);
2133    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2134
2135    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2136        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2137    }
2138    local_var_req_builder = local_var_req_builder.json(&teams_create_discussion_comment_in_org_request);
2139
2140    let local_var_req = local_var_req_builder.build()?;
2141    let local_var_resp = local_var_client.execute(local_var_req).await?;
2142
2143    let local_var_status = local_var_resp.status();
2144    let local_var_content = local_var_resp.text().await?;
2145
2146    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2147        serde_json::from_str(&local_var_content).map_err(Error::from)
2148    } else {
2149        let local_var_entity: Option<TeamsSlashUpdateDiscussionCommentInOrgError> = serde_json::from_str(&local_var_content).ok();
2150        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2151        Err(Error::ResponseError(local_var_error))
2152    }
2153}
2154
2155/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion comment](https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment) endpoint.  Edits the body text of a discussion comment.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
2156pub async fn teams_slash_update_discussion_comment_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, comment_number: i32, teams_create_discussion_comment_in_org_request: models::TeamsCreateDiscussionCommentInOrgRequest) -> Result<models::TeamDiscussionComment, Error<TeamsSlashUpdateDiscussionCommentLegacyError>> {
2157    let local_var_configuration = configuration;
2158
2159    let local_var_client = &local_var_configuration.client;
2160
2161    let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number, comment_number=comment_number);
2162    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2163
2164    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2165        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2166    }
2167    local_var_req_builder = local_var_req_builder.json(&teams_create_discussion_comment_in_org_request);
2168
2169    let local_var_req = local_var_req_builder.build()?;
2170    let local_var_resp = local_var_client.execute(local_var_req).await?;
2171
2172    let local_var_status = local_var_resp.status();
2173    let local_var_content = local_var_resp.text().await?;
2174
2175    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2176        serde_json::from_str(&local_var_content).map_err(Error::from)
2177    } else {
2178        let local_var_entity: Option<TeamsSlashUpdateDiscussionCommentLegacyError> = serde_json::from_str(&local_var_content).ok();
2179        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2180        Err(Error::ResponseError(local_var_error))
2181    }
2182}
2183
2184/// Edits the title and body text of a discussion post. Only the parameters you provide are updated.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
2185pub async fn teams_slash_update_discussion_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, teams_update_discussion_in_org_request: Option<models::TeamsUpdateDiscussionInOrgRequest>) -> Result<models::TeamDiscussion, Error<TeamsSlashUpdateDiscussionInOrgError>> {
2186    let local_var_configuration = configuration;
2187
2188    let local_var_client = &local_var_configuration.client;
2189
2190    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number);
2191    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2192
2193    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2194        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2195    }
2196    local_var_req_builder = local_var_req_builder.json(&teams_update_discussion_in_org_request);
2197
2198    let local_var_req = local_var_req_builder.build()?;
2199    let local_var_resp = local_var_client.execute(local_var_req).await?;
2200
2201    let local_var_status = local_var_resp.status();
2202    let local_var_content = local_var_resp.text().await?;
2203
2204    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2205        serde_json::from_str(&local_var_content).map_err(Error::from)
2206    } else {
2207        let local_var_entity: Option<TeamsSlashUpdateDiscussionInOrgError> = serde_json::from_str(&local_var_content).ok();
2208        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2209        Err(Error::ResponseError(local_var_error))
2210    }
2211}
2212
2213/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion](https://docs.github.com/rest/teams/discussions#update-a-discussion) endpoint.  Edits the title and body text of a discussion post. Only the parameters you provide are updated.  OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
2214pub async fn teams_slash_update_discussion_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, teams_update_discussion_in_org_request: Option<models::TeamsUpdateDiscussionInOrgRequest>) -> Result<models::TeamDiscussion, Error<TeamsSlashUpdateDiscussionLegacyError>> {
2215    let local_var_configuration = configuration;
2216
2217    let local_var_client = &local_var_configuration.client;
2218
2219    let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number);
2220    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2221
2222    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2223        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2224    }
2225    local_var_req_builder = local_var_req_builder.json(&teams_update_discussion_in_org_request);
2226
2227    let local_var_req = local_var_req_builder.build()?;
2228    let local_var_resp = local_var_client.execute(local_var_req).await?;
2229
2230    let local_var_status = local_var_resp.status();
2231    let local_var_content = local_var_resp.text().await?;
2232
2233    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2234        serde_json::from_str(&local_var_content).map_err(Error::from)
2235    } else {
2236        let local_var_entity: Option<TeamsSlashUpdateDiscussionLegacyError> = serde_json::from_str(&local_var_content).ok();
2237        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2238        Err(Error::ResponseError(local_var_error))
2239    }
2240}
2241
2242/// To edit a team, the authenticated user must either be an organization owner or a team maintainer.  **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}`.
2243pub async fn teams_slash_update_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, teams_update_in_org_request: Option<models::TeamsUpdateInOrgRequest>) -> Result<models::TeamFull, Error<TeamsSlashUpdateInOrgError>> {
2244    let local_var_configuration = configuration;
2245
2246    let local_var_client = &local_var_configuration.client;
2247
2248    let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug));
2249    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2250
2251    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2252        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2253    }
2254    local_var_req_builder = local_var_req_builder.json(&teams_update_in_org_request);
2255
2256    let local_var_req = local_var_req_builder.build()?;
2257    let local_var_resp = local_var_client.execute(local_var_req).await?;
2258
2259    let local_var_status = local_var_resp.status();
2260    let local_var_content = local_var_resp.text().await?;
2261
2262    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2263        serde_json::from_str(&local_var_content).map_err(Error::from)
2264    } else {
2265        let local_var_entity: Option<TeamsSlashUpdateInOrgError> = serde_json::from_str(&local_var_content).ok();
2266        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2267        Err(Error::ResponseError(local_var_error))
2268    }
2269}
2270
2271/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a team](https://docs.github.com/rest/teams/teams#update-a-team) endpoint.  To edit a team, the authenticated user must either be an organization owner or a team maintainer.  **Note:** With nested teams, the `privacy` for parent teams cannot be `secret`.
2272pub async fn teams_slash_update_legacy(configuration: &configuration::Configuration, team_id: i32, teams_update_legacy_request: models::TeamsUpdateLegacyRequest) -> Result<models::TeamFull, Error<TeamsSlashUpdateLegacyError>> {
2273    let local_var_configuration = configuration;
2274
2275    let local_var_client = &local_var_configuration.client;
2276
2277    let local_var_uri_str = format!("{}/teams/{team_id}", local_var_configuration.base_path, team_id=team_id);
2278    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2279
2280    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2281        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2282    }
2283    local_var_req_builder = local_var_req_builder.json(&teams_update_legacy_request);
2284
2285    let local_var_req = local_var_req_builder.build()?;
2286    let local_var_resp = local_var_client.execute(local_var_req).await?;
2287
2288    let local_var_status = local_var_resp.status();
2289    let local_var_content = local_var_resp.text().await?;
2290
2291    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2292        serde_json::from_str(&local_var_content).map_err(Error::from)
2293    } else {
2294        let local_var_entity: Option<TeamsSlashUpdateLegacyError> = serde_json::from_str(&local_var_content).ok();
2295        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2296        Err(Error::ResponseError(local_var_error))
2297    }
2298}
2299