Edits history of script submission #3079 for ' Get a Member (trello)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Trello = {
      key: string;
      token: string;
    };
    /**
     * Get a Member
     * Get a member
     */
    export async function main(
      auth: Trello,
      id: string,
      actions: string | undefined,
      boards: string | undefined,
      boardBackgrounds:
        | "all"
        | "custom"
        | "default"
        | "none"
        | "premium"
        | undefined,
      boardsInvited:
        | "closed"
        | "members"
        | "open"
        | "organization"
        | "pinned"
        | "public"
        | "starred"
        | "unpinned"
        | undefined,
      boardsInvited_fields:
        | "id"
        | "name"
        | "desc"
        | "descData"
        | "closed"
        | "idMemberCreator"
        | "idOrganization"
        | "pinned"
        | "url"
        | "shortUrl"
        | "prefs"
        | "labelNames"
        | "starred"
        | "limits"
        | "memberships"
        | "enterpriseOwned"
        | undefined,
      boardStars: string | undefined,
      cards: string | undefined,
      customBoardBackgrounds: "all" | "none" | undefined,
      customEmoji: "all" | "none" | undefined,
      customStickers: "all" | "none" | undefined,
      fields: "id" | undefined,
      notifications: string | undefined,
      organizations: "all" | "members" | "none" | "public" | undefined,
      organization_fields: "id" | "name" | undefined,
      organization_paid_account: string | undefined,
      organizationsInvited: "all" | "members" | "none" | "public" | undefined,
      organizationsInvited_fields: "id" | "name" | undefined,
      paid_account: string | undefined,
      savedSearches: string | undefined,
      tokens: "all" | "none" | undefined
    ) {
      const url = new URL(`https://api.trello.com/1/members/${id}`);
      for (const [k, v] of [
        ["actions", actions],
        ["boards", boards],
        ["boardBackgrounds", boardBackgrounds],
        ["boardsInvited", boardsInvited],
        ["boardsInvited_fields", boardsInvited_fields],
        ["boardStars", boardStars],
        ["cards", cards],
        ["customBoardBackgrounds", customBoardBackgrounds],
        ["customEmoji", customEmoji],
        ["customStickers", customStickers],
        ["fields", fields],
        ["notifications", notifications],
        ["organizations", organizations],
        ["organization_fields", organization_fields],
        ["organization_paid_account", organization_paid_account],
        ["organizationsInvited", organizationsInvited],
        ["organizationsInvited_fields", organizationsInvited_fields],
        ["paid_account", paid_account],
        ["savedSearches", savedSearches],
        ["tokens", tokens],
        ["key", auth.key],
        ["token", auth.token],
      ]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: undefined,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 399 days ago

  • nativets
    type Trello = {
      key: string;
      token: string;
    };
    /**
     * Get a Member
     * Get a member
     */
    export async function main(
      auth: Trello,
      id: string,
      actions: string | undefined,
      boards: string | undefined,
      boardBackgrounds:
        | "all"
        | "custom"
        | "default"
        | "none"
        | "premium"
        | undefined,
      boardsInvited:
        | "closed"
        | "members"
        | "open"
        | "organization"
        | "pinned"
        | "public"
        | "starred"
        | "unpinned"
        | undefined,
      boardsInvited_fields:
        | "id"
        | "name"
        | "desc"
        | "descData"
        | "closed"
        | "idMemberCreator"
        | "idOrganization"
        | "pinned"
        | "url"
        | "shortUrl"
        | "prefs"
        | "labelNames"
        | "starred"
        | "limits"
        | "memberships"
        | "enterpriseOwned"
        | undefined,
      boardStars: string | undefined,
      cards: string | undefined,
      customBoardBackgrounds: "all" | "none" | undefined,
      customEmoji: "all" | "none" | undefined,
      customStickers: "all" | "none" | undefined,
      fields: "id" | undefined,
      notifications: string | undefined,
      organizations: "all" | "members" | "none" | "public" | undefined,
      organization_fields: "id" | "name" | undefined,
      organization_paid_account: string | undefined,
      organizationsInvited: "all" | "members" | "none" | "public" | undefined,
      organizationsInvited_fields: "id" | "name" | undefined,
      paid_account: string | undefined,
      savedSearches: string | undefined,
      tokens: "all" | "none" | undefined
    ) {
      const url = new URL(`https://api.trello.com/1/members/${id}`);
      for (const [k, v] of [
        ["actions", actions],
        ["boards", boards],
        ["boardBackgrounds", boardBackgrounds],
        ["boardsInvited", boardsInvited],
        ["boardsInvited_fields", boardsInvited_fields],
        ["boardStars", boardStars],
        ["cards", cards],
        ["customBoardBackgrounds", customBoardBackgrounds],
        ["customEmoji", customEmoji],
        ["customStickers", customStickers],
        ["fields", fields],
        ["notifications", notifications],
        ["organizations", organizations],
        ["organization_fields", organization_fields],
        ["organization_paid_account", organization_paid_account],
        ["organizationsInvited", organizationsInvited],
        ["organizationsInvited_fields", organizationsInvited_fields],
        ["paid_account", paid_account],
        ["savedSearches", savedSearches],
        ["tokens", tokens],
        ["key", auth.key],
        ["token", auth.token],
      ]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: undefined,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 953 days ago