Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cord-sdk/api-types

Package Overview
Dependencies
Maintainers
12
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cord-sdk/api-types

TypeScript type definitions and JSON schema objects for the data types used by the Cord REST API

  • 1.47.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
391
increased by101.55%
Maintainers
12
Weekly downloads
 
Created
Source

@cord-sdk/api-types · GitHub license npm version

This package contains TypeScript type definitions and JSON schema objects for the data types used by the Cord REST API.

Installation

npm install @cord-sdk/api-types

TypeScript Type Definitions

To use proper type definitions for the data structures send to and received from the Cord REST API, import them from this package, e.g.:

import { PlatformUserVariables } from '@cord-sdk/api-types';

Run-Time Validation

You can use the JSON schema shipped in this package to validate data structures send to or received from the Cord REST API at run-time.

For example, to do run-time validation using the AJV package in TypeScript:

import Ajv from "ajv";
import { schema } from '@cord-sdk/api-types';
import type { PlatformUserVariables } from '@cord-sdk/api-types';

const ajv = new Ajv();

const validatePlatformUserVariables = ajv.compile<PlatformUserVariables>(schema['PlatformUserVariables']);

The validatePlatformUserVariables function takes data as an argument and returns a boolean indicating whether the given data conforms to the schema for PlatformUserVariables. The function is declared as a type guard, so if you use it as the conditional in an if statement, TypeScript understands that within the true-branch, the data is of type PlatformUserVariables.

FAQs

Package last updated on 29 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc