Struct octocrab::teams::TeamHandler
source · pub struct TeamHandler<'octo> { /* private fields */ }
Expand description
Handler for GitHub’s teams API.
Created with Octocrab::teams
.
Implementations§
source§impl<'octo> TeamHandler<'octo>
impl<'octo> TeamHandler<'octo>
sourcepub fn list(&self) -> ListTeamsBuilder<'_, '_>
pub fn list(&self) -> ListTeamsBuilder<'_, '_>
Lists teams in the organization.
let teams = octocrab::instance()
.teams("owner")
.list()
.per_page(10)
.page(1u8)
.send()
.await?;
sourcepub async fn get(&self, team_slug: impl Into<String>) -> Result<Team>
pub async fn get(&self, team_slug: impl Into<String>) -> Result<Team>
Gets a team from its slug.
let team = octocrab::instance()
.teams("owner")
.get("team")
.await?;
sourcepub fn create(
&self,
name: impl Into<String>
) -> CreateTeamBuilder<'_, '_, '_, '_>
pub fn create( &self, name: impl Into<String> ) -> CreateTeamBuilder<'_, '_, '_, '_>
Creates a new team in the organization.
use octocrab::params;
octocrab::instance()
.teams("owner")
.create("new-team")
.description("My team created from Octocrab!")
.maintainers(&vec![String::from("ferris")])
.repo_names(&vec![String::from("crab-stuff")])
.privacy(params::teams::Privacy::Closed)
.parent_team_id(1u64.into())
.send()
.await?;
sourcepub fn edit(
&self,
team_slug: impl Into<String>,
name: impl Into<String>
) -> EditTeamBuilder<'_, '_>
pub fn edit( &self, team_slug: impl Into<String>, name: impl Into<String> ) -> EditTeamBuilder<'_, '_>
Creates a new team in the organization.
use octocrab::params;
octocrab::instance()
.teams("owner")
.edit("some-team", "Some Team")
.description("I edited from Octocrab!")
.privacy(params::teams::Privacy::Secret)
.parent_team_id(2u64.into())
.send()
.await?;
sourcepub async fn delete(&self, team_slug: impl Into<String>) -> Result<()>
pub async fn delete(&self, team_slug: impl Into<String>) -> Result<()>
Deletes a team from the organization.
octocrab::instance().teams("owner").delete("some-team").await?;
sourcepub fn list_children(
&self,
team_slug: impl Into<String>
) -> ListChildTeamsBuilder<'_, '_>
pub fn list_children( &self, team_slug: impl Into<String> ) -> ListChildTeamsBuilder<'_, '_>
List the child teams of a team in the organization.
octocrab::instance()
.teams("owner")
.list_children("parent-team")
.per_page(5)
.page(1u8)
.send()
.await?;
sourcepub fn repos(&self, team_slug: impl Into<String>) -> TeamRepoHandler<'_>
pub fn repos(&self, team_slug: impl Into<String>) -> TeamRepoHandler<'_>
Creates a new TeamRepoHandler
for the specified team,
that allows you to manage this team’s repositories.
sourcepub fn members(
&self,
team_slug: impl Into<String>
) -> ListTeamMembersBuilder<'_, '_>
pub fn members( &self, team_slug: impl Into<String> ) -> ListTeamMembersBuilder<'_, '_>
List the members of a team in the organization.
octocrab::instance()
.teams("owner")
.members("team-name-here")
.per_page(5)
.page(1u8)
.send()
.await?;
sourcepub fn invitations(
&self,
team_slug: impl Into<String>
) -> ListTeamInvitationsBuilder<'_, '_>
pub fn invitations( &self, team_slug: impl Into<String> ) -> ListTeamInvitationsBuilder<'_, '_>
List the pending invitations for a team in an organization.
octocrab::instance()
.teams("owner")
.invitations("team-name-here")
.per_page(5)
.page(1u8)
.send()
.await?;
Auto Trait Implementations§
impl<'octo> Freeze for TeamHandler<'octo>
impl<'octo> !RefUnwindSafe for TeamHandler<'octo>
impl<'octo> Send for TeamHandler<'octo>
impl<'octo> Sync for TeamHandler<'octo>
impl<'octo> Unpin for TeamHandler<'octo>
impl<'octo> !UnwindSafe for TeamHandler<'octo>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more