Skip to content

Latest commit

 

History

History
389 lines (295 loc) · 6.81 KB

File metadata and controls

389 lines (295 loc) · 6.81 KB

Sandbox API

Usage

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.sandbox.listPipelines(...)

Tree-shakeable import

import { getClient, authorize } from '@epilot/sdk/sandbox'

const sandboxClient = getClient()
authorize(sandboxClient, () => '<token>')
const { data } = await sandboxClient.listPipelines(...)

Operations

Pipelines

Sandbox Requests

Schemas

listPipelines

List pipelines the current organization is part of

GET /v1/sandbox/pipelines

const { data } = await client.listPipelines()
Response
{
  "results": [
    {
      "pipeline_role": "sandbox",
      "pipeline_id": "12345::54321",
      "sandbox_org_id": "12345",
      "sandbox_org_name": "Sandbox",
      "production_org_id": "54321",
      "production_org_name": "Production",
      "created_at": "1970-01-01T00:00:00.000Z"
    }
  ],
  "total": 1
}

createPipeline

Create a new pipeline by passing an api token from another organization.

POST /v1/sandbox/pipelines

const { data } = await client.createPipeline(
  null,
  {
    pipeline_role: 'sandbox',
    api_token: 'eyJhbGciOiJIUzI1NiIs...'
  },
)
Response
{
  "pipeline_role": "sandbox",
  "pipeline_id": "12345::54321",
  "sandbox_org_id": "12345",
  "sandbox_org_name": "Sandbox",
  "production_org_id": "54321",
  "production_org_name": "Production",
  "created_at": "1970-01-01T00:00:00.000Z"
}

getPipeline

Get pipeline by ID

GET /v1/sandbox/pipelines/{pipeline_id}

const { data } = await client.getPipeline({
  pipeline_id: 'example',
})
Response
{
  "pipeline_role": "sandbox",
  "pipeline_id": "12345::54321",
  "sandbox_org_id": "12345",
  "sandbox_org_name": "Sandbox",
  "production_org_id": "54321",
  "production_org_name": "Production",
  "created_at": "1970-01-01T00:00:00.000Z"
}

deletePipeline

Delete a pipeline by ID

DELETE /v1/sandbox/pipelines/{pipeline_id}

const { data } = await client.deletePipeline({
  pipeline_id: 'example',
})
Response
{
  "pipeline_role": "sandbox",
  "pipeline_id": "12345::54321",
  "sandbox_org_id": "12345",
  "sandbox_org_name": "Sandbox",
  "production_org_id": "54321",
  "production_org_name": "Production",
  "created_at": "1970-01-01T00:00:00.000Z"
}

generatePipelineToken

Generate a temporary pipeline access token to access the other org from the pipeline

GET /v1/sandbox/pipelines/{pipeline_id}/token

const { data } = await client.generatePipelineToken({
  pipeline_id: 'example',
})
Response
{
  "pipeline_token": "eyJhbGciOiJIUzI1NiIs..."
}

requestSandbox

Request a sandbox account for a user

POST /v1/sandbox:request

const { data } = await client.requestSandbox(
  null,
  {
    id: 12345,
    fullname: 'John Doe',
    company_name: 'Company Name',
    position: 'Software Engineer',
    email: 'user@example.com',
    sandbox_usecase: 'Build a payment integration',
    status: 'pending',
    connected_to_existing_epilot_customer: true,
    requested_at: '2022-01-01T00:00:00Z',
    sandbox_request_category: 'APP_DEVELOPER_ACCOUNT'
  },
)
Response
{
  "id": 12345,
  "fullname": "John Doe",
  "company_name": "Company Name",
  "position": "Software Engineer",
  "email": "user@example.com",
  "sandbox_usecase": "Build a payment integration",
  "status": "pending",
  "connected_to_existing_epilot_customer": true,
  "requested_at": "2022-01-01T00:00:00Z",
  "sandbox_request_category": "APP_DEVELOPER_ACCOUNT"
}

listSandboxRequests

List sandbox requests from users

GET /v1/sandbox/requests

const { data } = await client.listSandboxRequests()
Response
{
  "results": [
    {
      "id": 12345,
      "fullname": "John Doe",
      "company_name": "Company Name",
      "position": "Software Engineer",
      "email": "user@example.com",
      "sandbox_usecase": "Build a payment integration",
      "status": "pending",
      "connected_to_existing_epilot_customer": true,
      "requested_at": "2022-01-01T00:00:00Z",
      "sandbox_request_category": "APP_DEVELOPER_ACCOUNT"
    }
  ],
  "total": 1
}

Schemas

OrgId

Epilot Tenant Organization ID

type OrgId = string

PipelineId

Unique identifier for a pipeline.

The format for a pipeline is: <sandbox_org>`::`<production_org>

type PipelineId = string

PipelineRole

The role of the other organization in the pipeline from the perspective of the caller's organization

type PipelineRole = "sandbox" | "production"

PipelineItem

type PipelineItem = {
  pipeline_id?: string
  sandbox_org_id?: object
  sandbox_org_name?: string
  production_org_id?: string
  production_org_name?: string
  created_at?: string // date-time
}

Pipeline

type Pipeline = {
  pipeline_role?: "sandbox" | "production"
  pipeline_id?: string
  sandbox_org_id?: object
  sandbox_org_name?: string
  production_org_id?: string
  production_org_name?: string
  created_at?: string // date-time
}

CreatePipelineRequest

type CreatePipelineRequest = {
  pipeline_role: "sandbox" | "production"
  api_token: object
}

AccessToken

An epilot access token

type AccessToken = string

SandboxToken

type SandboxToken = object

PipelineToken

type PipelineToken = object

SandboxRequest

type SandboxRequest = {
  id?: string
  fullname: string
  company_name: string
  position: string
  email: string // email
  sandbox_usecase: string
  status?: "pending" | "created" | "rejected"
  connected_to_existing_epilot_customer: boolean
  requested_at?: string // date-time
  sandbox_request_category?: "APP_DEVELOPER_ACCOUNT" | "BLUEPRINT_SANDBOX" | "OTHER"
}