import * as Models from './models'; import * as Parameters from './parameters'; import { Callback } from '../callback'; import { Client } from '../clients'; import { RequestConfig } from '../requestConfig'; export class ProjectKeyAndNameValidation { constructor(private client: Client) {} /** * Validates a project key by confirming the key is a valid string and not in use. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None. */ async validateProjectKey( parameters: Parameters.ValidateProjectKey | string | undefined, callback: Callback, ): Promise; /** * Validates a project key by confirming the key is a valid string and not in use. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None. */ async validateProjectKey( parameters?: Parameters.ValidateProjectKey | string, callback?: never, ): Promise; async validateProjectKey( parameters?: Parameters.ValidateProjectKey | string, callback?: Callback, ): Promise { const key = typeof parameters === 'string' ? parameters : parameters?.key; const config: RequestConfig = { url: '/rest/api/3/projectvalidate/key', method: 'GET', params: { key, }, }; return this.client.sendRequest(config, callback); } /** * Validates a project key and, if the key is invalid or in use, generates a valid random string for the project key. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None. */ async getValidProjectKey( parameters: Parameters.GetValidProjectKey | string | undefined, callback: Callback, ): Promise; /** * Validates a project key and, if the key is invalid or in use, generates a valid random string for the project key. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None. */ async getValidProjectKey( parameters?: Parameters.GetValidProjectKey | string, callback?: never, ): Promise; async getValidProjectKey( parameters?: Parameters.GetValidProjectKey | string, callback?: Callback, ): Promise { const key = typeof parameters === 'string' ? parameters : parameters?.key; const config: RequestConfig = { url: '/rest/api/3/projectvalidate/validProjectKey', method: 'GET', params: { key, }, }; return this.client.sendRequest(config, callback); } /** * Checks that a project name isn't in use. If the name isn't in use, the passed string is returned. If the name is in * use, this operation attempts to generate a valid project name based on the one supplied, usually by adding a * sequence number. If a valid project name cannot be generated, a 404 response is returned. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None. */ async getValidProjectName( parameters: Parameters.GetValidProjectName | string, callback: Callback, ): Promise; /** * Checks that a project name isn't in use. If the name isn't in use, the passed string is returned. If the name is in * use, this operation attempts to generate a valid project name based on the one supplied, usually by adding a * sequence number. If a valid project name cannot be generated, a 404 response is returned. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None. */ async getValidProjectName( parameters: Parameters.GetValidProjectName | string, callback?: never, ): Promise; async getValidProjectName( parameters: Parameters.GetValidProjectName | string, callback?: Callback, ): Promise { const name = typeof parameters === 'string' ? parameters : parameters.name; const config: RequestConfig = { url: '/rest/api/3/projectvalidate/validProjectName', method: 'GET', params: { name, }, }; return this.client.sendRequest(config, callback); } }