npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dcs-js

v1.4.1

Published

OpenAPI client for DCS (Door43 Content Service)

Downloads

30

Readme

Consuming

Installation

dcs-js is available as an npm package 📦.

npm:

npm install dcs-js

yarn:

yarn add dcs-js

pnpm:

pnpm add dcs-js

API

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

Usage

Object-oriented interface

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:

  • AdminApi
  • CatalogApi
  • IssueApi
  • MiscellaneousApi
  • NotificationApi
  • OrganizationApi
  • PackageApi
  • RepositoryApi
  • SettingsApi
  • UserApi
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);
}

Edit Button

Functional programming interface

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:

  • AdminApiFp
  • CatalogApiFp
  • IssueApiFp
  • MiscellaneousApiFp
  • NotificationApiFp
  • OrganizationApiFp
  • PackageApiFp
  • RepositoryApiFp
  • SettingsApiFp
  • UserApiFp
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);
}

Edit Button

Factory interface

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:

  • AdminApiFactory
  • CatalogApiFactory
  • IssueApiFactory
  • MiscellaneousApiFactory
  • NotificationApiFactory
  • OrganizationApiFactory
  • PackageApiFactory
  • RepositoryApiFactory
  • SettingsApiFactory
  • UserApiFactory
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);
}

Edit Button

Contributing

This library is generated using @openapitools/openapi-generator-cli package, which creates a Door43 Content Service TypeScript/JavaScript client that utilizes axios.

Regenerating the library

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.

Regenearating the documentation

To regenerate docs use the docmd and dochtml scripts defined in package.json

yarn docmd

yarn dochtml

Building

To build and compile the typescript sources to javascript use:

yarn

yarn build

Publishing

First build the package then run yarn publish

For beta versions use the beta tag: yarn publish --tag beta

Other available tags:

  • next: for release candidates

check: How to work with npm tags

Create an issue on this repo to suggest new tags.


Open Components Ecosystem 🧩

dcs-js is part ot the Open Components Ecosystem, a set of reusable building blocks for Bible technology.

Open Components Ecosystem