Edits history of script submission #22306 for ' List Recipients (docusign)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * List Recipients
     * List recipients of an envelope along with their current signing status and optional tabs.
     */
    export async function main(
      auth: RT.Docusign,
      envelope_id: string,
      include_tabs: boolean | undefined,
      include_extended: boolean | undefined,
    ) {
      const url = new URL(
        `${auth.base_uri}/restapi/v2.1/accounts/${auth.account_id}/envelopes/${envelope_id}/recipients`,
      )
      if (include_tabs !== undefined) {
        url.searchParams.append("include_tabs", String(include_tabs))
      }
      if (include_extended !== undefined) {
        url.searchParams.append("include_extended", String(include_extended))
      }
    
      const response = await fetch(url, {
        method: "GET",
        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 22 days ago