UNPKG

fetch-jsd

Version:

A simple and typed library, based on OpenAPI spec from developer.atlassian.com, for accessing product APIs.

618 lines (617 loc) 39.2 kB
"use strict"; // tslint:disable /** * Service Desk Public REST API * Public REST API for Jira Service Desk * * The version of the OpenAPI document: 1001.0.0-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const runtime = require("../runtime"); const models_1 = require("../models"); /** * no description */ class OrganizationApi extends runtime.BaseAPI { /** * This method adds an organization to a service desk. If the organization ID is already associated with the service desk, no change is made and the resource returns a 204 success code. **[Permissions](#permissions) required**: Service desk\'s agent. * Add organization */ addOrganizationRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.serviceDeskId === null || requestParameters.serviceDeskId === undefined) { throw new runtime.RequiredError('serviceDeskId', 'Required parameter requestParameters.serviceDeskId was null or undefined when calling addOrganization.'); } if (requestParameters.OrganizationServiceDeskUpdateDTO === null || requestParameters.OrganizationServiceDeskUpdateDTO === undefined) { throw new runtime.RequiredError('OrganizationServiceDeskUpdateDTO', 'Required parameter requestParameters.OrganizationServiceDeskUpdateDTO was null or undefined when calling addOrganization.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/servicedesk/{serviceDeskId}/organization`.replace(`{${"serviceDeskId"}}`, encodeURIComponent(String(requestParameters.serviceDeskId))), method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.OrganizationServiceDeskUpdateDTOToJSON(requestParameters.OrganizationServiceDeskUpdateDTO), }); return new runtime.VoidApiResponse(response); }); } /** * This method adds an organization to a service desk. If the organization ID is already associated with the service desk, no change is made and the resource returns a 204 success code. **[Permissions](#permissions) required**: Service desk\'s agent. * Add organization */ addOrganization(requestParameters) { return __awaiter(this, void 0, void 0, function* () { yield this.addOrganizationRaw(requestParameters); }); } /** * This method adds users to an organization. **[Permissions](#permissions) required**: Service desk administrator or agent. Note: Permission to add users to an organization can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Add users to organization */ addUsersToOrganizationRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling addUsersToOrganization.'); } if (requestParameters.UsersOrganizationUpdateDTO === null || requestParameters.UsersOrganizationUpdateDTO === undefined) { throw new runtime.RequiredError('UsersOrganizationUpdateDTO', 'Required parameter requestParameters.UsersOrganizationUpdateDTO was null or undefined when calling addUsersToOrganization.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}/user`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))), method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.UsersOrganizationUpdateDTOToJSON(requestParameters.UsersOrganizationUpdateDTO), }); return new runtime.VoidApiResponse(response); }); } /** * This method adds users to an organization. **[Permissions](#permissions) required**: Service desk administrator or agent. Note: Permission to add users to an organization can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Add users to organization */ addUsersToOrganization(requestParameters) { return __awaiter(this, void 0, void 0, function* () { yield this.addUsersToOrganizationRaw(requestParameters); }); } /** * This method creates an organization by passing the name of the organization. **[Permissions](#permissions) required**: Service desk administrator or agent. Note: Permission to create organizations can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Create organization */ createOrganizationRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.OrganizationCreateDTO === null || requestParameters.OrganizationCreateDTO === undefined) { throw new runtime.RequiredError('OrganizationCreateDTO', 'Required parameter requestParameters.OrganizationCreateDTO was null or undefined when calling createOrganization.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization`, method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.OrganizationCreateDTOToJSON(requestParameters.OrganizationCreateDTO), }); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.OrganizationDTOFromJSON(jsonValue)); }); } /** * This method creates an organization by passing the name of the organization. **[Permissions](#permissions) required**: Service desk administrator or agent. Note: Permission to create organizations can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Create organization */ createOrganization(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.createOrganizationRaw(requestParameters); return yield response.value(); }); } /** * This method deletes an organization. Note that the organization is deleted regardless of other associations it may have. For example, associations with service desks. **[Permissions](#permissions) required**: Jira administrator. * Delete organization */ deleteOrganizationRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling deleteOrganization.'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); }); } /** * This method deletes an organization. Note that the organization is deleted regardless of other associations it may have. For example, associations with service desks. **[Permissions](#permissions) required**: Jira administrator. * Delete organization */ deleteOrganization(requestParameters) { return __awaiter(this, void 0, void 0, function* () { yield this.deleteOrganizationRaw(requestParameters); }); } /** * Removes a property from an organization. **[Permissions](#permissions) required**: Service Desk Administrator or Agent. Note: Permission to manage organizations can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Delete property */ deletePropertyRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling deleteProperty.'); } if (requestParameters.propertyKey === null || requestParameters.propertyKey === undefined) { throw new runtime.RequiredError('propertyKey', 'Required parameter requestParameters.propertyKey was null or undefined when calling deleteProperty.'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}/property/{propertyKey}`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))).replace(`{${"propertyKey"}}`, encodeURIComponent(String(requestParameters.propertyKey))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); }); } /** * Removes a property from an organization. **[Permissions](#permissions) required**: Service Desk Administrator or Agent. Note: Permission to manage organizations can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Delete property */ deleteProperty(requestParameters) { return __awaiter(this, void 0, void 0, function* () { yield this.deletePropertyRaw(requestParameters); }); } /** * This method returns details of an organization. Use this method to get organization details whenever your application component is passed an organization ID but needs to display other organization details. **[Permissions](#permissions) required**: Any **Response limitations**: Customers can only retrieve organization of which they are members. * Get organization */ getOrganizationRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling getOrganization.'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.OrganizationDTOFromJSON(jsonValue)); }); } /** * This method returns details of an organization. Use this method to get organization details whenever your application component is passed an organization ID but needs to display other organization details. **[Permissions](#permissions) required**: Any **Response limitations**: Customers can only retrieve organization of which they are members. * Get organization */ getOrganization(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getOrganizationRaw(requestParameters); return yield response.value(); }); } /** * This method returns a list of organizations in the Jira Service Desk instance. Use this method when you want to present a list of organizations or want to locate an organization by name. **[Permissions](#permissions) required**: Any **Response limitations**: If the user is a customer, only those organizations of which the customer is a member are listed. * Get organizations */ getOrganizationsRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters.start !== undefined) { queryParameters['start'] = requestParameters.start; } if (requestParameters.limit !== undefined) { queryParameters['limit'] = requestParameters.limit; } const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.PagedDTOOrganizationDTOFromJSON(jsonValue)); }); } /** * This method returns a list of organizations in the Jira Service Desk instance. Use this method when you want to present a list of organizations or want to locate an organization by name. **[Permissions](#permissions) required**: Any **Response limitations**: If the user is a customer, only those organizations of which the customer is a member are listed. * Get organizations */ getOrganizations(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getOrganizationsRaw(requestParameters); return yield response.value(); }); } /** * This method returns a list of all organizations associated with a service desk. **[Permissions](#permissions) required**: Service desk\'s agent. * Get organizations */ getOrganizations1Raw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.serviceDeskId === null || requestParameters.serviceDeskId === undefined) { throw new runtime.RequiredError('serviceDeskId', 'Required parameter requestParameters.serviceDeskId was null or undefined when calling getOrganizations1.'); } const queryParameters = {}; if (requestParameters.start !== undefined) { queryParameters['start'] = requestParameters.start; } if (requestParameters.limit !== undefined) { queryParameters['limit'] = requestParameters.limit; } const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/servicedesk/{serviceDeskId}/organization`.replace(`{${"serviceDeskId"}}`, encodeURIComponent(String(requestParameters.serviceDeskId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.PagedDTOOrganizationDTOFromJSON(jsonValue)); }); } /** * This method returns a list of all organizations associated with a service desk. **[Permissions](#permissions) required**: Service desk\'s agent. * Get organizations */ getOrganizations1(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getOrganizations1Raw(requestParameters); return yield response.value(); }); } /** * Returns the keys of all properties for an organization. Use this resource when you need to find out what additional properties items have been added to an organization. **[Permissions](#permissions) required**: Any **Response limitations**: Customers can only access properties of organizations of which they are members. * Get properties keys */ getPropertiesKeysRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling getPropertiesKeys.'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}/property`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.PropertyKeysFromJSON(jsonValue)); }); } /** * Returns the keys of all properties for an organization. Use this resource when you need to find out what additional properties items have been added to an organization. **[Permissions](#permissions) required**: Any **Response limitations**: Customers can only access properties of organizations of which they are members. * Get properties keys */ getPropertiesKeys(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getPropertiesKeysRaw(requestParameters); return yield response.value(); }); } /** * Returns the value of a property from an organization. Use this method to obtain the JSON content for an organization\'s property. **[Permissions](#permissions) required**: Any **Response limitations**: Customers can only access properties of organizations of which they are members. * Get property */ getPropertyRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling getProperty.'); } if (requestParameters.propertyKey === null || requestParameters.propertyKey === undefined) { throw new runtime.RequiredError('propertyKey', 'Required parameter requestParameters.propertyKey was null or undefined when calling getProperty.'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}/property/{propertyKey}`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))).replace(`{${"propertyKey"}}`, encodeURIComponent(String(requestParameters.propertyKey))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.EntityPropertyFromJSON(jsonValue)); }); } /** * Returns the value of a property from an organization. Use this method to obtain the JSON content for an organization\'s property. **[Permissions](#permissions) required**: Any **Response limitations**: Customers can only access properties of organizations of which they are members. * Get property */ getProperty(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getPropertyRaw(requestParameters); return yield response.value(); }); } /** * This method returns all the users associated with an organization. Use this method where you want to provide a list of users for an organization or determine if a user is associated with an organization. **[Permissions](#permissions) required**: Service desk administrator or agent. * Get users in organization */ getUsersInOrganizationRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling getUsersInOrganization.'); } const queryParameters = {}; if (requestParameters.start !== undefined) { queryParameters['start'] = requestParameters.start; } if (requestParameters.limit !== undefined) { queryParameters['limit'] = requestParameters.limit; } const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}/user`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.PagedDTOUserDTOFromJSON(jsonValue)); }); } /** * This method returns all the users associated with an organization. Use this method where you want to provide a list of users for an organization or determine if a user is associated with an organization. **[Permissions](#permissions) required**: Service desk administrator or agent. * Get users in organization */ getUsersInOrganization(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getUsersInOrganizationRaw(requestParameters); return yield response.value(); }); } /** * This method removes an organization from a service desk. If the organization ID does not match an organization associated with the service desk, no change is made and the resource returns a 204 success code. **[Permissions](#permissions) required**: Service desk\'s agent. * Remove organization */ removeOrganizationRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.serviceDeskId === null || requestParameters.serviceDeskId === undefined) { throw new runtime.RequiredError('serviceDeskId', 'Required parameter requestParameters.serviceDeskId was null or undefined when calling removeOrganization.'); } if (requestParameters.OrganizationServiceDeskUpdateDTO === null || requestParameters.OrganizationServiceDeskUpdateDTO === undefined) { throw new runtime.RequiredError('OrganizationServiceDeskUpdateDTO', 'Required parameter requestParameters.OrganizationServiceDeskUpdateDTO was null or undefined when calling removeOrganization.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/servicedesk/{serviceDeskId}/organization`.replace(`{${"serviceDeskId"}}`, encodeURIComponent(String(requestParameters.serviceDeskId))), method: 'DELETE', headers: headerParameters, query: queryParameters, body: models_1.OrganizationServiceDeskUpdateDTOToJSON(requestParameters.OrganizationServiceDeskUpdateDTO), }); return new runtime.VoidApiResponse(response); }); } /** * This method removes an organization from a service desk. If the organization ID does not match an organization associated with the service desk, no change is made and the resource returns a 204 success code. **[Permissions](#permissions) required**: Service desk\'s agent. * Remove organization */ removeOrganization(requestParameters) { return __awaiter(this, void 0, void 0, function* () { yield this.removeOrganizationRaw(requestParameters); }); } /** * This method removes users from an organization. **[Permissions](#permissions) required**: Service desk administrator or agent. Note: Permission to delete users from an organization can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Remove users from organization */ removeUsersFromOrganizationRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling removeUsersFromOrganization.'); } if (requestParameters.UsersOrganizationUpdateDTO === null || requestParameters.UsersOrganizationUpdateDTO === undefined) { throw new runtime.RequiredError('UsersOrganizationUpdateDTO', 'Required parameter requestParameters.UsersOrganizationUpdateDTO was null or undefined when calling removeUsersFromOrganization.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}/user`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))), method: 'DELETE', headers: headerParameters, query: queryParameters, body: models_1.UsersOrganizationUpdateDTOToJSON(requestParameters.UsersOrganizationUpdateDTO), }); return new runtime.VoidApiResponse(response); }); } /** * This method removes users from an organization. **[Permissions](#permissions) required**: Service desk administrator or agent. Note: Permission to delete users from an organization can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Remove users from organization */ removeUsersFromOrganization(requestParameters) { return __awaiter(this, void 0, void 0, function* () { yield this.removeUsersFromOrganizationRaw(requestParameters); }); } /** * Sets the value of a property for an organization. Use this resource to store custom data against an organization. **[Permissions](#permissions) required**: Service Desk Administrator or Agent. Note: Permission to manage organizations can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Set property */ setPropertyRaw(requestParameters) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { throw new runtime.RequiredError('organizationId', 'Required parameter requestParameters.organizationId was null or undefined when calling setProperty.'); } if (requestParameters.propertyKey === null || requestParameters.propertyKey === undefined) { throw new runtime.RequiredError('propertyKey', 'Required parameter requestParameters.propertyKey was null or undefined when calling setProperty.'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { // oauth required if (typeof this.configuration.accessToken === 'function') { headerParameters["Authorization"] = this.configuration.accessToken("OAuth2", ["manage:servicedesk-customer"]); } else { headerParameters["Authorization"] = this.configuration.accessToken; } } const response = yield this.request({ path: `/rest/servicedeskapi/organization/{organizationId}/property/{propertyKey}`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))).replace(`{${"propertyKey"}}`, encodeURIComponent(String(requestParameters.propertyKey))), method: 'PUT', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); }); } /** * Sets the value of a property for an organization. Use this resource to store custom data against an organization. **[Permissions](#permissions) required**: Service Desk Administrator or Agent. Note: Permission to manage organizations can be switched to users with the Jira administrator permission, using the **[Organization management](https://confluence.atlassian.com/servicedeskcloud/setting-up-service-desk-users-732528877.html#Settingupservicedeskusers-manageorgsManageorganizations)** feature. * Set property */ setProperty(requestParameters) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.setPropertyRaw(requestParameters); return yield response.value(); }); } } exports.OrganizationApi = OrganizationApi;