Edits history of script submission #3746 for ' Search for filters (jira)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Search for filters
     * Returns a [paginated](#pagination) list of filters.
     */
    export async function main(
      auth: Jira,
      filterName: string | undefined,
      accountId: string | undefined,
      owner: string | undefined,
      groupname: string | undefined,
      groupId: string | undefined,
      projectId: string | undefined,
      id: string | undefined,
      orderBy:
        | "description"
        | "-description"
        | "+description"
        | "favourite_count"
        | "-favourite_count"
        | "+favourite_count"
        | "id"
        | "-id"
        | "+id"
        | "is_favourite"
        | "-is_favourite"
        | "+is_favourite"
        | "name"
        | "-name"
        | "+name"
        | "owner"
        | "-owner"
        | "+owner"
        | "is_shared"
        | "-is_shared"
        | "+is_shared"
        | undefined,
      startAt: string | undefined,
      maxResults: string | undefined,
      expand: string | undefined,
      overrideSharePermissions: string | undefined
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/filter/search`
      );
      for (const [k, v] of [
        ["filterName", filterName],
        ["accountId", accountId],
        ["owner", owner],
        ["groupname", groupname],
        ["groupId", groupId],
        ["projectId", projectId],
        ["id", id],
        ["orderBy", orderBy],
        ["startAt", startAt],
        ["maxResults", maxResults],
        ["expand", expand],
        ["overrideSharePermissions", overrideSharePermissions],
      ]) {
        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 396 days ago

  • nativets
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Search for filters
     * Returns a [paginated](#pagination) list of filters.
     */
    export async function main(
      auth: Jira,
      filterName: string | undefined,
      accountId: string | undefined,
      owner: string | undefined,
      groupname: string | undefined,
      groupId: string | undefined,
      projectId: string | undefined,
      id: string | undefined,
      orderBy:
        | "description"
        | "-description"
        | "+description"
        | "favourite_count"
        | "-favourite_count"
        | "+favourite_count"
        | "id"
        | "-id"
        | "+id"
        | "is_favourite"
        | "-is_favourite"
        | "+is_favourite"
        | "name"
        | "-name"
        | "+name"
        | "owner"
        | "-owner"
        | "+owner"
        | "is_shared"
        | "-is_shared"
        | "+is_shared"
        | undefined,
      startAt: string | undefined,
      maxResults: string | undefined,
      expand: string | undefined,
      overrideSharePermissions: string | undefined
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/filter/search`
      );
      for (const [k, v] of [
        ["filterName", filterName],
        ["accountId", accountId],
        ["owner", owner],
        ["groupname", groupname],
        ["groupId", groupId],
        ["projectId", projectId],
        ["id", id],
        ["orderBy", orderBy],
        ["startAt", startAt],
        ["maxResults", maxResults],
        ["expand", expand],
        ["overrideSharePermissions", overrideSharePermissions],
      ]) {
        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 948 days ago