/* tslint:disable */ /* eslint-disable */ /** * Faraday REST API * The [Faraday](https://faraday.ai) API makes it easy to predict customer behavior programmatically. See our [API change policy](https://faraday.ai/legal). * * The version of the OpenAPI document: 1.0.0 * Contact: support@faraday.ai * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import { ArchiveConfig, Cohort, Dataset, Outcome, PersonaSet, Recommender, Scope, ScopeAnalysis, ScopeEfficacy, ScopeGeography, ScopeMergePatch, ScopePost, Target, } from '../models'; export interface ArchiveScopeRequest { scopeId: string; archiveConfig: ArchiveConfig; } export interface CreateScopeRequest { scopeFields: ScopePost; } export interface DeleteScopeRequest { scopeId: string; } export interface ForceUpdateScopeRequest { scopeId: string; } export interface GetScopeRequest { scopeId: string; } export interface GetScopeAnalysisRequest { scopeId: string; } export interface GetScopeDatasetsRequest { scopeId: string; } export interface GetScopeEfficacyRequest { scopeId: string; } export interface GetScopeGeographyRequest { scopeId: string; } export interface GetScopePayloadCohortsRequest { scopeId: string; } export interface GetScopePayloadOutcomesRequest { scopeId: string; } export interface GetScopePayloadPersonaSetsRequest { scopeId: string; } export interface GetScopePayloadRecommendersRequest { scopeId: string; } export interface GetScopePopulationCohortsRequest { scopeId: string; } export interface GetScopePopulationExclusionAddressLevelCohortsRequest { scopeId: string; } export interface GetScopePopulationExclusionCohortsRequest { scopeId: string; } export interface GetScopeTargetsRequest { scopeId: string; } export interface GetScopesRequest { ids?: Array; } export interface UnarchiveScopeRequest { scopeId: string; archiveConfig: ArchiveConfig; } export interface UpdateScopeRequest { scopeId: string; scopeMergePatch: ScopeMergePatch; } /** * */ export class ScopesApi extends runtime.BaseAPI { /** * Archive a scope * Archive a scope */ async archiveScopeRaw(requestParameters: ArchiveScopeRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling archiveScope.'); } if (requestParameters.archiveConfig === null || requestParameters.archiveConfig === undefined) { throw new runtime.RequiredError('archiveConfig','Required parameter requestParameters.archiveConfig was null or undefined when calling archiveScope.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/archive`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.archiveConfig, }); return new runtime.VoidApiResponse(response); } /** * Archive a scope * Archive a scope */ async archiveScope(scopeId: string, archiveConfig: ArchiveConfig, ): Promise { await this.archiveScopeRaw({ scopeId: scopeId, archiveConfig: archiveConfig }, ); } /** * Add a new scope * Create scope */ async createScopeRaw(requestParameters: CreateScopeRequest, ): Promise> { if (requestParameters.scopeFields === null || requestParameters.scopeFields === undefined) { throw new runtime.RequiredError('scopeFields','Required parameter requestParameters.scopeFields was null or undefined when calling createScope.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes`, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.scopeFields, }); return new runtime.JSONApiResponse(response); } /** * Add a new scope * Create scope */ async createScope(scopeFields: ScopePost, ): Promise { const response = await this.createScopeRaw({ scopeFields: scopeFields }, ); return await response.value(); } /** * Delete a scope */ async deleteScopeRaw(requestParameters: DeleteScopeRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling deleteScope.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Delete a scope */ async deleteScope(scopeId: string, ): Promise { await this.deleteScopeRaw({ scopeId: scopeId }, ); } /** * Trigger a rerun for this resource. Faraday automatically updates resources when their config changes, but this option is available in case of transient errors. * Trigger a rerun for this resource. */ async forceUpdateScopeRaw(requestParameters: ForceUpdateScopeRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling forceUpdateScope.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/force_update`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Trigger a rerun for this resource. Faraday automatically updates resources when their config changes, but this option is available in case of transient errors. * Trigger a rerun for this resource. */ async forceUpdateScope(scopeId: string, ): Promise { await this.forceUpdateScopeRaw({ scopeId: scopeId }, ); } /** * Get details on a specific scope * Retrieve a scope */ async getScopeRaw(requestParameters: GetScopeRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScope.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get details on a specific scope * Retrieve a scope */ async getScope(scopeId: string, ): Promise { const response = await this.getScopeRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get analysis for a scope * Get analysis for a scope */ async getScopeAnalysisRaw(requestParameters: GetScopeAnalysisRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopeAnalysis.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/analysis`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get analysis for a scope * Get analysis for a scope */ async getScopeAnalysis(scopeId: string, ): Promise { const response = await this.getScopeAnalysisRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Retrieve all datasets associated with a scope. For example, if your scope has population_cohorts, you built those cohorts using data from one of your datasets. This endpoint gets all such datasets. This can be used with referenced targets, to figure out which source tables the target can reference. * Retrieve all datasets associated with a scope */ async getScopeDatasetsRaw(requestParameters: GetScopeDatasetsRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopeDatasets.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/datasets`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Retrieve all datasets associated with a scope. For example, if your scope has population_cohorts, you built those cohorts using data from one of your datasets. This endpoint gets all such datasets. This can be used with referenced targets, to figure out which source tables the target can reference. * Retrieve all datasets associated with a scope */ async getScopeDatasets(scopeId: string, ): Promise> { const response = await this.getScopeDatasetsRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get efficacy for a scope * Get efficacy for a scope */ async getScopeEfficacyRaw(requestParameters: GetScopeEfficacyRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopeEfficacy.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/efficacy`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get efficacy for a scope * Get efficacy for a scope */ async getScopeEfficacy(scopeId: string, ): Promise { const response = await this.getScopeEfficacyRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get a postcode- and state-level breakdown of the scope population, including per-payload-cohort counts. `postcodes` may be omitted when the scope spans more than 250 distinct postcodes (the UI distribution table saturates at that point); `states` is always present. * Get geographic breakdown for a scope */ async getScopeGeographyRaw(requestParameters: GetScopeGeographyRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopeGeography.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/analysis/geography`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get a postcode- and state-level breakdown of the scope population, including per-payload-cohort counts. `postcodes` may be omitted when the scope spans more than 250 distinct postcodes (the UI distribution table saturates at that point); `states` is always present. * Get geographic breakdown for a scope */ async getScopeGeography(scopeId: string, ): Promise { const response = await this.getScopeGeographyRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get payload cohorts for a scope * Get payload cohorts for a scope */ async getScopePayloadCohortsRaw(requestParameters: GetScopePayloadCohortsRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopePayloadCohorts.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/payload/cohorts`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get payload cohorts for a scope * Get payload cohorts for a scope */ async getScopePayloadCohorts(scopeId: string, ): Promise> { const response = await this.getScopePayloadCohortsRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get payload outcomes for a scope * Get payload outcomes for a scope */ async getScopePayloadOutcomesRaw(requestParameters: GetScopePayloadOutcomesRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopePayloadOutcomes.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/payload/outcomes`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get payload outcomes for a scope * Get payload outcomes for a scope */ async getScopePayloadOutcomes(scopeId: string, ): Promise> { const response = await this.getScopePayloadOutcomesRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get payload persona sets for a scope * Get payload persona sets for a scope */ async getScopePayloadPersonaSetsRaw(requestParameters: GetScopePayloadPersonaSetsRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopePayloadPersonaSets.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/payload/persona_sets`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get payload persona sets for a scope * Get payload persona sets for a scope */ async getScopePayloadPersonaSets(scopeId: string, ): Promise> { const response = await this.getScopePayloadPersonaSetsRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get payload recommenders for a scope * Get payload recommenders for a scope */ async getScopePayloadRecommendersRaw(requestParameters: GetScopePayloadRecommendersRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopePayloadRecommenders.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/payload/recommenders`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get payload recommenders for a scope * Get payload recommenders for a scope */ async getScopePayloadRecommenders(scopeId: string, ): Promise> { const response = await this.getScopePayloadRecommendersRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get population cohorts for a scope * Get population cohorts for a scope */ async getScopePopulationCohortsRaw(requestParameters: GetScopePopulationCohortsRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopePopulationCohorts.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/population/cohorts`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get population cohorts for a scope * Get population cohorts for a scope */ async getScopePopulationCohorts(scopeId: string, ): Promise> { const response = await this.getScopePopulationCohortsRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get address-level population exclusion cohorts for a scope * Get address-level population exclusion cohorts for a scope */ async getScopePopulationExclusionAddressLevelCohortsRaw(requestParameters: GetScopePopulationExclusionAddressLevelCohortsRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopePopulationExclusionAddressLevelCohorts.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/population/exclusion_address_level_cohorts`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get address-level population exclusion cohorts for a scope * Get address-level population exclusion cohorts for a scope */ async getScopePopulationExclusionAddressLevelCohorts(scopeId: string, ): Promise> { const response = await this.getScopePopulationExclusionAddressLevelCohortsRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get population exclusion cohorts for a scope * Get population exclusion cohorts for a scope */ async getScopePopulationExclusionCohortsRaw(requestParameters: GetScopePopulationExclusionCohortsRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopePopulationExclusionCohorts.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/population/exclusion_cohorts`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get population exclusion cohorts for a scope * Get population exclusion cohorts for a scope */ async getScopePopulationExclusionCohorts(scopeId: string, ): Promise> { const response = await this.getScopePopulationExclusionCohortsRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get targets for a scope * Get targets for a scope */ async getScopeTargetsRaw(requestParameters: GetScopeTargetsRequest, ): Promise>> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling getScopeTargets.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/targets`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get targets for a scope * Get targets for a scope */ async getScopeTargets(scopeId: string, ): Promise> { const response = await this.getScopeTargetsRaw({ scopeId: scopeId }, ); return await response.value(); } /** * Get a list of scopes defined on the account * List scopes */ async getScopesRaw(requestParameters: GetScopesRequest, ): Promise>> { const queryParameters: any = {}; if (requestParameters.ids) { queryParameters['ids'] = requestParameters.ids; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get a list of scopes defined on the account * List scopes */ async getScopes(ids?: Array, ): Promise> { const response = await this.getScopesRaw({ ids: ids }, ); return await response.value(); } /** * Unarchive a scope * Unarchive a scope */ async unarchiveScopeRaw(requestParameters: UnarchiveScopeRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling unarchiveScope.'); } if (requestParameters.archiveConfig === null || requestParameters.archiveConfig === undefined) { throw new runtime.RequiredError('archiveConfig','Required parameter requestParameters.archiveConfig was null or undefined when calling unarchiveScope.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}/unarchive`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.archiveConfig, }); return new runtime.VoidApiResponse(response); } /** * Unarchive a scope * Unarchive a scope */ async unarchiveScope(scopeId: string, archiveConfig: ArchiveConfig, ): Promise { await this.unarchiveScopeRaw({ scopeId: scopeId, archiveConfig: archiveConfig }, ); } /** * Update the configuration of a scope. * Update a scope */ async updateScopeRaw(requestParameters: UpdateScopeRequest, ): Promise> { if (requestParameters.scopeId === null || requestParameters.scopeId === undefined) { throw new runtime.RequiredError('scopeId','Required parameter requestParameters.scopeId was null or undefined when calling updateScope.'); } if (requestParameters.scopeMergePatch === null || requestParameters.scopeMergePatch === undefined) { throw new runtime.RequiredError('scopeMergePatch','Required parameter requestParameters.scopeMergePatch was null or undefined when calling updateScope.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/merge-patch+json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/scopes/{scope_id}`.replace(`{${"scope_id"}}`, encodeURIComponent(String(requestParameters.scopeId))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: requestParameters.scopeMergePatch, }); return new runtime.JSONApiResponse(response); } /** * Update the configuration of a scope. * Update a scope */ async updateScope(scopeId: string, scopeMergePatch: ScopeMergePatch, ): Promise { const response = await this.updateScopeRaw({ scopeId: scopeId, scopeMergePatch: scopeMergePatch }, ); return await response.value(); } }