Edits history of script submission #2095 for ' Cancel an organization invitation (github)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Github = {
      token: string;
    };
    /**
     * Cancel an organization invitation
     * Cancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner.
    
    This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications).
     */
    export async function main(auth: Github, org: string, invitation_id: string) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/invitations/${invitation_id}`
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 367 days ago

  • nativets
    type Github = {
      token: string;
    };
    /**
     * Cancel an organization invitation
     * Cancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner.
    
    This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications).
     */
    export async function main(auth: Github, org: string, invitation_id: string) {
      const url = new URL(
        `https://api.github.com/orgs/${org}/invitations/${invitation_id}`
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 927 days ago