Edits history of script submission #3583 for ' Reset columns (jira)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Reset columns
     * Reset the user's column configuration for the filter to the default.
    
    **[Permissions](#permissions) required:** Permission to access Jira, however, columns are only reset for:
    
     *  filters owned by the user.
     *  filters shared with a group that the user is a member of.
     *  filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for.
     *  filters shared with a public project.
     *  filters shared with the public.
     */
    export async function main(auth: Jira, id: string) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/filter/${id}/columns`
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        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.text();
    }
    

    Submitted by hugo697 396 days ago

  • nativets
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Reset columns
     * Reset the user's column configuration for the filter to the default.
    
    **[Permissions](#permissions) required:** Permission to access Jira, however, columns are only reset for:
    
     *  filters owned by the user.
     *  filters shared with a group that the user is a member of.
     *  filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for.
     *  filters shared with a public project.
     *  filters shared with the public.
     */
    export async function main(auth: Jira, id: string) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/filter/${id}/columns`
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        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.text();
    }
    

    Submitted by hugo697 948 days ago