UNPKG

@bitblit/ratchet-misc

Version:

Ratchet miscellaneous tooling that requires smallish dependant libraries

192 lines 11.1 kB
import * as runtime from '../runtime.js'; import { GoalFromJSON, GoalToJSON, ObjectRefToJSON } from '../models/index.js'; export class GoalsApi extends runtime.BaseAPI { async orgOrgIdGoalsGetRaw(requestParameters, initOverrides) { if (requestParameters.orgId === null || requestParameters.orgId === undefined) { throw new runtime.RequiredError('orgId', 'Required parameter requestParameters.orgId was null or undefined when calling orgOrgIdGoalsGet.'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token('APIKey', []); if (tokenString) { headerParameters['Authorization'] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/org/{orgId}/goals`.replace(`{${'orgId'}}`, encodeURIComponent(String(requestParameters.orgId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(GoalFromJSON)); } async orgOrgIdGoalsGet(requestParameters, initOverrides) { const response = await this.orgOrgIdGoalsGetRaw(requestParameters, initOverrides); return await response.value(); } async orgOrgIdGoalsObjectIdDeleteRaw(requestParameters, initOverrides) { if (requestParameters.orgId === null || requestParameters.orgId === undefined) { throw new runtime.RequiredError('orgId', 'Required parameter requestParameters.orgId was null or undefined when calling orgOrgIdGoalsObjectIdDelete.'); } if (requestParameters.objectId === null || requestParameters.objectId === undefined) { throw new runtime.RequiredError('objectId', 'Required parameter requestParameters.objectId was null or undefined when calling orgOrgIdGoalsObjectIdDelete.'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token('APIKey', []); if (tokenString) { headerParameters['Authorization'] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/org/{orgId}/goals/{objectId}` .replace(`{${'orgId'}}`, encodeURIComponent(String(requestParameters.orgId))) .replace(`{${'objectId'}}`, encodeURIComponent(String(requestParameters.objectId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } async orgOrgIdGoalsObjectIdDelete(requestParameters, initOverrides) { await this.orgOrgIdGoalsObjectIdDeleteRaw(requestParameters, initOverrides); } async orgOrgIdGoalsObjectIdOwnersPostRaw(requestParameters, initOverrides) { if (requestParameters.orgId === null || requestParameters.orgId === undefined) { throw new runtime.RequiredError('orgId', 'Required parameter requestParameters.orgId was null or undefined when calling orgOrgIdGoalsObjectIdOwnersPost.'); } if (requestParameters.objectId === null || requestParameters.objectId === undefined) { throw new runtime.RequiredError('objectId', 'Required parameter requestParameters.objectId was null or undefined when calling orgOrgIdGoalsObjectIdOwnersPost.'); } if (requestParameters.objectRef === null || requestParameters.objectRef === undefined) { throw new runtime.RequiredError('objectRef', 'Required parameter requestParameters.objectRef was null or undefined when calling orgOrgIdGoalsObjectIdOwnersPost.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token('APIKey', []); if (tokenString) { headerParameters['Authorization'] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/org/{orgId}/goals/{objectId}/owners` .replace(`{${'orgId'}}`, encodeURIComponent(String(requestParameters.orgId))) .replace(`{${'objectId'}}`, encodeURIComponent(String(requestParameters.objectId))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.objectRef.map(ObjectRefToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); } async orgOrgIdGoalsObjectIdOwnersPost(requestParameters, initOverrides) { await this.orgOrgIdGoalsObjectIdOwnersPostRaw(requestParameters, initOverrides); } async orgOrgIdGoalsObjectIdParentPostRaw(requestParameters, initOverrides) { if (requestParameters.orgId === null || requestParameters.orgId === undefined) { throw new runtime.RequiredError('orgId', 'Required parameter requestParameters.orgId was null or undefined when calling orgOrgIdGoalsObjectIdParentPost.'); } if (requestParameters.objectId === null || requestParameters.objectId === undefined) { throw new runtime.RequiredError('objectId', 'Required parameter requestParameters.objectId was null or undefined when calling orgOrgIdGoalsObjectIdParentPost.'); } if (requestParameters.objectRef === null || requestParameters.objectRef === undefined) { throw new runtime.RequiredError('objectRef', 'Required parameter requestParameters.objectRef was null or undefined when calling orgOrgIdGoalsObjectIdParentPost.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token('APIKey', []); if (tokenString) { headerParameters['Authorization'] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/org/{orgId}/goals/{objectId}/parent` .replace(`{${'orgId'}}`, encodeURIComponent(String(requestParameters.orgId))) .replace(`{${'objectId'}}`, encodeURIComponent(String(requestParameters.objectId))), method: 'POST', headers: headerParameters, query: queryParameters, body: ObjectRefToJSON(requestParameters.objectRef), }, initOverrides); return new runtime.VoidApiResponse(response); } async orgOrgIdGoalsObjectIdParentPost(requestParameters, initOverrides) { await this.orgOrgIdGoalsObjectIdParentPostRaw(requestParameters, initOverrides); } async orgOrgIdGoalsObjectIdPutRaw(requestParameters, initOverrides) { if (requestParameters.orgId === null || requestParameters.orgId === undefined) { throw new runtime.RequiredError('orgId', 'Required parameter requestParameters.orgId was null or undefined when calling orgOrgIdGoalsObjectIdPut.'); } if (requestParameters.objectId === null || requestParameters.objectId === undefined) { throw new runtime.RequiredError('objectId', 'Required parameter requestParameters.objectId was null or undefined when calling orgOrgIdGoalsObjectIdPut.'); } if (requestParameters.goal === null || requestParameters.goal === undefined) { throw new runtime.RequiredError('goal', 'Required parameter requestParameters.goal was null or undefined when calling orgOrgIdGoalsObjectIdPut.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token('APIKey', []); if (tokenString) { headerParameters['Authorization'] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/org/{orgId}/goals/{objectId}` .replace(`{${'orgId'}}`, encodeURIComponent(String(requestParameters.orgId))) .replace(`{${'objectId'}}`, encodeURIComponent(String(requestParameters.objectId))), method: 'PUT', headers: headerParameters, query: queryParameters, body: GoalToJSON(requestParameters.goal), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GoalFromJSON(jsonValue)); } async orgOrgIdGoalsObjectIdPut(requestParameters, initOverrides) { const response = await this.orgOrgIdGoalsObjectIdPutRaw(requestParameters, initOverrides); return await response.value(); } async orgOrgIdGoalsPostRaw(requestParameters, initOverrides) { if (requestParameters.orgId === null || requestParameters.orgId === undefined) { throw new runtime.RequiredError('orgId', 'Required parameter requestParameters.orgId was null or undefined when calling orgOrgIdGoalsPost.'); } if (requestParameters.goal === null || requestParameters.goal === undefined) { throw new runtime.RequiredError('goal', 'Required parameter requestParameters.goal was null or undefined when calling orgOrgIdGoalsPost.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token('APIKey', []); if (tokenString) { headerParameters['Authorization'] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/org/{orgId}/goals`.replace(`{${'orgId'}}`, encodeURIComponent(String(requestParameters.orgId))), method: 'POST', headers: headerParameters, query: queryParameters, body: GoalToJSON(requestParameters.goal), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GoalFromJSON(jsonValue)); } async orgOrgIdGoalsPost(requestParameters, initOverrides) { const response = await this.orgOrgIdGoalsPostRaw(requestParameters, initOverrides); return await response.value(); } } //# sourceMappingURL=GoalsApi.js.map