Edits history of script submission #23326 for ' Get Send-As Alias (gmail)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get Send-As Alias
     * Get one send-as alias (display name, reply-to, signature, `isDefault`, `verificationStatus`) by its email address. Requires gmail.readonly, gmail.modify or gmail.settings.basic on the connection.
     */
    export async function main(auth: RT.Gmail, send_as_email: string) {
      const response = await fetch(
        `https://gmail.googleapis.com/gmail/v1/users/me/settings/sendAs/${encodeURIComponent(send_as_email)}`,
        {
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
        }
      )
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 6 hours ago