Edits history of script submission #14722 for ' Edit Guest On Workspace (clickup)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Clickup = {
      token: string;
    };
    /**
     * Edit Guest On Workspace
     * Configure options for a guest. \
     \
    ***Note:** This endpoint is only available to Workspaces on our [Enterprise Plan](https://clickup.com/pricing).*
     */
    export async function main(
      auth: Clickup,
      team_id: string,
      guest_id: string,
      body: {
        can_see_points_estimated?: false | true;
        can_edit_tags?: false | true;
        can_see_time_spent?: false | true;
        can_see_time_estimated?: false | true;
        can_create_views?: false | true;
        custom_role_id?: number;
      },
    ) {
      const url = new URL(
        `https://api.clickup.com/api/v2/team/${team_id}/guest/${guest_id}`,
      );
    
      const response = await fetch(url, {
        method: "PUT",
        headers: {
          "Content-Type": "application/json",
          Authorization: auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago