stash-connector
Version:
Module to handle and work with Atlassian Stash projects and repositories throug REST API. Admin your repositories and projects in Stash easy. This project is not an Atlassian official project but use the Atlassian Stash REST API
1,112 lines • 54.8 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
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());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdminEndpoint = exports.AdminPermissionsGroupsEndpoint = exports.AdminPermissionsUsersEndpoint = exports.AdminPermissionsEndpoint = exports.AdminMailServerSenderAddressEndpoint = exports.AdminMailServerEndpoint = exports.AdminLicenseEndpoint = exports.AdminUsersEndpoint = exports.AdminGroupsEndpoint = void 0;
var types_1 = require("../types");
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/groups'
*/
var AdminGroupsEndpoint = /** @class */ (function (_super) {
__extends(AdminGroupsEndpoint, _super);
function AdminGroupsEndpoint(auth) {
return _super.call(this, auth, '/groups') || this;
}
/**
* Retrieve a page of groups
* @param {string} [filter] If specified only group names containing the supplied string will be returned
* @param {PageOptions} [pageOptions] Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<Group>>} Promise with the requested page data
*/
AdminGroupsEndpoint.prototype.list = function (filter, pageOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet({
pageOptions: pageOptions,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
if (filter) {
request.addQueryParam('filter', filter);
}
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_1 = _a.sent();
throw error_1;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Create a new group
* @param {string} name Name of the group
* @returns {Promise<Group>} Promise with the created group data
*/
AdminGroupsEndpoint.prototype.create = function (name) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
request.addQueryParam('name', name);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_2 = _a.sent();
throw error_2;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Deletes the specified group, removing them from the system. This also removes any permissions that may have been granted to the group
* @param {string} name Name of the group
* @returns {Promise<Group>} Promise with the deleted group data
*/
AdminGroupsEndpoint.prototype.delete = function (name) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_3;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doDelete();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
request.addQueryParam('name', name);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_3 = _a.sent();
throw error_3;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Add multiple users to a group.
* @param {AddUsersInput} addUsersInput Add users input data
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
AdminGroupsEndpoint.prototype.addUsers = function (addUsersInput) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_4;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost({
param: 'add-users'
}).asJson().withBody(addUsersInput);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_4 = _a.sent();
throw error_4;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Retrieves a list of users that are members of a specified group.
* @param {GroupMembersOptions} [groupMemberOptions] Group Members options including the paginations options. - pageOptions: Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<User>>} If not throw errors, operation finish succesfully
*/
AdminGroupsEndpoint.prototype.members = function (groupMemberOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_5;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost({
param: 'more-members'
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
this.processOptions(request, groupMemberOptions);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_5 = _a.sent();
throw error_5;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Retrieves a list of users that are members of a specified group.
* @param {GroupMembersOptions} [groupMemberOptions] Group Members options including the paginations options. - pageOptions: Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<User>>} If not throw errors, operation finish succesfully
*/
AdminGroupsEndpoint.prototype.nonMembers = function (groupMemberOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_6;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost({
param: 'more-non-members'
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
this.processOptions(request, groupMemberOptions);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_6 = _a.sent();
throw error_6;
case 4: return [2 /*return*/];
}
});
});
};
return AdminGroupsEndpoint;
}(types_1.EndpointService));
exports.AdminGroupsEndpoint = AdminGroupsEndpoint;
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/groups'
*/
var AdminUsersEndpoint = /** @class */ (function (_super) {
__extends(AdminUsersEndpoint, _super);
function AdminUsersEndpoint(auth) {
return _super.call(this, auth, '/users') || this;
}
/**
* Retrieve a page of users
* @param {string} [filter] If specified only users with usernames, display name or email addresses containing the supplied string will be returned
* @param {PageOptions} [pageOptions] Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<User>>} Promise with the updated project data
*/
AdminUsersEndpoint.prototype.list = function (filter, pageOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_7;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet({
pageOptions: pageOptions,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
if (filter) {
request.addQueryParam('filter', filter);
}
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_7 = _a.sent();
throw error_7;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Creates a new user from the assembled query parameters
* @param {CreateUserInput} userInput User data to create
* @returns {Promise<void>} If not throw erros, operation finish succesfully
*/
AdminUsersEndpoint.prototype.create = function (userInput) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_8;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
this.processOptions(request, userInput);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_8 = _a.sent();
throw error_8;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Update a user's details
* @param {string} name Name of the user
* @returns {Promise<User>} Promise with the updated user data
*/
AdminUsersEndpoint.prototype.update = function (user) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_9;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPut().asJson().withBody(user);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_9 = _a.sent();
throw error_9;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Rename a user
* @param {string} oldName Old Name of the user
* @param {string} newName New Name of the user
* @returns {Promise<User>} Promise with the updated user data
*/
AdminUsersEndpoint.prototype.rename = function (oldName, newName) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_10;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost({
param: 'rename'
}).asJson().withBody({
name: oldName,
newName: newName,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_10 = _a.sent();
throw error_10;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Deletes the specified user, removing them from the system. This also removes any permissions that may have been granted to the user
* @param {string} name Name of the user
* @returns {Promise<User>} Promise with the deleted user data
*/
AdminUsersEndpoint.prototype.delete = function (name) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_11;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doDelete();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
request.addQueryParam('name', name);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_11 = _a.sent();
throw error_11;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Add User to a multiple groups.
* @param {AddGroupInput} addUsersInput Add users input data
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
AdminUsersEndpoint.prototype.addGroups = function (addGroupInput) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_12;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost({
param: 'add-groups'
}).asJson().withBody(addGroupInput);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_12 = _a.sent();
throw error_12;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Remove a user from a group.
* @param {string} user The username to remove it
* @param {string} group The group to remove from
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
AdminUsersEndpoint.prototype.removeGroup = function (user, group) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_13;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost({
param: 'remove-group'
}).asJson().withBody({
context: user,
itemName: group,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_13 = _a.sent();
throw error_13;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Retrieves a list of groups the specified user is a member of.
* @param {GroupMembersOptions} [groupMemberOptions] Group Members options including the paginations options. - pageOptions: Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<Group>>} If not throw errors, operation finish succesfully
*/
AdminUsersEndpoint.prototype.groups = function (groupMemberOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_14;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost({
param: 'more-members'
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
this.processOptions(request, groupMemberOptions);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_14 = _a.sent();
throw error_14;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Retrieves a list of groups the specified user is not a member of.
* @param {GroupMembersOptions} [groupMemberOptions] Group Members options including the paginations options. - pageOptions: Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<Group>>} If not throw errors, operation finish succesfully
*/
AdminUsersEndpoint.prototype.nonGroups = function (groupMemberOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_15;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost({
param: 'more-non-members'
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
this.processOptions(request, groupMemberOptions);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_15 = _a.sent();
throw error_15;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Clears any CAPTCHA challenge that may constrain the user with the supplied username when they authenticate. Additionally any counter or metric that contributed towards the user being issued the CAPTCHA challenge (for instance too many consecutive failed logins) will also be reset
* @param {string} [name] The username to clear captchas
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
AdminUsersEndpoint.prototype.captcha = function (name) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_16;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doDelete({
param: 'captcha'
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
request.addQueryParam('name', name);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_16 = _a.sent();
throw error_16;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Update a user's password.
* @param {ChangeUserPasswordInput} changePasswordInput Change Password input data
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
AdminUsersEndpoint.prototype.changePassword = function (changePasswordInput) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_17;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPut({
param: 'credentials'
}).asJson().withBody(changePasswordInput);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
request.addQueryParam('name', name);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_17 = _a.sent();
throw error_17;
case 4: return [2 /*return*/];
}
});
});
};
return AdminUsersEndpoint;
}(types_1.EndpointService));
exports.AdminUsersEndpoint = AdminUsersEndpoint;
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/license'
*/
var AdminLicenseEndpoint = /** @class */ (function (_super) {
__extends(AdminLicenseEndpoint, _super);
function AdminLicenseEndpoint(auth) {
return _super.call(this, auth, '/license') || this;
}
/**
* Retrieves details about the current license, as well as the current status of the system with regards to the installed license.
* The status includes the current number of users applied toward the license limit, as well as any status messages about the license
* (warnings about expiry or user counts exceeding license limits).
* @returns {Promise<License>} Promise with the updated project data
*/
AdminLicenseEndpoint.prototype.get = function () {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_18;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_18 = _a.sent();
throw error_18;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Decodes the provided encoded license and sets it as the active license.
* If no license was provided, a 400 is returned. If the license cannot be decoded, or cannot be applied, a 409 is returned
* @param {string} license new license to update
* @returns {Promise<License>} Promise with the updated project data
*/
AdminLicenseEndpoint.prototype.update = function (license) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_19;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPost().asJson().withBody({
license: license,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_19 = _a.sent();
throw error_19;
case 4: return [2 /*return*/];
}
});
});
};
return AdminLicenseEndpoint;
}(types_1.EndpointService));
exports.AdminLicenseEndpoint = AdminLicenseEndpoint;
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/mail-server'
*/
var AdminMailServerEndpoint = /** @class */ (function (_super) {
__extends(AdminMailServerEndpoint, _super);
function AdminMailServerEndpoint(auth) {
var _this = _super.call(this, auth, '/mail-server') || this;
/**
* Contains all operations related with mail server sender address administration
* All paths and operations from '/rest/api/1.0/admin/mail-server/sender-address'.
* @returns {AdminMailServerSenderAddressEndpoint} Get all operations about mail server sender address administration
*/
_this.senderAddress = function () {
return new AdminMailServerSenderAddressEndpoint(_this.auth);
};
return _this;
}
/**
* Retrieves the current mail configuration
* @returns {Promise<MailHostConfiguration>} Promise with the mail host configuration data
*/
AdminMailServerEndpoint.prototype.get = function () {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_20;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_20 = _a.sent();
throw error_20;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Updates the mail configuration
* @param {MailHostConfigurationInput} mailServerInput Mail server data to update
* @returns {Promise<MailHostConfiguration>} Promise with the updated mail host configuration data
*/
AdminMailServerEndpoint.prototype.update = function (mailServerInput) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_21;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPut().asJson().withBody(mailServerInput);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_21 = _a.sent();
throw error_21;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Deletes the current mail configuration
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
AdminMailServerEndpoint.prototype.delete = function () {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_22;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doDelete();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_22 = _a.sent();
throw error_22;
case 4: return [2 /*return*/];
}
});
});
};
return AdminMailServerEndpoint;
}(types_1.EndpointService));
exports.AdminMailServerEndpoint = AdminMailServerEndpoint;
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/mail-server/sender-address'
*/
var AdminMailServerSenderAddressEndpoint = /** @class */ (function (_super) {
__extends(AdminMailServerSenderAddressEndpoint, _super);
function AdminMailServerSenderAddressEndpoint(auth) {
return _super.call(this, auth, '/sender-address') || this;
}
/**
* Retrieves the server email address
* @returns {Promise<string>} Promise with the mail host configuration data
*/
AdminMailServerSenderAddressEndpoint.prototype.get = function () {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_23;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_23 = _a.sent();
throw error_23;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Updates the server email address
* @param {string} serverEmail Mail server data to update
* @returns {Promise<string>} Promise with the updated mail host configuration data
*/
AdminMailServerSenderAddressEndpoint.prototype.update = function (serverEmail) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_24;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPut().asJson().withBody(serverEmail);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_24 = _a.sent();
throw error_24;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Clears the server email address
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
AdminMailServerSenderAddressEndpoint.prototype.delete = function () {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_25;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doDelete();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_25 = _a.sent();
throw error_25;
case 4: return [2 /*return*/];
}
});
});
};
return AdminMailServerSenderAddressEndpoint;
}(types_1.EndpointService));
exports.AdminMailServerSenderAddressEndpoint = AdminMailServerSenderAddressEndpoint;
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/admin/permissions'
*/
var AdminPermissionsEndpoint = /** @class */ (function (_super) {
__extends(AdminPermissionsEndpoint, _super);
function AdminPermissionsEndpoint(auth) {
var _this = _super.call(this, auth, '/permissions') || this;
/**
* Contains all operations related with admin user permissions
* All paths and operations from '/rest/api/1.0/admin/permissions/users'.
* @returns {AdminPermissionsUsersEndpoint} Get all operations about admin user permissions
*/
_this.users = function () {
return new AdminPermissionsUsersEndpoint(_this.auth);
};
/**
* Contains all operations related with admin groups permissions
* All paths and operations from '/rest/api/1.0/admin/permissions/groups'.
* @returns {AdminPermissionsGroupsEndpoint} Get all operations about admin groups permissions
*/
_this.groups = function () {
return new AdminPermissionsGroupsEndpoint(_this.auth);
};
return _this;
}
return AdminPermissionsEndpoint;
}(types_1.EndpointService));
exports.AdminPermissionsEndpoint = AdminPermissionsEndpoint;
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/admin/permissions/users'
*/
var AdminPermissionsUsersEndpoint = /** @class */ (function (_super) {
__extends(AdminPermissionsUsersEndpoint, _super);
function AdminPermissionsUsersEndpoint(auth) {
return _super.call(this, auth, '/users') || this;
}
/**
* Retrieve a page of users that have no granted global permissions.
* @param {string} [filter] If specified only user names containing the supplied string will be returned
* @param {PageOptions} [pageOptions] Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<PermissionUserOutput>>} Promise with the requested page data.
*/
AdminPermissionsUsersEndpoint.prototype.none = function (filter, pageOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_26;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet({
param: 'none',
pageOptions: pageOptions,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
if (filter) {
request.addQueryParam('filter', filter);
}
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_26 = _a.sent();
throw error_26;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Retrieve a page of users that have been granted at least one global permission.
* @param {string} [filter] If specified only user names containing the supplied string will be returned
* @param {PageOptions} [pageOptions] Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<PermissionUsersOutput>>} Promise with the requested page data.
*/
AdminPermissionsUsersEndpoint.prototype.list = function (filter, pageOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_27;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet({
pageOptions: pageOptions,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
if (filter) {
request.addQueryParam('filter', filter);
}
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_27 = _a.sent();
throw error_27;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Promote or demote the global permission level of a user.
* @param {string} name The name of the user
* @param {string} permission The permission to grant
* @returns {Promise<void>} If not throw errors, operation finish succesfully.
*/
AdminPermissionsUsersEndpoint.prototype.update = function (name, permission) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_28;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPut();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
request.addQueryParam('name', name);
request.addQueryParam('permission', permission);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_28 = _a.sent();
throw error_28;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Revoke all global permissions for a user
* @param {string} name The name of the user
* @returns {Promise<void>} If not throw errors, operation finish succesfully.
*/
AdminPermissionsUsersEndpoint.prototype.revoke = function (name) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_29;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doDelete();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
request.addQueryParam('name', name);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_29 = _a.sent();
throw error_29;
case 4: return [2 /*return*/];
}
});
});
};
return AdminPermissionsUsersEndpoint;
}(types_1.EndpointService));
exports.AdminPermissionsUsersEndpoint = AdminPermissionsUsersEndpoint;
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/admin/permissions/groups'
*/
var AdminPermissionsGroupsEndpoint = /** @class */ (function (_super) {
__extends(AdminPermissionsGroupsEndpoint, _super);
function AdminPermissionsGroupsEndpoint(auth) {
return _super.call(this, auth, '/groups') || this;
}
/**
* Retrieve a page of groups that have no granted global permissions
* @param {string} [filter] If specified only group names containing the supplied string will be returned
* @param {PageOptions} [pageOptions] Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<Group>>} Promise with the requested page data.
*/
AdminPermissionsGroupsEndpoint.prototype.none = function (filter, pageOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_30;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet({
param: 'none',
pageOptions: pageOptions,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
if (filter) {
request.addQueryParam('filter', filter);
}
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_30 = _a.sent();
throw error_30;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Retrieve a page of groups that have been granted at least one global permission.
* @param {string} [filter] If specified only group names containing the supplied string will be returned
* @param {PageOptions} [pageOptions] Page options to paginate results (or obtain more results per page)
* @returns {Promise<Page<PermissionGroups>>} Promise with the requested page data.
*/
AdminPermissionsGroupsEndpoint.prototype.list = function (filter, pageOptions) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_31;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doGet({
pageOptions: pageOptions,
});
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
if (filter) {
request.addQueryParam('filter', filter);
}
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/, result.data];
case 3:
error_31 = _a.sent();
throw error_31;
case 4: return [2 /*return*/];
}
});
});
};
/**
* Promote or demote a user's global permission level
* @param {string} name The name of the group
* @param {string} permission The permission to grant
* @returns {Promise<void>} If not throw errors, operation finish succesfully.
*/
AdminPermissionsGroupsEndpoint.prototype.update = function (name, permission) {
return __awaiter(this, void 0, void 0, function () {
var request, result, error_32;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = this.doPut();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
request.addQueryParam('name', name);
request.addQueryParam('permission', permission);
return [4 /*yield*/, request.execute()];
case 2:
result = _a.sent();
return [2 /*return*/];
case 3:
error_32 = _a.sent();
throw error_32;
case 4: return [2 /*return*/];
}
});
});
};
/*