Edits history of script submission #4129 for ' Show Compliance Deletion Statuses (zendesk)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Zendesk = {
      username: string;
      password: string;
      subdomain: string;
    };
    /**
     * Show Compliance Deletion Statuses
     * Returns the GDPR status for each user per area of compliance. A Zendesk area of compliance is typically a product like "support/explore" but can be more fine-grained for areas within the product lines.
    
    If the user is not in the account, the request returns a 404 status.
    
    ```http
    Status: 404
    {
      "error":"RecordNotFound",
      "description":"Not found"
    }
    ```
    
    #### Allowed For
    
    * Agents, with restrictions
    
     */
    export async function main(
      auth: Zendesk,
      user_id: string,
      application: string | undefined
    ) {
      const url = new URL(
        `https://${auth.subdomain}.zendesk.com/api/v2/users/${user_id}/compliance_deletion_statuses`
      );
      for (const [k, v] of [["application", application]]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 377 days ago

  • nativets
    type Zendesk = {
      username: string;
      password: string;
      subdomain: string;
    };
    /**
     * Show Compliance Deletion Statuses
     * Returns the GDPR status for each user per area of compliance. A Zendesk area of compliance is typically a product like "support/explore" but can be more fine-grained for areas within the product lines.
    
    If the user is not in the account, the request returns a 404 status.
    
    ```http
    Status: 404
    {
      "error":"RecordNotFound",
      "description":"Not found"
    }
    ```
    
    #### Allowed For
    
    * Agents, with restrictions
    
     */
    export async function main(
      auth: Zendesk,
      user_id: string,
      application: string | undefined
    ) {
      const url = new URL(
        `https://${auth.subdomain}.zendesk.com/api/v2/users/${user_id}/compliance_deletion_statuses`
      );
      for (const [k, v] of [["application", application]]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 923 days ago