@planet-a/affinity-node
Version:
API wrapper for the affinity.co API
80 lines (79 loc) • 5.43 kB
JavaScript
// TODO: better import syntax?
import { BaseAPIRequestFactory } from './baseapi.js';
import { HttpMethod, HttpInfo } from '../http/http.js';
import { ObjectSerializer } from '../models/ObjectSerializer.js';
import { ApiException } from './exception.js';
import { isCodeInRange } from '../util.js';
/**
* no description
*/
export class MeetingsApiRequestFactory extends BaseAPIRequestFactory {
/**
* Paginate through all Meetings in Affinity. Returns basic information about past and future meeting interactions and its attendees. You can filter meetings using the `filter` query parameter. The filter parameter is a string that you can specify conditions based on the following properties. | **Property Name** | **Description** | **Type** | **Allowed Operators** | **Examples** | |-----------------------------|-----------------------------------------------------------------|------------|--------------------------------------|----------------------------------| | `id` | Unique identifier for Meetings | `int64` | `=` | `id=1` | | `startTime` | Start time of when Meeting was scheduled | `datetime` | `>`, `<`, `>=`, `<=` | `startTime>2025-01-01T01:00:00Z` | | `createdAt` | When the Meeting was created in Affinity | `datetime` | `>`, `<`, `>=`, `<=` | `createdAt<2025-01-01T01:00:00Z` | | `updatedAt` | When the Meeting was updated in Affinity | `datetime` | `>`, `<`, `>=`, `<=` | `updatedAt>=2025-01-01T01:00:00Z`|
* Get metadata on all Meetings
* @param cursor Cursor for the next or previous page
* @param limit Number of items to include in the page
* @param filter Filter options
*/
async v2MeetingsGET(cursor, limit, filter, _options) {
let _config = _options || this.configuration;
// Path Params
const localVarPath = '/v2/meetings';
// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
// Query Params
if (cursor !== undefined) {
requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", ""));
}
// Query Params
if (limit !== undefined) {
requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32"));
}
// Query Params
if (filter !== undefined) {
requestContext.setQueryParam("filter", ObjectSerializer.serialize(filter, "string", ""));
}
let authMethod;
// Apply auth methods
authMethod = _config.authMethods["bearerAuth"];
if (authMethod?.applySecurityAuthentication) {
await authMethod?.applySecurityAuthentication(requestContext);
}
const defaultAuth = _config?.authMethods?.default;
if (defaultAuth?.applySecurityAuthentication) {
await defaultAuth?.applySecurityAuthentication(requestContext);
}
return requestContext;
}
}
export class MeetingsApiResponseProcessor {
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to v2MeetingsGET
* @throws ApiException if the response code was not in [200, 299]
*/
async v2MeetingsGETWithHttpInfo(response) {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body = ObjectSerializer.deserialize(ObjectSerializer.parse(await response.body.text(), contentType), "InteractionsMeetingPaged", "");
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
const body = ObjectSerializer.deserialize(ObjectSerializer.parse(await response.body.text(), contentType), "Responses400", "");
throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers);
}
if (isCodeInRange("0", response.httpStatusCode)) {
const body = ObjectSerializer.deserialize(ObjectSerializer.parse(await response.body.text(), contentType), "Errors", "");
throw new ApiException(response.httpStatusCode, "Errors", body, response.headers);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer.deserialize(ObjectSerializer.parse(await response.body.text(), contentType), "InteractionsMeetingPaged", "");
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}
}