pub async fn add_or_update_membership(
        &self,
        username: impl AsRef<str>,
        role: Option<crate::params::orgs::Role>,
    ) -> crate::Result<crate::models::orgs::MembershipInvitation> {
        let url = format!(
            "orgs/{org}/memberships/{username}",
            org = self.owner,
            username = username.as_ref(),
        );

        let body = role.map(|role| serde_json::json!({ "role": role }));

        self.crab.post(url, body.as_ref()).await
    }
/// Add or update organization membership
///
/// **Note**
/// - Only authenticated organization owners can add a member to the
///   organization or update the member's role.
/// - If the authenticated user is adding a member to the organization, the
///   invited user will receive an email inviting them to the organization.
///   The user's membership status will be pending until they accept
///   the invitation.
/// - Authenticated users can update a user's membership by passing the role
///   parameter. If the authenticated user changes a member's role to admin,
///   the affected user will receive an email notifying them that they've
///   been made an organization owner. If the authenticated user changes an
///   owner's role to member, no email will be sent.
/// ```no_run
/// # async fn run() -> octocrab::Result<()> {
/// # let octocrab = octocrab::Octocrab::default();
/// let invitation = octocrab.orgs("owner").add_or_update_membership("ferris", None).await?;
/// # Ok(())
/// # }
/// ```
Add or update organization membership
Note
Only authenticated organization owners can add a member to the
organization or update the member's role.
If the authenticated user is adding a member to the organization, the
invited user will receive an email inviting them to the organization.
The user's membership status will be pending until they accept
the invitation.
Authenticated users can update a user's membership by passing the role
parameter. If the authenticated user changes a member's role to admin,
the affected user will receive an email notifying them that they've
been made an organization owner. If the authenticated user changes an
owner's role to member, no email will be sent.
Add or update organization membership Note Only authenticated organization owners can add a member to the organization or update the member ' s role . If the authenticated user is adding a member to the organization the invited user will receive an email inviting them to the organization . The user ' s membership status will be pending until they accept the invitation . Authenticated users can update a user ' s membership by passing the role parameter . If the authenticated user changes a member ' s role to admin the affected user will receive an email notifying them that they ' ve been made an organization owner . If the authenticated user changes an owner ' s role to member no email will be sent .
pub async fn add_or_update_membership(
        &self,
        username: impl AsRef<str>,
        role: Option<crate::params::orgs::Role>,
    ) -> crate::Result<crate::models::orgs::MembershipInvitation> {
        let url = format!(
            "orgs/{org}/memberships/{username}",
            org = self.owner,
            username = username.as_ref(),
        );
        let body = role.map(|role| serde_json::json!({ "role": role }));
        self.crab.post(url, body.as_ref()).await
    }
pub async fn add_or_update_membership ( & self , username : impl AsRef < str > , role : Option < crate :: params :: orgs :: Role > , ) -> crate :: Result < crate :: models :: orgs :: MembershipInvitation > { let url = format ! ( " " org self owner username username as_ref ( ) ) ; let body = role . map ( | role | serde_json :: json ! ( { " " role } ) ) ; self . crab . post ( url , body . as_ref ( ) ) . await }
Add or update organization membership
Note
 Only authenticated organization owners can add a member to the
organization or update the member's role.
Add or update organization membership Note Only authenticated organization owners can add a member to the organization or update the member ' s role .
&self
username
impl AsRef<str>
role
Option<crate::params::orgs::Role>
&self
username
impl AsRef<str>
role
Option<crate::params::orgs::Role>
async fn run() -> octocrab::result<()> {
None
let octocrab = octocrab::octocrab::default();
let invitation = octocrab.orgs("owner").add_or_update_membership("ferris", None).await?.
let invitation = octocrab . orgs ( " owner " ) . add_or_update_membership ( " ferris " None ) . await? .
ok(())
None
}
None