@simplyhomes/sos-sdk
Version:
TypeScript SDK for Simply Homes SoS API v4
289 lines (288 loc) • 13.9 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/**
* API v4
* Swagger documentation for API v4
*
* The version of the OpenAPI document: 4.0
*
*
* 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 { V4UsersCreateUserBodyDtoToJSON, V4UsersCreateUserResponseDtoFromJSON, V4UsersDeleteUserResponseDtoFromJSON, V4UsersGetUserColumnsResponseDtoFromJSON, V4UsersGetUserResponseDtoFromJSON, V4UsersGetUsersInViewResponseDtoFromJSON, V4UsersGetUsersResponseDtoFromJSON, V4UsersUpdateUserBodyDtoToJSON, V4UsersUpdateUserResponseDtoFromJSON, } from '../models/index';
/**
*
*/
export class UsersAPIV4Api extends runtime.BaseAPI {
/**
* Create User Documentation
* Create a new user
*/
async v4UsersControllerCreateUserV4Raw(requestParameters, initOverrides) {
if (requestParameters['v4UsersCreateUserBodyDto'] == null) {
throw new runtime.RequiredError('v4UsersCreateUserBodyDto', 'Required parameter "v4UsersCreateUserBodyDto" was null or undefined when calling v4UsersControllerCreateUserV4().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication
}
let urlPath = `/v4/users`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: V4UsersCreateUserBodyDtoToJSON(requestParameters['v4UsersCreateUserBodyDto']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4UsersCreateUserResponseDtoFromJSON(jsonValue));
}
/**
* Create User Documentation
* Create a new user
*/
async v4UsersControllerCreateUserV4(requestParameters, initOverrides) {
const response = await this.v4UsersControllerCreateUserV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Delete User Documentation
* Delete a specific user by userId
*/
async v4UsersControllerDeleteUserV4Raw(requestParameters, initOverrides) {
if (requestParameters['userId'] == null) {
throw new runtime.RequiredError('userId', 'Required parameter "userId" was null or undefined when calling v4UsersControllerDeleteUserV4().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication
}
let urlPath = `/v4/users/{userId}`;
urlPath = urlPath.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters['userId'])));
const response = await this.request({
path: urlPath,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4UsersDeleteUserResponseDtoFromJSON(jsonValue));
}
/**
* Delete User Documentation
* Delete a specific user by userId
*/
async v4UsersControllerDeleteUserV4(requestParameters, initOverrides) {
const response = await this.v4UsersControllerDeleteUserV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get User Columns Documentation
* Get specific columns of a user by userId
*/
async v4UsersControllerGetUserColumnsV4Raw(requestParameters, initOverrides) {
if (requestParameters['columns'] == null) {
throw new runtime.RequiredError('columns', 'Required parameter "columns" was null or undefined when calling v4UsersControllerGetUserColumnsV4().');
}
if (requestParameters['userId'] == null) {
throw new runtime.RequiredError('userId', 'Required parameter "userId" was null or undefined when calling v4UsersControllerGetUserColumnsV4().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication
}
let urlPath = `/v4/users/{userId}/{columns}`;
urlPath = urlPath.replace(`{${"columns"}}`, encodeURIComponent(String(requestParameters['columns'])));
urlPath = urlPath.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters['userId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4UsersGetUserColumnsResponseDtoFromJSON(jsonValue));
}
/**
* Get User Columns Documentation
* Get specific columns of a user by userId
*/
async v4UsersControllerGetUserColumnsV4(requestParameters, initOverrides) {
const response = await this.v4UsersControllerGetUserColumnsV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get User Documentation
* Get a specific user by userId
*/
async v4UsersControllerGetUserV4Raw(requestParameters, initOverrides) {
if (requestParameters['userId'] == null) {
throw new runtime.RequiredError('userId', 'Required parameter "userId" was null or undefined when calling v4UsersControllerGetUserV4().');
}
const queryParameters = {};
if (requestParameters['viewId'] != null) {
queryParameters['viewId'] = requestParameters['viewId'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication
}
let urlPath = `/v4/users/{userId}`;
urlPath = urlPath.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters['userId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4UsersGetUserResponseDtoFromJSON(jsonValue));
}
/**
* Get User Documentation
* Get a specific user by userId
*/
async v4UsersControllerGetUserV4(requestParameters, initOverrides) {
const response = await this.v4UsersControllerGetUserV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get Users In View Documentation
* Get users with a specific viewId
*/
async v4UsersControllerGetUsersInViewV4Raw(requestParameters, initOverrides) {
if (requestParameters['viewId'] == null) {
throw new runtime.RequiredError('viewId', 'Required parameter "viewId" was null or undefined when calling v4UsersControllerGetUsersInViewV4().');
}
const queryParameters = {};
if (requestParameters['limit'] != null) {
queryParameters['limit'] = requestParameters['limit'];
}
if (requestParameters['offset'] != null) {
queryParameters['offset'] = requestParameters['offset'];
}
if (requestParameters['countOnly'] != null) {
queryParameters['countOnly'] = requestParameters['countOnly'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication
}
let urlPath = `/v4/users/viewId/{viewId}`;
urlPath = urlPath.replace(`{${"viewId"}}`, encodeURIComponent(String(requestParameters['viewId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4UsersGetUsersInViewResponseDtoFromJSON(jsonValue));
}
/**
* Get Users In View Documentation
* Get users with a specific viewId
*/
async v4UsersControllerGetUsersInViewV4(requestParameters, initOverrides) {
const response = await this.v4UsersControllerGetUsersInViewV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get Users Documentation
* Get users with optional viewId
*/
async v4UsersControllerGetUsersV4Raw(requestParameters, initOverrides) {
const queryParameters = {};
if (requestParameters['viewId'] != null) {
queryParameters['viewId'] = requestParameters['viewId'];
}
if (requestParameters['limit'] != null) {
queryParameters['limit'] = requestParameters['limit'];
}
if (requestParameters['offset'] != null) {
queryParameters['offset'] = requestParameters['offset'];
}
if (requestParameters['countOnly'] != null) {
queryParameters['countOnly'] = requestParameters['countOnly'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication
}
let urlPath = `/v4/users`;
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4UsersGetUsersResponseDtoFromJSON(jsonValue));
}
/**
* Get Users Documentation
* Get users with optional viewId
*/
async v4UsersControllerGetUsersV4(requestParameters = {}, initOverrides) {
const response = await this.v4UsersControllerGetUsersV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Update User Documentation
* Update a specific user by userId
*/
async v4UsersControllerUpdateUserV4Raw(requestParameters, initOverrides) {
if (requestParameters['userId'] == null) {
throw new runtime.RequiredError('userId', 'Required parameter "userId" was null or undefined when calling v4UsersControllerUpdateUserV4().');
}
if (requestParameters['v4UsersUpdateUserBodyDto'] == null) {
throw new runtime.RequiredError('v4UsersUpdateUserBodyDto', 'Required parameter "v4UsersUpdateUserBodyDto" was null or undefined when calling v4UsersControllerUpdateUserV4().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication
}
let urlPath = `/v4/users/{userId}`;
urlPath = urlPath.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters['userId'])));
const response = await this.request({
path: urlPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: V4UsersUpdateUserBodyDtoToJSON(requestParameters['v4UsersUpdateUserBodyDto']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4UsersUpdateUserResponseDtoFromJSON(jsonValue));
}
/**
* Update User Documentation
* Update a specific user by userId
*/
async v4UsersControllerUpdateUserV4(requestParameters, initOverrides) {
const response = await this.v4UsersControllerUpdateUserV4Raw(requestParameters, initOverrides);
return await response.value();
}
}