@forge/events
v0.9.6
Published
Forge Async Event methods
Downloads
5,587
Keywords
Readme
Library for asynchronous data processing.
Usage example:
import fetch, { RequestInit } from 'node-fetch';
import { Queue } from './index';
const API_BASE = 'https://api.atlassian.com';
// For Async service auth
const appContextAri = 'ari:cloud:jira::site/...';
const token = '...';
async function apiClient(path: string, init: RequestInit): Promise<APIResponse> {
const url = API_BASE + path;
const extraHeaders = {
// See add-forge-user-agent.ts
'X-Forge-Context': appContextAri,
Authorization: `Bearer ${token}`
};
init.headers = Object.assign(init.headers!, extraHeaders);
return fetch(url, init);
}
async function demo() {
const queue = new Queue({key: "queue-name"}, apiClient);
const payloads = {
page: 1
}
await queue.push([payloads])
}
demo();