Edits history of script submission #3443 for ' Create version (jira)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Create version
     * Creates a project version.
    
    This operation can be accessed anonymously.
    
    **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) or *Administer Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project the version is added to.
     */
    export async function main(
      auth: Jira,
      body: {
        approvers?: {
          accountId?: string;
          declineReason?: string;
          description?: string;
          status?: string;
          [k: string]: unknown;
        }[];
        archived?: boolean;
        description?: string;
        driver?: string;
        expand?: string;
        id?: string;
        issuesStatusForFixVersion?: {
          done?: number;
          inProgress?: number;
          toDo?: number;
          unmapped?: number;
          [k: string]: unknown;
        };
        moveUnfixedIssuesTo?: string;
        name?: string;
        operations?: {
          href?: string;
          iconClass?: string;
          id?: string;
          label?: string;
          styleClass?: string;
          title?: string;
          weight?: number;
        }[];
        overdue?: boolean;
        project?: string;
        projectId?: number;
        releaseDate?: string;
        released?: boolean;
        self?: string;
        startDate?: string;
        userReleaseDate?: string;
        userStartDate?: string;
      }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/version`
      );
    
      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.json();
    }
    

    Submitted by hugo697 396 days ago

  • nativets
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Create version
     * Creates a project version.
    
    This operation can be accessed anonymously.
    
    **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) or *Administer Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project the version is added to.
     */
    export async function main(
      auth: Jira,
      body: {
        approvers?: {
          accountId?: string;
          declineReason?: string;
          description?: string;
          status?: string;
          [k: string]: unknown;
        }[];
        archived?: boolean;
        description?: string;
        driver?: string;
        expand?: string;
        id?: string;
        issuesStatusForFixVersion?: {
          done?: number;
          inProgress?: number;
          toDo?: number;
          unmapped?: number;
          [k: string]: unknown;
        };
        moveUnfixedIssuesTo?: string;
        name?: string;
        operations?: {
          href?: string;
          iconClass?: string;
          id?: string;
          label?: string;
          styleClass?: string;
          title?: string;
          weight?: number;
        }[];
        overdue?: boolean;
        project?: string;
        projectId?: number;
        releaseDate?: string;
        released?: boolean;
        self?: string;
        startDate?: string;
        userReleaseDate?: string;
        userStartDate?: string;
      }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/version`
      );
    
      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.json();
    }
    

    Submitted by hugo697 948 days ago