mattermost/e2e-tests/cypress/tests/support/api/role.d.ts
Angel Mendez 23623fc9c9
MM-47288 refactor: convert channels/channel/ files to ts (#28483)
* refactor: convert channels/channel/ files to ts

- convert js files to typescript
- update types
- fix lint issues

Fixes: 21299

* fix: solve lint issues channels/channel

- fix lint issues
- udpate types

* fix: adjustment to test case MM-T1687

- code reorganization for test case MM-T1687

* fix: update types on function apiCreateCustomAdmin

- update types for apiCreateCustomAdmin on  user.d.ts so that
lint issue is solved
2024-10-09 11:22:45 +00:00

69 lines
2.4 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/// <reference types="cypress" />
// ***************************************************************
// Each command should be properly documented using JSDoc.
// See https://jsdoc.app/index.html for reference.
// Basic requirements for documentation are the following:
// - Meaningful description
// - Specific link to https://api.mattermost.com
// - Each parameter with `@params`
// - Return value with `@returns`
// - Example usage with `@example`
// Custom command should follow naming convention of having `api` prefix, e.g. `apiLogin`.
// ***************************************************************
declare namespace Cypress {
interface Chainable {
/**
* Get a role from the provided role name.
* See https://api.mattermost.com/#tag/roles/paths/~1roles~1name~1{role_name}/get
* @param {string} name - role name, e.g. 'system_user'
* @returns {Role} `out.role` as `Role`
*
* @example
* cy.getRoleByName('system_user').then(({role}) => {
* // do something with role
* });
*/
getRoleByName(name: string): Chainable<Role>;
/**
* Get a list of roles by name.
* See https://api.mattermost.com/#tag/roles/paths/~1roles~1names/post
* @param {string[]} names - list of role names, e.g. ['system_user']
* @returns {Role[]} `out.roles` as list of `Role` objects
*
* @example
* cy.apiGetRolesByNames(['system_user']).then(({roles}) => {
* // do something with roles
* });
*/
apiGetRolesByNames(names: string[]): Chainable<{roles: Role[]}>;
/**
* Patch a role by ID.
* See https://api.mattermost.com/#tag/roles/paths/~1roles~1{role_id}~1patch/put
* @param {string} id - role ID
* @param {Permissions} patch.permissions - permissions
* @returns {Role} `out.role` as `Role`
*
* @example
* cy.apiPatchRole('role_id', patch).then(({role}) => {
* // do something with role
* });
*/
apiPatchRole(id: string, patch: Record<string, any>): Chainable<Role>;
/**
* Reset roles to default values.
*
* @example
* cy.apiResetRoles();
*/
apiResetRoles();
}
}