From 6cdf8ebbb214dc299399c92f087237619a3d1424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20S=C3=B8rensen?= Date: Mon, 27 May 2024 21:02:55 +0200 Subject: [PATCH] fix: Improved README --- README.md | 65 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index e14b869..94f346d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,39 @@ -## digiseg-api-client@0.0.0-dev +# Digiseg API client for TypeScript -This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: +This module provides a SDK for interacting with the Digiseg API. + +Documentation for the API can be found on https://developer.digiseg.net/ + +## Installing and using the SDK + +Install the package: + +```sh +npm i digiseg-api-client +``` + +Import the package and start using it: + +```typescript +import { AudiencesApi, Configuration } from "digiseg-api-client" + +# instantiate the API (for example AudiencesAPI) with your API key +const api = new AudiencesApi(new Configuration({ + apiKey: apiKey, +})) + +# look up audiences +api.resolveAudiencesOfSingle("152.115.123.174", "core,category").then(resp => { + console.log("Status: " + resp.data.status) + for (const audience of resp.data.audiences) { + console.log("Audience code: " + audience.code) + } +}) +``` + +## Environment and dependencies + +This library is created for TypeScript/JavaScript and utilizes [axios](https://github.com/axios/axios). The Node module can be used in the following environments: Environment * Node.js @@ -16,31 +49,3 @@ Module system * ES6 module system It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html)) - -### Building - -To build and compile the typescript sources to javascript use: -``` -npm install -npm run build -``` - -### Publishing - -First build the package then run `npm publish` - -### Consuming - -navigate to the folder of your consuming project and run one of the following commands. - -_published:_ - -``` -npm install digiseg-api-client@0.0.0-dev --save -``` - -_unPublished (not recommended):_ - -``` -npm install PATH_TO_GENERATED_PACKAGE --save -```