Edits history of script submission #19982 for ' Update a tag (salesflare)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Salesflare = {
      apiKey: string;
    };
    /**
     * Update a tag
     *
     */
    export async function main(auth: Salesflare, tag_id: string) {
      const url = new URL(`https://api.salesflare.com/tags/${tag_id}`);
    
      const response = await fetch(url, {
        method: "PUT",
        headers: {
          Authorization: "Bearer " + auth.apiKey,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 235 days ago