Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
A Door43 Content Service 🔗 API client that makes it easier to use DCS API 🔗 🚀.
dcs-js is available as an npm package 📦.
npm:
npm install dcs-js
yarn:
yarn add dcs-js
pnpm:
pnpm add dcs-js
dcs-js exposes a set of functions , factories and classes that should be instantiated to gain access to request methods.
A list of these exported modules can be found in: /documentation/modules.md or dcs-js.netlify.app
dcs-js exposes each of the DCS API operations as methods organized into javascript classes.
To use this object-oriented modules first import one of the exposed Classes:
import { OrganizationApi } from "dcs-js";
Then instantiate the class and call it's requester methods as required. Each method from this class will make a request to one of the DCS API endpoints operations.
Example:
/* Import the required DCS client class. */
import { OrganizationApi } from "dcs-js";
async function dcsJsExample() {
/* Instantiate the required DCS client class. */
const organizationClient = new OrganizationApi({
/* Set the desired DCS server path */
basePath: "https://qa.door43.org/api/v1",
});
/* Make a call to required client requester method */
const organizationRequest = await organizationClient.orgGet({
org: "test_org",
});
/* Use the results */
console.log(organizationRequest);
}
dcs-js also exposes each of the DCS API operations as functions organized in javascript function generators. User will be able to use a function for each specific request.
To use this functional programming modules first import one of the exposed generators:
import { OrganizationApiFp } from "dcs-js";
Then use the generator to generate a requester function generators. Each requester function generator will generate a specific requester function that will allow the user to make a new request to one of the DCS API endpoints operations with the same params on each use.
Example:
/* Import the required DCS function generator. */
import { OrganizationApiFp } from "dcs-js";
async function dcsJsExample() {
/* Get required requester generator from dcs-js */
const { orgGet } = OrganizationApiFp({
/* Set the desired DCS server path */
basePath: "https://qa.door43.org/api/v1",
});
/* Generate a specific request function */
const getTestOrg = await orgGet("test_org");
/**
* Reuse this request function to make this same request
* to DCS API on each call as many times as needed.
*/
console.log(await getTestOrg());
setTimeOut(() => console.log(await getTestOrg()), 2000);
}
dcs-js also exposes each of the DCS API operations as functions organized in javascript factories. User will be able to use a function for each specific request.
Unlike the functional programming interface, which generate functions that, given the needed params for a specific request, generate a function that makes that very specific request to a DCS API endpoint operation o each call 😵💫; the factory interface generate functions that, given the needed params for a specific request, are able to make that request to a DCS API endpoint operation.
To use this factory modules first import one of the exposed generators:
import { OrganizationApiFactory } from "dcs-js";
Then use the generator to generate the requester function. Each requester function will allow the user to make a new request.
Example:
/* Import the required DCS function generator. */
import { OrganizationApiFp } from "dcs-js";
async function dcsJsExample() {
/* Get required requester from a dcs-js factory */
const { orgGet } = OrganizationApiFactory({
/* Set the desired DCS server path */
basePath: "https://qa.door43.org/api/v1",
});
/* Make a call to the client requester */
const organizationRequest = await orgGet("test_org");
/* Use the results */
console.log(organizationRequest);
}
This library is generated using @openapitools/openapi-generator-cli
package, which creates a Door43 Content Service TypeScript/JavaScript client that utilizes axios.
To regenerate the library run the generate
script defined in package.json
.
yarn generate
To regenearate from a different source add the source url argument:
yarn generate url.to/swagger-source.json
Then build the library.
To regenerate docs use the docmd
and dochtml
scripts defined in package.json
yarn docmd
yarn dochtml
To build and compile the typescript sources to javascript use:
yarn
yarn build
First build the package then run yarn publish
For beta versions use the beta tag:
yarn publish --tag beta
Other available tags:
check: How to work with npm tags
Create an issue on this repo to suggest new tags.
dcs-js is part ot the Open Components Ecosystem, a set of reusable building blocks for Bible technology.
FAQs
OpenAPI client for DCS (Door43 Content Service)
We found that dcs-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.