import * as Models from './models'; import * as Parameters from './parameters'; import { Callback } from '../callback'; import { Client } from '../clients'; import { RequestConfig } from '../requestConfig'; export class AppProperties { constructor(private client: Client) {} /** * Gets all the properties of an app. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a * Connect app whose key matches `addonKey` can make this request. Additionally, Forge apps published on the * Marketplace can access properties of Connect apps they were [migrated * from](https://developer.atlassian.com/platform/forge/build-a-connect-on-forge-app/). */ async getAddonProperties( parameters: Parameters.GetAddonProperties | string, callback: Callback, ): Promise; /** * Gets all the properties of an app. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a * Connect app whose key matches `addonKey` can make this request. Additionally, Forge apps published on the * Marketplace can access properties of Connect apps they were [migrated * from](https://developer.atlassian.com/platform/forge/build-a-connect-on-forge-app/). */ async getAddonProperties( parameters: Parameters.GetAddonProperties | string, callback?: never, ): Promise; async getAddonProperties( parameters: Parameters.GetAddonProperties | string, callback?: Callback, ): Promise { const addonKey = typeof parameters === 'string' ? parameters : parameters.addonKey; const config: RequestConfig = { url: `/rest/atlassian-connect/1/addons/${addonKey}/properties`, method: 'GET', }; return this.client.sendRequest(config, callback); } /** * Returns the key and value of an app's property. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a * Connect app whose key matches `addonKey` can make this request. Additionally, Forge apps published on the * Marketplace can access properties of Connect apps they were [migrated * from](https://developer.atlassian.com/platform/forge/build-a-connect-on-forge-app/). */ async getAddonProperty( parameters: Parameters.GetAddonProperty, callback: Callback, ): Promise; /** * Returns the key and value of an app's property. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a * Connect app whose key matches `addonKey` can make this request. Additionally, Forge apps published on the * Marketplace can access properties of Connect apps they were [migrated * from](https://developer.atlassian.com/platform/forge/build-a-connect-on-forge-app/). */ async getAddonProperty( parameters: Parameters.GetAddonProperty, callback?: never, ): Promise; async getAddonProperty( parameters: Parameters.GetAddonProperty, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/atlassian-connect/1/addons/${parameters.addonKey}/properties/${parameters.propertyKey}`, method: 'GET', }; return this.client.sendRequest(config, callback); } /** * Sets the value of an app's property. Use this resource to store custom data for your app. * * The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The * maximum length is 32768 characters. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a * Connect app whose key matches `addonKey` can make this request. */ async putAddonProperty( parameters: Parameters.PutAddonProperty, callback: Callback, ): Promise; /** * Sets the value of an app's property. Use this resource to store custom data for your app. * * The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The * maximum length is 32768 characters. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a * Connect app whose key matches `addonKey` can make this request. */ async putAddonProperty( parameters: Parameters.PutAddonProperty, callback?: never, ): Promise; async putAddonProperty( parameters: Parameters.PutAddonProperty, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/atlassian-connect/1/addons/${parameters.addonKey}/properties/${parameters.propertyKey}`, method: 'PUT', data: parameters.propertyValue, }; return this.client.sendRequest(config, callback); } /** * Deletes an app's property. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a * Connect app whose key matches `addonKey` can make this request. */ async deleteAddonProperty(parameters: Parameters.DeleteAddonProperty, callback: Callback): Promise; /** * Deletes an app's property. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a * Connect app whose key matches `addonKey` can make this request. */ async deleteAddonProperty(parameters: Parameters.DeleteAddonProperty, callback?: never): Promise; async deleteAddonProperty( parameters: Parameters.DeleteAddonProperty, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/atlassian-connect/1/addons/${parameters.addonKey}/properties/${parameters.propertyKey}`, method: 'DELETE', }; return this.client.sendRequest(config, callback); } /** * Sets the value of a Forge app's property. These values can be retrieved in [Jira * expressions](https://developer.atlassian.com/cloud/jira/platform/jira-expressions/) through the `app` [context * variable](https://developer.atlassian.com/cloud/jira/platform/jira-expressions/#context-variables). * * For other use cases, use the [Storage * API](https://developer.atlassian.com/platform/forge/runtime-reference/storage-api/). * * The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The * maximum length is 32768 characters. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Forge apps can make this request. */ async putAppProperty( parameters: Parameters.PutAppProperty, callback: Callback, ): Promise; /** * Sets the value of a Forge app's property. These values can be retrieved in [Jira * expressions](https://developer.atlassian.com/cloud/jira/platform/jira-expressions/) through the `app` [context * variable](https://developer.atlassian.com/cloud/jira/platform/jira-expressions/#context-variables). * * For other use cases, use the [Storage * API](https://developer.atlassian.com/platform/forge/runtime-reference/storage-api/). * * The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The * maximum length is 32768 characters. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Forge apps can make this request. */ async putAppProperty( parameters: Parameters.PutAppProperty, callback?: never, ): Promise; async putAppProperty( parameters: Parameters.PutAppProperty, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/forge/1/app/properties/${parameters.propertyKey}`, method: 'PUT', data: parameters.propertyValue, }; return this.client.sendRequest(config, callback); } /** * Deletes a Forge app's property. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Forge apps can make this request. */ async deleteAppProperty(parameters: Parameters.DeleteAppProperty, callback: Callback): Promise; /** * Deletes a Forge app's property. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only * Forge apps can make this request. */ async deleteAppProperty(parameters: Parameters.DeleteAppProperty, callback?: never): Promise; async deleteAppProperty( parameters: Parameters.DeleteAppProperty, callback?: Callback, ): Promise { const config: RequestConfig = { url: `/rest/forge/1/app/properties/${parameters.propertyKey}`, method: 'DELETE', }; return this.client.sendRequest(config, callback); } }