Skip to content

Latest commit

 

History

History
380 lines (274 loc) · 28.3 KB

File metadata and controls

380 lines (274 loc) · 28.3 KB

Roles

Overview

Operations about Roles

Available Operations

listRoles

Get all roles in the organization

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<components.RoleEntityPaginated>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

createRole

Create a new role

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<components.PublicApiv1RoleEntity>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

getRole

Get a role

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<components.PublicApiv1RoleEntity>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

deleteRole

Delete a role

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<void>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

updateRole

Update a role

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<components.PublicApiv1RoleEntity>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*