🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@lincs.project/lincs-api-contracts

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lincs.project/lincs-api-contracts

Contracts for the LINCS-API

latest
Source
npmnpm
Version
1.1.6
Version published
Maintainers
0
Created
Source

LINCS-API Contracts

Defines the contract for the LINCS API. It uses TS-REST in combination with Zod to determine the request and response objects. These objects can be used to validate calls to each endpoint.

This contract package can be used to build a TypeScript helper to access the endpoints of the LINCS API using a standardized fetcher. It allows for better endpoint discoverability and fully typed request parameters and responses. The API contract is also available to create a custom fetcher.

It must be used in conjunction with @ts-rest/core

How to use the client helper

Install

npm install @lincs.project/lincs-api-contracts @ts-rest/core

Create the client Adapter and use it

import { contracts } from '@lincs.project/lincs-api-contracts';
import { initClient } from '@ts-rest/core';

const lincsAdapter = initClient(contracts, {
  baseUrl: 'https://lincs-api.lincsproject.ca',
  baseHeaders: {}
});

const response = await lincsAdapter.api.language.getLanguages();

if (response === 200) {
  console.log(response.body);
  // ["en", "fr"]

Endpoints

Here is a list of the endpoints that can be accessed under .api with this contract client:

annotations
dataset
entity
group
language
link
linked
links
ner
person
place
readToken
work

Exported types

Here is a list of types exported by the package:

Annotation
AnnotationsResponse
DigitalObject
EntityQuery
EntityResponse
Entity
FilteredEntityQuery
GroupResponse
LinksQuery
LinkMatch
LinkRequest
LinkResult
NerEntities
SimpleEntity
SimpleEntityQuery
SimpleStatement
SimpleStatementResponse
Statement
PersonResponse
PlaceResponse
Resource
TokenResponse
WorkResponse

Development

This package is maintained in the LINCS API repository.

FAQs

Package last updated on 07 Jul 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