@dizmo/dcs-client-library 4.0.1 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,13 @@ import { CreateNeed, Need, UpdateNeed, UpdateResult } from "../types/types";
2
2
  declare function createNeed(need: CreateNeed): Promise<UpdateResult>;
3
3
  declare function deleteNeed(needId: string): Promise<void>;
4
4
  declare function updateNeed(needId: string, needUpdate: UpdateNeed): Promise<void>;
5
- declare function getNeeds(type: string): Promise<Need[]>;
5
+ declare function getNeed(needId: string): Promise<Need>;
6
+ declare function getNeeds(type?: string): Promise<Need[]>;
6
7
  export declare const needs: {
7
8
  createNeed: typeof createNeed;
8
9
  deleteNeed: typeof deleteNeed;
9
10
  updateNeed: typeof updateNeed;
11
+ getNeed: typeof getNeed;
10
12
  getNeeds: typeof getNeeds;
11
13
  };
12
14
  export {};
@@ -20,10 +20,15 @@ async function updateNeed(needId, needUpdate) {
20
20
  const requestOptions = getRequestOptions("PUT", token, needUpdate);
21
21
  await getData(`/needs/need/${needId}`, requestOptions);
22
22
  }
23
+ async function getNeed(needId) {
24
+ validateString(needId, "Function: getNeed, Value: needId");
25
+ const token = await getToken();
26
+ const requestOptions = getRequestOptions("GET", token);
27
+ return (await getData(`/needs/need/${needId}`, requestOptions));
28
+ }
23
29
  async function getNeeds(type) {
24
- validateString(type, "Function: getNeeds, Value: type");
25
30
  const token = await getToken();
26
- const body = { type };
31
+ const body = { ...(type ? { type } : {}) };
27
32
  const requestOptions = getRequestOptions("POST", token, body);
28
33
  return (await getData(`/needs/getneeds`, requestOptions));
29
34
  }
@@ -31,5 +36,6 @@ export const needs = {
31
36
  createNeed,
32
37
  deleteNeed,
33
38
  updateNeed,
39
+ getNeed,
34
40
  getNeeds
35
41
  };
@@ -405,7 +405,7 @@ export type Need = CreateNeed & {
405
405
  _datatype: "need";
406
406
  };
407
407
  export type GetNeeds = {
408
- type: string;
408
+ type?: string;
409
409
  };
410
410
  export type DeepLResponse = {
411
411
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dizmo/dcs-client-library",
3
- "version": "4.0.1",
3
+ "version": "4.1.1",
4
4
  "description": "A library that allows connection and management of dcs",
5
5
  "source": "source/index.ts",
6
6
  "main": "dist/index.js",