Class SrBase

Implements

Constructors

Properties

request: SrRequestFunction = ...

Request function for getting data from jira REST API

Documentation for Atlassian Jira Rest API

Example

const response = await SR.request('/rest/api/3/field');
console.log(`Response: ${response.status} ${response.statusText}`);
const result = await response.json();

Example

const response = await SR.request('/rest/api/3/field', {
headers: {
'Accept': 'application/json',
}
});
console.log(`Response: ${response.status} ${response.statusText}`);
const result = await response.json();

Methods

  • Replace default export PDF result with specifying “jsPDF” object for export. If set, this method replaces pdfmake export that’s used by default.

    Documentation for jsPDF

    Parameters

    • doc: unknown

    Returns void

    Example

    const doc = new jsPDF();
    doc.text("Hello world!", 10, 10);

    SR.pdfDoc(doc);
    // expected result: export to pdf default function will be replaced with
    // a new formatted document.
  • By default SR uses pdfmake library for export. You can configure PDF layout with specifying PDFmake configuration object (for example, page format, page margins, landscape/portrait mode, watermark, etc).

    Documentation for pdfmake

    Parameters

    Returns void

    Example

    SR.pdfOptions({
    pageOrientation: 'landscape',
    pageMargins: [20, 15, 20, 15],
    });
    // expected result: page orientation of pdf to be landscape
    // and margins [left, top, right, bottom] to be applied.
  • Pass script variables and the callback to the template engine. Based on the idea of expressions from the handlebars.

    Parameters

    Returns void

    Example

    SR.render({ doesWhat: "rocks!" });
    

    Example

    SR.render({}, () => {
    document.getElementById("element").innerHTML = 'Updated from callback';
    });
    // expected result: the text of the element with id 'element' must be replaced with 'Updated from callback'