Edits history of script submission #3561 for ' Set user default columns (jira)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Set user default columns
     * Sets the default [ issue table columns](https://confluence.
     */
    export async function main(
      auth: Jira,
      accountId: string | undefined,
      body: { columns?: string[] }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/user/columns`
      );
      for (const [k, v] of [["accountId", accountId]]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const formData = new FormData();
      for (const [k, v] of Object.entries(body)) {
        if (v !== undefined && v !== "") {
          formData.append(k, String(v));
        }
      }
      const response = await fetch(url, {
        method: "PUT",
        headers: {
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: formData,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 396 days ago

  • nativets
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Set user default columns
     * Sets the default [ issue table columns](https://confluence.
     */
    export async function main(
      auth: Jira,
      accountId: string | undefined,
      body: { columns?: string[] }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/user/columns`
      );
      for (const [k, v] of [["accountId", accountId]]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const formData = new FormData();
      for (const [k, v] of Object.entries(body)) {
        if (v !== undefined && v !== "") {
          formData.append(k, String(v));
        }
      }
      const response = await fetch(url, {
        method: "PUT",
        headers: {
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: formData,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 823 days ago

  • nativets
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Set user default columns
     * Sets the default [ issue table columns](https://confluence.
     */
    export async function main(auth: Jira, accountId: string | undefined) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/user/columns`
      );
      for (const [k, v] of [["accountId", accountId]]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const response = await fetch(url, {
        method: "PUT",
        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 948 days ago