import * as Models from './models'; import * as Parameters from './parameters'; import { Callback } from '../callback'; import { Client } from '../clients'; import { RequestConfig } from '../requestConfig'; export class DynamicModules { constructor(private client: Client) {} /** * Returns all modules registered dynamically by the calling app. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Connect apps can make this request. */ async getModules(callback: Callback): Promise; /** * Returns all modules registered dynamically by the calling app. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Connect apps can make this request. */ async getModules(callback?: never): Promise; async getModules(callback?: Callback): Promise { const config: RequestConfig = { url: '/rest/atlassian-connect/1/app/module/dynamic', method: 'GET', }; return this.client.sendRequest(config, callback); } /** * Registers a list of modules. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Connect apps can make this request. */ async registerModules( parameters: Parameters.RegisterModules | undefined, callback: Callback, ): Promise; /** * Registers a list of modules. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Connect apps can make this request. */ async registerModules(parameters?: Parameters.RegisterModules, callback?: never): Promise; async registerModules( parameters?: Parameters.RegisterModules, callback?: Callback, ): Promise { const config: RequestConfig = { url: '/rest/atlassian-connect/1/app/module/dynamic', method: 'POST', data: { modules: parameters?.modules, }, }; return this.client.sendRequest(config, callback); } /** * Remove all or a list of modules registered by the calling app. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Connect apps can make this request. */ async removeModules(parameters: Parameters.RemoveModules | undefined, callback: Callback): Promise; /** * Remove all or a list of modules registered by the calling app. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Connect apps can make this request. */ async removeModules(parameters?: Parameters.RemoveModules, callback?: never): Promise; async removeModules(parameters?: Parameters.RemoveModules, callback?: Callback): Promise { const config: RequestConfig = { url: '/rest/atlassian-connect/1/app/module/dynamic', method: 'DELETE', params: { moduleKey: parameters?.moduleKey, }, }; return this.client.sendRequest(config, callback); } }