Blockstream Enterprise
ReferenceAPI ReferenceRoles

Create Roles

Create Roles.

Request

RolesCreateRequest
interface RolesCreateRequest {
  action: 'add'
  resource: '/roles'
  details: {
    rid: string
    name: string
    description: string
    rules: string[]
  }
}

Prop

Type

Response

RolesCreateResponse_success
interface RolesCreateResponse_success {
  status: 'success'
  error_code?: '-1' | '-2' | '-3' | '-4' | '-5' | '-6' | '-7' | '-8' | '-9' | '-10' | '-11' | '-12' | '-13' | undefined
  message?: string | undefined
  details: {
    rid: string
    name: string
    description: string | undefined
    status: 'active' | 'disabled'
    rules: string[] | undefined
    created_at: string
  }
  metadata: unknown
}

Prop

Type

RolesCreateResponse_pending
interface RolesCreateResponse_pending {
  status: 'pending'
  error_code?: '-1' | '-2' | '-3' | '-4' | '-5' | '-6' | '-7' | '-8' | '-9' | '-10' | '-11' | '-12' | '-13' | undefined
  message?: string | undefined
  details: {
    proposal_id: string
  }
}

Prop

Type

RolesCreateResponse_failed | unauthorized | rejected
interface RolesCreateResponse_failed | unauthorized | rejected {
  status: 'failed' | 'unauthorized' | 'rejected'
  error_code?: '-1' | '-2' | '-3' | '-4' | '-5' | '-6' | '-7' | '-8' | '-9' | '-10' | '-11' | '-12' | '-13' | undefined
  message?: string | undefined
}

Prop

Type

Example

Example
import { resourceSchema } from '@blockstream/ecs-js-sdk'
import { broadcastRequest } from './broadcaster'

const response = await broadcastRequest<
  typeof resourceSchema.shape.roles.shape.create
>(
  {
    action: 'add',
    resource: '/roles',
    details: {
      // TODO: fill in required fields
    },
  },
  blockstream,
)

On this page