UNPKG

@devopness/sdk-js

Version:

Devopness API JS/TS SDK - Painless essential DevOps to everyone

214 lines (213 loc) 9.13 kB
"use strict"; /* eslint-disable */ /** * devopness API * Devopness API - Painless essential DevOps to everyone * * The version of the OpenAPI document: latest * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.UsersApiService = void 0; const ApiBaseService_1 = require("../../../services/ApiBaseService"); const ApiResponse_1 = require("../../../common/ApiResponse"); const Exceptions_1 = require("../../../common/Exceptions"); /** * UsersApiService - Auto-generated */ class UsersApiService extends ApiBaseService_1.ApiBaseService { /** * * @summary Sign up/register a new user * @param {UserCreate} userCreate A JSON object containing the resource data */ addUser(userCreate) { return __awaiter(this, void 0, void 0, function* () { if (userCreate === null || userCreate === undefined) { throw new Exceptions_1.ArgumentNullException('userCreate', 'addUser'); } let queryString = ''; const requestUrl = '/users' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl, userCreate); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get a user by ID or URL Slug * @param {string} userId The numeric ID or URL Slug of a user. */ getUser(userId) { return __awaiter(this, void 0, void 0, function* () { if (userId === null || userId === undefined) { throw new Exceptions_1.ArgumentNullException('userId', 'getUser'); } let queryString = ''; const requestUrl = '/users/{user_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"user_id"}}`, encodeURIComponent(String(userId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get activity information for a user * @param {string} userId The numeric ID or URL Slug of a user. */ getUserActivity(userId) { return __awaiter(this, void 0, void 0, function* () { if (userId === null || userId === undefined) { throw new Exceptions_1.ArgumentNullException('userId', 'getUserActivity'); } let queryString = ''; const requestUrl = '/users/{user_id}/activity' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"user_id"}}`, encodeURIComponent(String(userId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get current user\'s billing info for active subscription */ getUserBilling() { return __awaiter(this, void 0, void 0, function* () { let queryString = ''; const requestUrl = '/users/billing' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Logout/revoke an existing token */ getUserLogout() { return __awaiter(this, void 0, void 0, function* () { let queryString = ''; const requestUrl = '/users/logout' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get details of the current user */ getUserMe() { return __awaiter(this, void 0, void 0, function* () { let queryString = ''; const requestUrl = '/users/me' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get the authenticated user\'s URLs */ getUserUrls() { return __awaiter(this, void 0, void 0, function* () { let queryString = ''; const requestUrl = '/users/urls' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Login/create a new token for the given credentials * @param {UserLogin} userLogin A JSON object containing the resource data */ loginUser(userLogin) { return __awaiter(this, void 0, void 0, function* () { if (userLogin === null || userLogin === undefined) { throw new Exceptions_1.ArgumentNullException('userLogin', 'loginUser'); } let queryString = ''; const requestUrl = '/users/login' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl, userLogin); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Refresh an existing user access token * @param {UserRefreshToken} userRefreshToken A JSON object containing the resource data */ refreshTokenUser(userRefreshToken) { return __awaiter(this, void 0, void 0, function* () { if (userRefreshToken === null || userRefreshToken === undefined) { throw new Exceptions_1.ArgumentNullException('userRefreshToken', 'refreshTokenUser'); } let queryString = ''; const requestUrl = '/users/refresh-token' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl, userRefreshToken); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Resend the verification email * @param {UserResendVerification} userResendVerification A JSON object containing the resource data */ resendVerificationUser(userResendVerification) { return __awaiter(this, void 0, void 0, function* () { if (userResendVerification === null || userResendVerification === undefined) { throw new Exceptions_1.ArgumentNullException('userResendVerification', 'resendVerificationUser'); } let queryString = ''; const requestUrl = '/users/account/resend-verification' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl, userResendVerification); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Update an existing user * @param {string} userId The ID of the user. * @param {UserUpdate} userUpdate A JSON object containing the resource data */ updateUser(userId, userUpdate) { return __awaiter(this, void 0, void 0, function* () { if (userId === null || userId === undefined) { throw new Exceptions_1.ArgumentNullException('userId', 'updateUser'); } if (userUpdate === null || userUpdate === undefined) { throw new Exceptions_1.ArgumentNullException('userUpdate', 'updateUser'); } let queryString = ''; const requestUrl = '/users/{user_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.put(requestUrl.replace(`{${"user_id"}}`, encodeURIComponent(String(userId))), userUpdate); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Activate the user account * @param {UserVerify} userVerify A JSON object containing the resource data */ verifyUser(userVerify) { return __awaiter(this, void 0, void 0, function* () { if (userVerify === null || userVerify === undefined) { throw new Exceptions_1.ArgumentNullException('userVerify', 'verifyUser'); } let queryString = ''; const requestUrl = '/users/account/verify' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl, userVerify); return new ApiResponse_1.ApiResponse(response); }); } } exports.UsersApiService = UsersApiService;