@matchi/api 0.20231011.1 → 0.20231018.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.
package/README.md CHANGED
@@ -2,10 +2,16 @@
2
2
 
3
3
  MATCHi API Client
4
4
 
5
+ ## Introduction
6
+
7
+ This is the MATCHi API client for JavaScript and TypeScript. It is generated from the OpenAPI specification and is intended to be used when building applications that integrates with the MATCHi API.
8
+
5
9
  ## Installation
6
10
 
7
11
  ```bash
8
- npm install @matchi/api
12
+ npm install @matchi/api # using npm
13
+ yarn add @matchi/api # using yarn
14
+ bun install @matchi/api # using bun
9
15
  ```
10
16
 
11
17
  ## Get started
@@ -30,12 +36,48 @@ OpenAPI.TOKEN = getValidAccessToken;
30
36
 
31
37
  ## Usage
32
38
 
39
+ ### Basic usage
40
+
33
41
  ```typescript
42
+ // Once you've got the dependency locally, you can inspect the exports to
43
+ // see what's available.
44
+
45
+ // The classes that ends in "Service" are entrypoints for making HTTP calls.
34
46
  import { AnonymousService } from "@matchi/api";
35
47
 
36
48
  try {
49
+ // fetch() is used as the underlying HTTP client
37
50
  const activities = await AnonymousService.listActivities();
38
51
  } catch (error) {
39
52
  // Handle error
40
53
  }
41
54
  ```
55
+
56
+ ### Custom timeout
57
+
58
+ ```typescript
59
+ import { AnonymousService } from "@matchi/api";
60
+
61
+ try {
62
+ // Create a promise that will fetch the activities
63
+ const promise = AnonymousService.listActivities();
64
+
65
+ const timeoutId = setTimeout(() => {
66
+ // If the promise hasn't resolved within 1 second, cancel it
67
+ promise.cancel();
68
+
69
+ // Throw an error to indicate that the request timed out
70
+ throw new Error("Timeout");
71
+ }, 1000);
72
+
73
+ // Wait for the promise to resolve
74
+ const activities = await promise;
75
+
76
+ // Clear the timeout, since the promise resolved within 1 second
77
+ clearTimeout(timeoutId);
78
+
79
+ return activities;
80
+ } catch (error) {
81
+ // Handle error
82
+ }
83
+ ```
package/dist/index.d.mts CHANGED
@@ -354,6 +354,9 @@ type valueCardOutcome = {
354
354
  valueCard: giftCard;
355
355
  };
356
356
 
357
+ /**
358
+ * The attribute price is the price after discounts from e.g. promo codes. priceBase is the original price without discounts
359
+ */
357
360
  type checkoutResponse = {
358
361
  facilityName: string;
359
362
  facilityOrgNr?: string;
@@ -376,6 +379,10 @@ type checkoutResponse = {
376
379
  orderId: number;
377
380
  orderStatus: string;
378
381
  canUsePromoCode?: boolean;
382
+ /**
383
+ * Is what is left to pay e.g. the attribute price minus sum of other payment methods that have been applied, e.g. value cards
384
+ */
385
+ amountToPay: string;
379
386
  };
380
387
 
381
388
  type competitionAdminAccount = {
package/dist/index.d.ts CHANGED
@@ -354,6 +354,9 @@ type valueCardOutcome = {
354
354
  valueCard: giftCard;
355
355
  };
356
356
 
357
+ /**
358
+ * The attribute price is the price after discounts from e.g. promo codes. priceBase is the original price without discounts
359
+ */
357
360
  type checkoutResponse = {
358
361
  facilityName: string;
359
362
  facilityOrgNr?: string;
@@ -376,6 +379,10 @@ type checkoutResponse = {
376
379
  orderId: number;
377
380
  orderStatus: string;
378
381
  canUsePromoCode?: boolean;
382
+ /**
383
+ * Is what is left to pay e.g. the attribute price minus sum of other payment methods that have been applied, e.g. value cards
384
+ */
385
+ amountToPay: string;
379
386
  };
380
387
 
381
388
  type competitionAdminAccount = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matchi/api",
3
- "version": "0.20231011.1",
3
+ "version": "0.20231018.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.mjs",