Operations about Roles
- listRoles - Get all roles
- createRole - Create a role
- getRole - Get a role
- deleteRole - Delete a role
- updateRole - Update a role
Get all roles in the organization
import { Firehydrant } from "firehydrant-typescript-sdk";
const firehydrant = new Firehydrant({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const result = await firehydrant.roles.listRoles({});
console.log(result);
}
run();The standalone function version of this method:
import { FirehydrantCore } from "firehydrant-typescript-sdk/core.js";
import { rolesListRoles } from "firehydrant-typescript-sdk/funcs/rolesListRoles.js";
// Use `FirehydrantCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const firehydrant = new FirehydrantCore({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const res = await rolesListRoles(firehydrant, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("rolesListRoles failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListRolesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.RoleEntityPaginated>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Create a new role
import { Firehydrant } from "firehydrant-typescript-sdk";
const firehydrant = new Firehydrant({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const result = await firehydrant.roles.createRole({
name: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { FirehydrantCore } from "firehydrant-typescript-sdk/core.js";
import { rolesCreateRole } from "firehydrant-typescript-sdk/funcs/rolesCreateRole.js";
// Use `FirehydrantCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const firehydrant = new FirehydrantCore({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const res = await rolesCreateRole(firehydrant, {
name: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("rolesCreateRole failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.CreateRole | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.PublicApiv1RoleEntity>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Get a role
import { Firehydrant } from "firehydrant-typescript-sdk";
const firehydrant = new Firehydrant({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const result = await firehydrant.roles.getRole({
id: "<id>",
});
console.log(result);
}
run();The standalone function version of this method:
import { FirehydrantCore } from "firehydrant-typescript-sdk/core.js";
import { rolesGetRole } from "firehydrant-typescript-sdk/funcs/rolesGetRole.js";
// Use `FirehydrantCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const firehydrant = new FirehydrantCore({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const res = await rolesGetRole(firehydrant, {
id: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("rolesGetRole failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetRoleRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.PublicApiv1RoleEntity>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Delete a role
import { Firehydrant } from "firehydrant-typescript-sdk";
const firehydrant = new Firehydrant({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
await firehydrant.roles.deleteRole({
id: "<id>",
});
}
run();The standalone function version of this method:
import { FirehydrantCore } from "firehydrant-typescript-sdk/core.js";
import { rolesDeleteRole } from "firehydrant-typescript-sdk/funcs/rolesDeleteRole.js";
// Use `FirehydrantCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const firehydrant = new FirehydrantCore({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const res = await rolesDeleteRole(firehydrant, {
id: "<id>",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("rolesDeleteRole failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteRoleRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<void>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Update a role
import { Firehydrant } from "firehydrant-typescript-sdk";
const firehydrant = new Firehydrant({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const result = await firehydrant.roles.updateRole({
id: "<id>",
updateRole: {
name: "<value>",
},
});
console.log(result);
}
run();The standalone function version of this method:
import { FirehydrantCore } from "firehydrant-typescript-sdk/core.js";
import { rolesUpdateRole } from "firehydrant-typescript-sdk/funcs/rolesUpdateRole.js";
// Use `FirehydrantCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const firehydrant = new FirehydrantCore({
apiKey: process.env["FIREHYDRANT_API_KEY"] ?? "",
});
async function run() {
const res = await rolesUpdateRole(firehydrant, {
id: "<id>",
updateRole: {
name: "<value>",
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("rolesUpdateRole failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UpdateRoleRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.PublicApiv1RoleEntity>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |