@zeushq/zstatus-node
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

zstatus-node

Install

npm i zstatus-node or yarn add zstatus-node

Documentation

https://docs.zstatus.io

Create an API Client

Create an API key for your page on the Api Keys tab of your page management dashboard.

const api = new ZStatusClient({
  apiKey: "[API_KEY]"
});

Pagination

ZStatus uses cursor based pagination with the following param structure:

interface APIPaginationArgs {
  skip?: number;
  take?: number;
  after?: string; // record ID or cursor
  before?: string; // record ID or cursor
  first?: number;
  last?: number;
}

Search a resource

const services = await api.getServices({ })

Searches will return the following paginated response structure:

interface PaginatedResponse<T> {
  edges: APINode<T>[];
  totalCount: number;
  pageInfo: APIPageInfo;
}

interface APINode<T> {
  cursor: string;
  node: T;
}

interface APIPageInfo {
  hasNextPage: boolean;
  hasPreviousPage: boolean;
  startCursor?: string;
  endCursor?: string;
}

Get a resource record

const services = await api.getService("cl4ws9q7e0213tovc0kd5rl8m")

Create a resource record

const service = await api.createService({ 
  name: "API"
})

Update a resource record

const service = await api.updateService("cl4ws9q7e0213tovc0kd5rl8m", { 
  name: "Frontend"
})

Delete a resource record

const result = await api.deleteService("cl4ws9q7e0213tovc0kd5rl8m")

Resources

  • ApiKey
  • Incident
  • Integration
  • Invitation
  • Member
  • Service
  • ServiceGroup
  • StatusOption
  • Subscription

Readme

Keywords

Package Sidebar

Install

npm i @zeushq/zstatus-node

Weekly Downloads

1

Version

1.0.5

License

ISC

Unpacked Size

39.5 kB

Total Files

34

Last publish

Collaborators

  • eric_zeusdev