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
319 lines (318 loc) • 16.4 kB
TypeScript
import { AddGroupInput, AddUsersInput, Basic, ChangeUserPasswordInput, ClusterOutput, CreateUserInput, EndpointService, GroupMembersOptions, License, MailHostConfigurationInput, MailHostConfiguration, Page, PageOptions, Group, PermissionGroups, PermissionUserOutput, PermissionUsersOutput, User } from "../types";
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/groups'
*/
export declare class AdminGroupsEndpoint extends EndpointService {
constructor(auth: Basic);
/**
* 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
*/
list(filter?: string, pageOptions?: PageOptions): Promise<Page<Group>>;
/**
* Create a new group
* @param {string} name Name of the group
* @returns {Promise<Group>} Promise with the created group data
*/
create(name: string): Promise<Group>;
/**
* 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
*/
delete(name: string): Promise<Group>;
/**
* Add multiple users to a group.
* @param {AddUsersInput} addUsersInput Add users input data
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
addUsers(addUsersInput: AddUsersInput): Promise<void>;
/**
* 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
*/
members(groupMemberOptions?: GroupMembersOptions): Promise<Page<User>>;
/**
* 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
*/
nonMembers(groupMemberOptions?: GroupMembersOptions): Promise<Page<User>>;
}
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/groups'
*/
export declare class AdminUsersEndpoint extends EndpointService {
constructor(auth: Basic);
/**
* 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
*/
list(filter?: string, pageOptions?: PageOptions): Promise<Page<User>>;
/**
* 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
*/
create(userInput: CreateUserInput): Promise<void>;
/**
* Update a user's details
* @param {string} name Name of the user
* @returns {Promise<User>} Promise with the updated user data
*/
update(user: User): Promise<User>;
/**
* 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
*/
rename(oldName: string, newName: string): Promise<User>;
/**
* 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
*/
delete(name: string): Promise<User>;
/**
* Add User to a multiple groups.
* @param {AddGroupInput} addUsersInput Add users input data
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
addGroups(addGroupInput: AddGroupInput): Promise<void>;
/**
* 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
*/
removeGroup(user: string, group: string): Promise<void>;
/**
* 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
*/
groups(groupMemberOptions?: GroupMembersOptions): Promise<Page<Group>>;
/**
* 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
*/
nonGroups(groupMemberOptions?: GroupMembersOptions): Promise<Page<Group>>;
/**
* 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
*/
captcha(name: string): Promise<void>;
/**
* Update a user's password.
* @param {ChangeUserPasswordInput} changePasswordInput Change Password input data
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
changePassword(changePasswordInput: ChangeUserPasswordInput): Promise<void>;
}
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/license'
*/
export declare class AdminLicenseEndpoint extends EndpointService {
constructor(auth: Basic);
/**
* 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
*/
get(): Promise<License>;
/**
* 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
*/
update(license: string): Promise<License>;
}
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/mail-server'
*/
export declare class AdminMailServerEndpoint extends EndpointService {
/**
* 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
*/
senderAddress: () => AdminMailServerSenderAddressEndpoint;
constructor(auth: Basic);
/**
* Retrieves the current mail configuration
* @returns {Promise<MailHostConfiguration>} Promise with the mail host configuration data
*/
get(): Promise<MailHostConfiguration>;
/**
* Updates the mail configuration
* @param {MailHostConfigurationInput} mailServerInput Mail server data to update
* @returns {Promise<MailHostConfiguration>} Promise with the updated mail host configuration data
*/
update(mailServerInput: MailHostConfigurationInput): Promise<MailHostConfiguration>;
/**
* Deletes the current mail configuration
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
delete(): Promise<void>;
}
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/projects/admin/mail-server/sender-address'
*/
export declare class AdminMailServerSenderAddressEndpoint extends EndpointService {
constructor(auth: Basic);
/**
* Retrieves the server email address
* @returns {Promise<string>} Promise with the mail host configuration data
*/
get(): Promise<string>;
/**
* Updates the server email address
* @param {string} serverEmail Mail server data to update
* @returns {Promise<string>} Promise with the updated mail host configuration data
*/
update(serverEmail: string): Promise<string>;
/**
* Clears the server email address
* @returns {Promise<void>} If not throw errors, operation finish succesfully
*/
delete(): Promise<void>;
}
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/admin/permissions'
*/
export declare class AdminPermissionsEndpoint extends EndpointService {
/**
* 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
*/
users: () => AdminPermissionsUsersEndpoint;
/**
* 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
*/
groups: () => AdminPermissionsGroupsEndpoint;
constructor(auth: Basic);
}
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/admin/permissions/users'
*/
export declare class AdminPermissionsUsersEndpoint extends EndpointService {
constructor(auth: Basic);
/**
* 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.
*/
none(filter?: string, pageOptions?: PageOptions): Promise<Page<PermissionUserOutput>>;
/**
* 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.
*/
list(filter?: string, pageOptions?: PageOptions): Promise<Page<PermissionUsersOutput>>;
/**
* 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.
*/
update(name: string, permission: 'PROJECT_READ' | 'PROJECT_WRITE' | 'PROJECT_ADMIN'): Promise<void>;
/**
* 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.
*/
revoke(name: string): Promise<void>;
}
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/admin/permissions/groups'
*/
export declare class AdminPermissionsGroupsEndpoint extends EndpointService {
constructor(auth: Basic);
/**
* 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.
*/
none(filter?: string, pageOptions?: PageOptions): Promise<Page<Group>>;
/**
* 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.
*/
list(filter?: string, pageOptions?: PageOptions): Promise<Page<PermissionGroups>>;
/**
* 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.
*/
update(name: string, permission: 'LICENSED_USER' | 'PROJECT_CREATE' | 'ADMIN' | 'SYS_ADMIN'): Promise<void>;
/**
* Revoke all global permissions for a group
* @param {string} name The name of the group
* @returns {Promise<void>} If not throw errors, operation finish succesfully.
*/
revoke(name: string): Promise<void>;
}
/**
* Class to manage and expose all endpoits and operations below '/rest/api/1.0/admin/*'
* /rest/api/1.0/admin/groups
* /rest/api/1.0/admin/users/add-groups
* /rest/api/1.0/admin/cluster
* ...
*/
export declare class AdminEndpoint extends EndpointService {
/**
* Contains all operations related with group administration
* All paths and operations from '/rest/api/1.0/admin/groups'.
* @returns {AdminGroupsEndpoint} Get all operations about group administration
*/
groups: () => AdminGroupsEndpoint;
/**
* Contains all operations related with users administration
* All paths and operations from '/rest/api/1.0/admin/users'.
* @returns {AdminUsersEndpoint} Get all operations about users administration
*/
users: () => AdminUsersEndpoint;
/**
* Contains all operations related with admin licenses
* All paths and operations from '/rest/api/1.0/admin/license'.
* @returns {AdminLicenseEndpoint} Get all operations about admin licenses
*/
license: () => AdminLicenseEndpoint;
/**
* Contains all operations related with admin mail server
* All paths and operations from '/rest/api/1.0/admin/mail-server'.
* @returns {AdminMailServerEndpoint} Get all operations about admin mail server
*/
mailServer: () => AdminMailServerEndpoint;
/**
* Contains all operations related with admin permissions
* All paths and operations from '/rest/api/1.0/admin/permissions'.
* @returns {AdminPermissionsEndpoint} Get all operations about admin permissions
*/
permissions: () => AdminPermissionsEndpoint;
constructor(auth: Basic);
/**
* Gets information about the nodes that currently make up the stash cluster
* @returns {Promise<ClusterOutput>} Promise with the updated project data
*/
cluster(): Promise<ClusterOutput>;
}