Edits history of script submission #3383 for ' Bulk set issue properties by issue (jira)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Bulk set issue properties by issue
     * Sets or updates entity property values on issues.
     */
    export async function main(
      auth: Jira,
      body: {
        issues?: {
          issueID?: number;
          properties?: {
            [k: string]: {
              array?: boolean;
              bigDecimal?: boolean;
              bigInteger?: boolean;
              bigIntegerValue?: number;
              binary?: boolean;
              binaryValue?: string[];
              boolean?: boolean;
              booleanValue?: boolean;
              containerNode?: boolean;
              decimalValue?: number;
              double?: boolean;
              doubleValue?: number;
              elements?: { [k: string]: unknown };
              fieldNames?: { [k: string]: unknown };
              fields?: { [k: string]: unknown };
              floatingPointNumber?: boolean;
              int?: boolean;
              intValue?: number;
              integralNumber?: boolean;
              long?: boolean;
              longValue?: number;
              missingNode?: boolean;
              null?: boolean;
              number?: boolean;
              numberType?:
                | "INT"
                | "LONG"
                | "BIG_INTEGER"
                | "FLOAT"
                | "DOUBLE"
                | "BIG_DECIMAL";
              numberValue?: number;
              object?: boolean;
              pojo?: boolean;
              textValue?: string;
              textual?: boolean;
              valueAsBoolean?: boolean;
              valueAsDouble?: number;
              valueAsInt?: number;
              valueAsLong?: number;
              valueAsText?: string;
              valueNode?: boolean;
            };
          };
        }[];
      }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/issue/properties/multi`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: JSON.stringify(body),
      });
      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;
    };
    /**
     * Bulk set issue properties by issue
     * Sets or updates entity property values on issues.
     */
    export async function main(
      auth: Jira,
      body: {
        issues?: {
          issueID?: number;
          properties?: {
            [k: string]: {
              array?: boolean;
              bigDecimal?: boolean;
              bigInteger?: boolean;
              bigIntegerValue?: number;
              binary?: boolean;
              binaryValue?: string[];
              boolean?: boolean;
              booleanValue?: boolean;
              containerNode?: boolean;
              decimalValue?: number;
              double?: boolean;
              doubleValue?: number;
              elements?: { [k: string]: unknown };
              fieldNames?: { [k: string]: unknown };
              fields?: { [k: string]: unknown };
              floatingPointNumber?: boolean;
              int?: boolean;
              intValue?: number;
              integralNumber?: boolean;
              long?: boolean;
              longValue?: number;
              missingNode?: boolean;
              null?: boolean;
              number?: boolean;
              numberType?:
                | "INT"
                | "LONG"
                | "BIG_INTEGER"
                | "FLOAT"
                | "DOUBLE"
                | "BIG_DECIMAL";
              numberValue?: number;
              object?: boolean;
              pojo?: boolean;
              textValue?: string;
              textual?: boolean;
              valueAsBoolean?: boolean;
              valueAsDouble?: number;
              valueAsInt?: number;
              valueAsLong?: number;
              valueAsText?: string;
              valueNode?: boolean;
            };
          };
        }[];
      }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/issue/properties/multi`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 948 days ago