@enfuce/nextgen-sdk 0.0.5 → 0.0.7
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 +28 -3
- package/dist/authorisation-control/client.d.ts +47 -0
- package/dist/authorisation-control/client.js +80 -0
- package/dist/authorisation-control/index.d.ts +1 -0
- package/dist/authorisation-control/index.js +1 -0
- package/dist/card/client.d.ts +57 -0
- package/dist/card/client.js +100 -0
- package/dist/card/index.d.ts +1 -0
- package/dist/card/index.js +1 -0
- package/dist/cardholder/client.d.ts +53 -0
- package/dist/cardholder/client.js +92 -0
- package/dist/cardholder/index.d.ts +1 -0
- package/dist/cardholder/index.js +1 -0
- package/dist/cards/client.d.ts +47 -0
- package/dist/cards/client.js +80 -0
- package/dist/cards/index.d.ts +1 -0
- package/dist/cards/index.js +1 -0
- package/dist/config/enfuceUrls.d.ts +20 -0
- package/dist/config/enfuceUrls.js +47 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +22 -0
- package/dist/esm/authorisation-control/client.d.ts +47 -0
- package/dist/esm/authorisation-control/client.js +75 -0
- package/dist/esm/authorisation-control/index.d.ts +1 -0
- package/dist/esm/authorisation-control/index.js +1 -0
- package/dist/esm/card/client.d.ts +57 -0
- package/dist/esm/card/client.js +95 -0
- package/dist/esm/card/index.d.ts +1 -0
- package/dist/esm/card/index.js +1 -0
- package/dist/esm/cardholder/client.d.ts +53 -0
- package/dist/esm/cardholder/client.js +87 -0
- package/dist/esm/cardholder/index.d.ts +1 -0
- package/dist/esm/cardholder/index.js +1 -0
- package/dist/esm/cards/client.d.ts +47 -0
- package/dist/esm/cards/client.js +75 -0
- package/dist/esm/cards/index.d.ts +1 -0
- package/dist/esm/cards/index.js +1 -0
- package/dist/esm/config/enfuceUrls.d.ts +20 -0
- package/dist/esm/config/enfuceUrls.js +40 -0
- package/dist/esm/config/index.d.ts +1 -0
- package/dist/esm/config/index.js +14 -0
- package/dist/esm/exchange-rate/client.d.ts +51 -0
- package/dist/esm/exchange-rate/client.js +83 -0
- package/dist/esm/exchange-rate/index.d.ts +1 -0
- package/dist/esm/exchange-rate/index.js +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/issuer-events/client.d.ts +47 -0
- package/dist/esm/issuer-events/client.js +75 -0
- package/dist/esm/issuer-events/index.d.ts +1 -0
- package/dist/esm/issuer-events/index.js +1 -0
- package/dist/esm/pin/client.d.ts +49 -0
- package/dist/esm/pin/client.js +79 -0
- package/dist/esm/pin/index.d.ts +1 -0
- package/dist/esm/pin/index.js +1 -0
- package/dist/esm/threeds/client.d.ts +47 -0
- package/dist/esm/threeds/client.js +75 -0
- package/dist/esm/threeds/index.d.ts +1 -0
- package/dist/esm/threeds/index.js +1 -0
- package/dist/esm/threeds-oob/client.d.ts +47 -0
- package/dist/esm/threeds-oob/client.js +75 -0
- package/dist/esm/threeds-oob/index.d.ts +1 -0
- package/dist/esm/threeds-oob/index.js +1 -0
- package/dist/esm/wallet/client.d.ts +61 -0
- package/dist/esm/wallet/client.js +103 -0
- package/dist/esm/wallet/index.d.ts +1 -0
- package/dist/esm/wallet/index.js +1 -0
- package/dist/exchange-rate/client.d.ts +51 -0
- package/dist/exchange-rate/client.js +88 -0
- package/dist/exchange-rate/index.d.ts +1 -0
- package/dist/exchange-rate/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/issuer-events/client.d.ts +47 -0
- package/dist/issuer-events/client.js +80 -0
- package/dist/issuer-events/index.d.ts +1 -0
- package/dist/issuer-events/index.js +1 -0
- package/dist/pin/client.d.ts +49 -0
- package/dist/pin/client.js +84 -0
- package/dist/pin/index.d.ts +1 -0
- package/dist/pin/index.js +1 -0
- package/dist/threeds/client.d.ts +47 -0
- package/dist/threeds/client.js +80 -0
- package/dist/threeds/index.d.ts +1 -0
- package/dist/threeds/index.js +1 -0
- package/dist/threeds-oob/client.d.ts +47 -0
- package/dist/threeds-oob/client.js +80 -0
- package/dist/threeds-oob/index.d.ts +1 -0
- package/dist/threeds-oob/index.js +1 -0
- package/dist/wallet/client.d.ts +61 -0
- package/dist/wallet/client.js +108 -0
- package/dist/wallet/index.d.ts +1 -0
- package/dist/wallet/index.js +1 -0
- package/package.json +1 -1
- package/src/authorisation-control/client.ts +86 -0
- package/src/authorisation-control/index.ts +2 -0
- package/src/card/client.ts +116 -0
- package/src/card/index.ts +2 -0
- package/src/cardholder/client.ts +104 -0
- package/src/cardholder/index.ts +2 -0
- package/src/cards/client.ts +86 -0
- package/src/cards/index.ts +2 -0
- package/src/config/enfuceUrls.ts +57 -0
- package/src/config/index.ts +21 -0
- package/src/exchange-rate/client.ts +98 -0
- package/src/exchange-rate/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/issuer-events/client.ts +86 -0
- package/src/issuer-events/index.ts +2 -0
- package/src/pin/client.ts +92 -0
- package/src/pin/index.ts +2 -0
- package/src/threeds/client.ts +86 -0
- package/src/threeds/index.ts +2 -0
- package/src/threeds-oob/client.ts +86 -0
- package/src/threeds-oob/index.ts +2 -0
- package/src/wallet/client.ts +128 -0
- package/src/wallet/index.ts +2 -0
- package/test/config.test.ts +33 -0
- package/test/exchange-rate-client.test.ts +36 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifies a single Enfuce deployment by its `tenant` and `environment` — the two variable
|
|
3
|
+
* segments of every Enfuce host, e.g. `api.<tenant>.<environment>.mycore.enfuce.com`.
|
|
4
|
+
*/
|
|
5
|
+
export interface TenantEnvironment {
|
|
6
|
+
/** Tenant segment, e.g. `swile`, `shine`, `cad`. */
|
|
7
|
+
tenant: string;
|
|
8
|
+
/** Environment segment, e.g. `ext-uat1-sandbox`, `eu.live.prod`. */
|
|
9
|
+
environment: string;
|
|
10
|
+
}
|
|
11
|
+
/** `https://api.<tenant>.<environment>.mycore.enfuce.com` — the API root, no path. */
|
|
12
|
+
export declare function apiBaseUrl(te: TenantEnvironment): string;
|
|
13
|
+
/** `.../issuer` — issuer domain (cardholder, card, wallet, pin). */
|
|
14
|
+
export declare function issuerBaseUrl(te: TenantEnvironment): string;
|
|
15
|
+
/** `.../processor` — processor domain (transactions, 3DS). */
|
|
16
|
+
export declare function processorBaseUrl(te: TenantEnvironment): string;
|
|
17
|
+
/** `.../exchange-rates-api` — exchange-rate domain. */
|
|
18
|
+
export declare function exchangeRateBaseUrl(te: TenantEnvironment): string;
|
|
19
|
+
/** `https://auth.<tenant>.<environment>.mycore.enfuce.com/oauth2/token` — OAuth2 token endpoint. */
|
|
20
|
+
export declare function tokenUrl(te: TenantEnvironment): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Enfuce nextgen SDK — tenant/environment addressing helper.
|
|
4
|
+
*
|
|
5
|
+
* HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
|
|
6
|
+
* preserved across SDK regeneration (see scripts/generate.sh). Do not expect
|
|
7
|
+
* OpenAPI Generator to (re)produce it.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.apiBaseUrl = apiBaseUrl;
|
|
11
|
+
exports.issuerBaseUrl = issuerBaseUrl;
|
|
12
|
+
exports.processorBaseUrl = processorBaseUrl;
|
|
13
|
+
exports.exchangeRateBaseUrl = exchangeRateBaseUrl;
|
|
14
|
+
exports.tokenUrl = tokenUrl;
|
|
15
|
+
const DOMAIN_SUFFIX = 'mycore.enfuce.com';
|
|
16
|
+
function hostSuffix(te) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const tenant = (_a = te === null || te === void 0 ? void 0 : te.tenant) === null || _a === void 0 ? void 0 : _a.trim();
|
|
19
|
+
const environment = (_b = te === null || te === void 0 ? void 0 : te.environment) === null || _b === void 0 ? void 0 : _b.trim();
|
|
20
|
+
if (!tenant) {
|
|
21
|
+
throw new Error('tenant must not be empty');
|
|
22
|
+
}
|
|
23
|
+
if (!environment) {
|
|
24
|
+
throw new Error('environment must not be empty');
|
|
25
|
+
}
|
|
26
|
+
return `${tenant}.${environment}.${DOMAIN_SUFFIX}`;
|
|
27
|
+
}
|
|
28
|
+
/** `https://api.<tenant>.<environment>.mycore.enfuce.com` — the API root, no path. */
|
|
29
|
+
function apiBaseUrl(te) {
|
|
30
|
+
return `https://api.${hostSuffix(te)}`;
|
|
31
|
+
}
|
|
32
|
+
/** `.../issuer` — issuer domain (cardholder, card, wallet, pin). */
|
|
33
|
+
function issuerBaseUrl(te) {
|
|
34
|
+
return `${apiBaseUrl(te)}/issuer`;
|
|
35
|
+
}
|
|
36
|
+
/** `.../processor` — processor domain (transactions, 3DS). */
|
|
37
|
+
function processorBaseUrl(te) {
|
|
38
|
+
return `${apiBaseUrl(te)}/processor`;
|
|
39
|
+
}
|
|
40
|
+
/** `.../exchange-rates-api` — exchange-rate domain. */
|
|
41
|
+
function exchangeRateBaseUrl(te) {
|
|
42
|
+
return `${apiBaseUrl(te)}/exchange-rates-api`;
|
|
43
|
+
}
|
|
44
|
+
/** `https://auth.<tenant>.<environment>.mycore.enfuce.com/oauth2/token` — OAuth2 token endpoint. */
|
|
45
|
+
function tokenUrl(te) {
|
|
46
|
+
return `https://auth.${hostSuffix(te)}/oauth2/token`;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TenantEnvironment, apiBaseUrl, issuerBaseUrl, processorBaseUrl, exchangeRateBaseUrl, tokenUrl, } from './enfuceUrls';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tokenUrl = exports.exchangeRateBaseUrl = exports.processorBaseUrl = exports.issuerBaseUrl = exports.apiBaseUrl = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Enfuce nextgen SDK — tenant/environment addressing helper.
|
|
6
|
+
*
|
|
7
|
+
* HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
|
|
8
|
+
* preserved across SDK regeneration (see scripts/generate.sh). It is re-exported
|
|
9
|
+
* from the package barrel as `config`:
|
|
10
|
+
*
|
|
11
|
+
* import { config, cardholder, oauth } from '@enfuce/nextgen-sdk';
|
|
12
|
+
*
|
|
13
|
+
* const te = { tenant: 'swile', environment: 'ext-uat1-sandbox' };
|
|
14
|
+
* const conf = new cardholder.Configuration({ basePath: config.issuerBaseUrl(te) });
|
|
15
|
+
* const tokens = oauth.clientCredentials({ tokenUrl: config.tokenUrl(te), clientId, clientSecret });
|
|
16
|
+
*/
|
|
17
|
+
var enfuceUrls_1 = require("./enfuceUrls");
|
|
18
|
+
Object.defineProperty(exports, "apiBaseUrl", { enumerable: true, get: function () { return enfuceUrls_1.apiBaseUrl; } });
|
|
19
|
+
Object.defineProperty(exports, "issuerBaseUrl", { enumerable: true, get: function () { return enfuceUrls_1.issuerBaseUrl; } });
|
|
20
|
+
Object.defineProperty(exports, "processorBaseUrl", { enumerable: true, get: function () { return enfuceUrls_1.processorBaseUrl; } });
|
|
21
|
+
Object.defineProperty(exports, "exchangeRateBaseUrl", { enumerable: true, get: function () { return enfuceUrls_1.exchangeRateBaseUrl; } });
|
|
22
|
+
Object.defineProperty(exports, "tokenUrl", { enumerable: true, get: function () { return enfuceUrls_1.tokenUrl; } });
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
|
+
import { type TokenManager } from '../oauth';
|
|
3
|
+
import { Configuration } from './configuration';
|
|
4
|
+
import { AuthorisationRequestAPIApi } from './api';
|
|
5
|
+
/**
|
|
6
|
+
* Fluent entry point for this module. Build one with {@link AuthorisationControlClient.builder}:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = AuthorisationControlClient.builder()
|
|
10
|
+
* .baseUrl('https://api.example.com/...')
|
|
11
|
+
* .oauth(tokens)
|
|
12
|
+
* .build();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class AuthorisationControlClient {
|
|
16
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
17
|
+
readonly http: AxiosInstance;
|
|
18
|
+
/** The module configuration — base path applied. */
|
|
19
|
+
readonly configuration: Configuration;
|
|
20
|
+
constructor(
|
|
21
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
22
|
+
http: AxiosInstance,
|
|
23
|
+
/** The module configuration — base path applied. */
|
|
24
|
+
configuration: Configuration);
|
|
25
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
26
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T;
|
|
27
|
+
/** {@link AuthorisationRequestAPIApi} bound to this client. */
|
|
28
|
+
authorisationRequestAPIApi(): AuthorisationRequestAPIApi;
|
|
29
|
+
static builder(): AuthorisationControlClientBuilder;
|
|
30
|
+
}
|
|
31
|
+
/** Builds a {@link AuthorisationControlClient}: base URL + optional OAuth + transport customization. */
|
|
32
|
+
export declare class AuthorisationControlClientBuilder {
|
|
33
|
+
private _baseUrl?;
|
|
34
|
+
private _tokens?;
|
|
35
|
+
private _customizers;
|
|
36
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
37
|
+
baseUrl(baseUrl: string): this;
|
|
38
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
39
|
+
oauth(tokens: TokenManager): this;
|
|
40
|
+
/**
|
|
41
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
42
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
43
|
+
* calls run in order.
|
|
44
|
+
*/
|
|
45
|
+
configure(customizer: (http: AxiosInstance) => void): this;
|
|
46
|
+
build(): AuthorisationControlClient;
|
|
47
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Enfuce nextgen SDK — fluent module client.
|
|
3
|
+
*
|
|
4
|
+
* GENERATED by scripts/generate.sh from a custom template (generator-templates/typescript). One per
|
|
5
|
+
* API module: wires an OAuth-enabled axios instance (bearer token on every request + reactive 401
|
|
6
|
+
* retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
|
|
7
|
+
*/
|
|
8
|
+
import globalAxios from 'axios';
|
|
9
|
+
import { createOAuthAxios } from '../oauth';
|
|
10
|
+
import { Configuration } from './configuration';
|
|
11
|
+
import { AuthorisationRequestAPIApi, } from './api';
|
|
12
|
+
/**
|
|
13
|
+
* Fluent entry point for this module. Build one with {@link AuthorisationControlClient.builder}:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const client = AuthorisationControlClient.builder()
|
|
17
|
+
* .baseUrl('https://api.example.com/...')
|
|
18
|
+
* .oauth(tokens)
|
|
19
|
+
* .build();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class AuthorisationControlClient {
|
|
23
|
+
constructor(
|
|
24
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
25
|
+
http,
|
|
26
|
+
/** The module configuration — base path applied. */
|
|
27
|
+
configuration) {
|
|
28
|
+
this.http = http;
|
|
29
|
+
this.configuration = configuration;
|
|
30
|
+
}
|
|
31
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
32
|
+
api(factory) {
|
|
33
|
+
return factory(this.configuration, this.http);
|
|
34
|
+
}
|
|
35
|
+
/** {@link AuthorisationRequestAPIApi} bound to this client. */
|
|
36
|
+
authorisationRequestAPIApi() {
|
|
37
|
+
return new AuthorisationRequestAPIApi(this.configuration, undefined, this.http);
|
|
38
|
+
}
|
|
39
|
+
static builder() {
|
|
40
|
+
return new AuthorisationControlClientBuilder();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Builds a {@link AuthorisationControlClient}: base URL + optional OAuth + transport customization. */
|
|
44
|
+
export class AuthorisationControlClientBuilder {
|
|
45
|
+
constructor() {
|
|
46
|
+
this._customizers = [];
|
|
47
|
+
}
|
|
48
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
49
|
+
baseUrl(baseUrl) {
|
|
50
|
+
this._baseUrl = baseUrl;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
54
|
+
oauth(tokens) {
|
|
55
|
+
this._tokens = tokens;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
60
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
61
|
+
* calls run in order.
|
|
62
|
+
*/
|
|
63
|
+
configure(customizer) {
|
|
64
|
+
this._customizers.push(customizer);
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
build() {
|
|
68
|
+
const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
|
|
69
|
+
for (const customizer of this._customizers) {
|
|
70
|
+
customizer(http);
|
|
71
|
+
}
|
|
72
|
+
const configuration = new Configuration({ basePath: this._baseUrl });
|
|
73
|
+
return new AuthorisationControlClient(http, configuration);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
|
+
import { type TokenManager } from '../oauth';
|
|
3
|
+
import { Configuration } from './configuration';
|
|
4
|
+
import { CreateCardApi, CreatePINControlAccessTokenApi, GetCardApi, GetCardPaymentInfoApi, GetPlasticManufacturingHistoryApi, UpdateCardApi } from './api';
|
|
5
|
+
/**
|
|
6
|
+
* Fluent entry point for this module. Build one with {@link CardClient.builder}:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = CardClient.builder()
|
|
10
|
+
* .baseUrl('https://api.example.com/...')
|
|
11
|
+
* .oauth(tokens)
|
|
12
|
+
* .build();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class CardClient {
|
|
16
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
17
|
+
readonly http: AxiosInstance;
|
|
18
|
+
/** The module configuration — base path applied. */
|
|
19
|
+
readonly configuration: Configuration;
|
|
20
|
+
constructor(
|
|
21
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
22
|
+
http: AxiosInstance,
|
|
23
|
+
/** The module configuration — base path applied. */
|
|
24
|
+
configuration: Configuration);
|
|
25
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
26
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T;
|
|
27
|
+
/** {@link CreateCardApi} bound to this client. */
|
|
28
|
+
createCardApi(): CreateCardApi;
|
|
29
|
+
/** {@link CreatePINControlAccessTokenApi} bound to this client. */
|
|
30
|
+
createPINControlAccessTokenApi(): CreatePINControlAccessTokenApi;
|
|
31
|
+
/** {@link GetCardApi} bound to this client. */
|
|
32
|
+
getCardApi(): GetCardApi;
|
|
33
|
+
/** {@link GetCardPaymentInfoApi} bound to this client. */
|
|
34
|
+
getCardPaymentInfoApi(): GetCardPaymentInfoApi;
|
|
35
|
+
/** {@link GetPlasticManufacturingHistoryApi} bound to this client. */
|
|
36
|
+
getPlasticManufacturingHistoryApi(): GetPlasticManufacturingHistoryApi;
|
|
37
|
+
/** {@link UpdateCardApi} bound to this client. */
|
|
38
|
+
updateCardApi(): UpdateCardApi;
|
|
39
|
+
static builder(): CardClientBuilder;
|
|
40
|
+
}
|
|
41
|
+
/** Builds a {@link CardClient}: base URL + optional OAuth + transport customization. */
|
|
42
|
+
export declare class CardClientBuilder {
|
|
43
|
+
private _baseUrl?;
|
|
44
|
+
private _tokens?;
|
|
45
|
+
private _customizers;
|
|
46
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
47
|
+
baseUrl(baseUrl: string): this;
|
|
48
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
49
|
+
oauth(tokens: TokenManager): this;
|
|
50
|
+
/**
|
|
51
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
52
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
53
|
+
* calls run in order.
|
|
54
|
+
*/
|
|
55
|
+
configure(customizer: (http: AxiosInstance) => void): this;
|
|
56
|
+
build(): CardClient;
|
|
57
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Enfuce nextgen SDK — fluent module client.
|
|
3
|
+
*
|
|
4
|
+
* GENERATED by scripts/generate.sh from a custom template (generator-templates/typescript). One per
|
|
5
|
+
* API module: wires an OAuth-enabled axios instance (bearer token on every request + reactive 401
|
|
6
|
+
* retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
|
|
7
|
+
*/
|
|
8
|
+
import globalAxios from 'axios';
|
|
9
|
+
import { createOAuthAxios } from '../oauth';
|
|
10
|
+
import { Configuration } from './configuration';
|
|
11
|
+
import { CreateCardApi, CreatePINControlAccessTokenApi, GetCardApi, GetCardPaymentInfoApi, GetPlasticManufacturingHistoryApi, UpdateCardApi, } from './api';
|
|
12
|
+
/**
|
|
13
|
+
* Fluent entry point for this module. Build one with {@link CardClient.builder}:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const client = CardClient.builder()
|
|
17
|
+
* .baseUrl('https://api.example.com/...')
|
|
18
|
+
* .oauth(tokens)
|
|
19
|
+
* .build();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class CardClient {
|
|
23
|
+
constructor(
|
|
24
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
25
|
+
http,
|
|
26
|
+
/** The module configuration — base path applied. */
|
|
27
|
+
configuration) {
|
|
28
|
+
this.http = http;
|
|
29
|
+
this.configuration = configuration;
|
|
30
|
+
}
|
|
31
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
32
|
+
api(factory) {
|
|
33
|
+
return factory(this.configuration, this.http);
|
|
34
|
+
}
|
|
35
|
+
/** {@link CreateCardApi} bound to this client. */
|
|
36
|
+
createCardApi() {
|
|
37
|
+
return new CreateCardApi(this.configuration, undefined, this.http);
|
|
38
|
+
}
|
|
39
|
+
/** {@link CreatePINControlAccessTokenApi} bound to this client. */
|
|
40
|
+
createPINControlAccessTokenApi() {
|
|
41
|
+
return new CreatePINControlAccessTokenApi(this.configuration, undefined, this.http);
|
|
42
|
+
}
|
|
43
|
+
/** {@link GetCardApi} bound to this client. */
|
|
44
|
+
getCardApi() {
|
|
45
|
+
return new GetCardApi(this.configuration, undefined, this.http);
|
|
46
|
+
}
|
|
47
|
+
/** {@link GetCardPaymentInfoApi} bound to this client. */
|
|
48
|
+
getCardPaymentInfoApi() {
|
|
49
|
+
return new GetCardPaymentInfoApi(this.configuration, undefined, this.http);
|
|
50
|
+
}
|
|
51
|
+
/** {@link GetPlasticManufacturingHistoryApi} bound to this client. */
|
|
52
|
+
getPlasticManufacturingHistoryApi() {
|
|
53
|
+
return new GetPlasticManufacturingHistoryApi(this.configuration, undefined, this.http);
|
|
54
|
+
}
|
|
55
|
+
/** {@link UpdateCardApi} bound to this client. */
|
|
56
|
+
updateCardApi() {
|
|
57
|
+
return new UpdateCardApi(this.configuration, undefined, this.http);
|
|
58
|
+
}
|
|
59
|
+
static builder() {
|
|
60
|
+
return new CardClientBuilder();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Builds a {@link CardClient}: base URL + optional OAuth + transport customization. */
|
|
64
|
+
export class CardClientBuilder {
|
|
65
|
+
constructor() {
|
|
66
|
+
this._customizers = [];
|
|
67
|
+
}
|
|
68
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
69
|
+
baseUrl(baseUrl) {
|
|
70
|
+
this._baseUrl = baseUrl;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
74
|
+
oauth(tokens) {
|
|
75
|
+
this._tokens = tokens;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
80
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
81
|
+
* calls run in order.
|
|
82
|
+
*/
|
|
83
|
+
configure(customizer) {
|
|
84
|
+
this._customizers.push(customizer);
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
build() {
|
|
88
|
+
const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
|
|
89
|
+
for (const customizer of this._customizers) {
|
|
90
|
+
customizer(http);
|
|
91
|
+
}
|
|
92
|
+
const configuration = new Configuration({ basePath: this._baseUrl });
|
|
93
|
+
return new CardClient(http, configuration);
|
|
94
|
+
}
|
|
95
|
+
}
|
package/dist/esm/card/index.d.ts
CHANGED
package/dist/esm/card/index.js
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
|
+
import { type TokenManager } from '../oauth';
|
|
3
|
+
import { Configuration } from './configuration';
|
|
4
|
+
import { CreateCardholderApi, GetCardholderApi, GetCardsByCardholderIdApi, UpdateCardholderApi } from './api';
|
|
5
|
+
/**
|
|
6
|
+
* Fluent entry point for this module. Build one with {@link CardholderClient.builder}:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = CardholderClient.builder()
|
|
10
|
+
* .baseUrl('https://api.example.com/...')
|
|
11
|
+
* .oauth(tokens)
|
|
12
|
+
* .build();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class CardholderClient {
|
|
16
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
17
|
+
readonly http: AxiosInstance;
|
|
18
|
+
/** The module configuration — base path applied. */
|
|
19
|
+
readonly configuration: Configuration;
|
|
20
|
+
constructor(
|
|
21
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
22
|
+
http: AxiosInstance,
|
|
23
|
+
/** The module configuration — base path applied. */
|
|
24
|
+
configuration: Configuration);
|
|
25
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
26
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T;
|
|
27
|
+
/** {@link CreateCardholderApi} bound to this client. */
|
|
28
|
+
createCardholderApi(): CreateCardholderApi;
|
|
29
|
+
/** {@link GetCardholderApi} bound to this client. */
|
|
30
|
+
getCardholderApi(): GetCardholderApi;
|
|
31
|
+
/** {@link GetCardsByCardholderIdApi} bound to this client. */
|
|
32
|
+
getCardsByCardholderIdApi(): GetCardsByCardholderIdApi;
|
|
33
|
+
/** {@link UpdateCardholderApi} bound to this client. */
|
|
34
|
+
updateCardholderApi(): UpdateCardholderApi;
|
|
35
|
+
static builder(): CardholderClientBuilder;
|
|
36
|
+
}
|
|
37
|
+
/** Builds a {@link CardholderClient}: base URL + optional OAuth + transport customization. */
|
|
38
|
+
export declare class CardholderClientBuilder {
|
|
39
|
+
private _baseUrl?;
|
|
40
|
+
private _tokens?;
|
|
41
|
+
private _customizers;
|
|
42
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
43
|
+
baseUrl(baseUrl: string): this;
|
|
44
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
45
|
+
oauth(tokens: TokenManager): this;
|
|
46
|
+
/**
|
|
47
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
48
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
49
|
+
* calls run in order.
|
|
50
|
+
*/
|
|
51
|
+
configure(customizer: (http: AxiosInstance) => void): this;
|
|
52
|
+
build(): CardholderClient;
|
|
53
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Enfuce nextgen SDK — fluent module client.
|
|
3
|
+
*
|
|
4
|
+
* GENERATED by scripts/generate.sh from a custom template (generator-templates/typescript). One per
|
|
5
|
+
* API module: wires an OAuth-enabled axios instance (bearer token on every request + reactive 401
|
|
6
|
+
* retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
|
|
7
|
+
*/
|
|
8
|
+
import globalAxios from 'axios';
|
|
9
|
+
import { createOAuthAxios } from '../oauth';
|
|
10
|
+
import { Configuration } from './configuration';
|
|
11
|
+
import { CreateCardholderApi, GetCardholderApi, GetCardsByCardholderIdApi, UpdateCardholderApi, } from './api';
|
|
12
|
+
/**
|
|
13
|
+
* Fluent entry point for this module. Build one with {@link CardholderClient.builder}:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const client = CardholderClient.builder()
|
|
17
|
+
* .baseUrl('https://api.example.com/...')
|
|
18
|
+
* .oauth(tokens)
|
|
19
|
+
* .build();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class CardholderClient {
|
|
23
|
+
constructor(
|
|
24
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
25
|
+
http,
|
|
26
|
+
/** The module configuration — base path applied. */
|
|
27
|
+
configuration) {
|
|
28
|
+
this.http = http;
|
|
29
|
+
this.configuration = configuration;
|
|
30
|
+
}
|
|
31
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
32
|
+
api(factory) {
|
|
33
|
+
return factory(this.configuration, this.http);
|
|
34
|
+
}
|
|
35
|
+
/** {@link CreateCardholderApi} bound to this client. */
|
|
36
|
+
createCardholderApi() {
|
|
37
|
+
return new CreateCardholderApi(this.configuration, undefined, this.http);
|
|
38
|
+
}
|
|
39
|
+
/** {@link GetCardholderApi} bound to this client. */
|
|
40
|
+
getCardholderApi() {
|
|
41
|
+
return new GetCardholderApi(this.configuration, undefined, this.http);
|
|
42
|
+
}
|
|
43
|
+
/** {@link GetCardsByCardholderIdApi} bound to this client. */
|
|
44
|
+
getCardsByCardholderIdApi() {
|
|
45
|
+
return new GetCardsByCardholderIdApi(this.configuration, undefined, this.http);
|
|
46
|
+
}
|
|
47
|
+
/** {@link UpdateCardholderApi} bound to this client. */
|
|
48
|
+
updateCardholderApi() {
|
|
49
|
+
return new UpdateCardholderApi(this.configuration, undefined, this.http);
|
|
50
|
+
}
|
|
51
|
+
static builder() {
|
|
52
|
+
return new CardholderClientBuilder();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Builds a {@link CardholderClient}: base URL + optional OAuth + transport customization. */
|
|
56
|
+
export class CardholderClientBuilder {
|
|
57
|
+
constructor() {
|
|
58
|
+
this._customizers = [];
|
|
59
|
+
}
|
|
60
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
61
|
+
baseUrl(baseUrl) {
|
|
62
|
+
this._baseUrl = baseUrl;
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
66
|
+
oauth(tokens) {
|
|
67
|
+
this._tokens = tokens;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
72
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
73
|
+
* calls run in order.
|
|
74
|
+
*/
|
|
75
|
+
configure(customizer) {
|
|
76
|
+
this._customizers.push(customizer);
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
build() {
|
|
80
|
+
const http = this._tokens ? createOAuthAxios(this._tokens) : globalAxios.create();
|
|
81
|
+
for (const customizer of this._customizers) {
|
|
82
|
+
customizer(http);
|
|
83
|
+
}
|
|
84
|
+
const configuration = new Configuration({ basePath: this._baseUrl });
|
|
85
|
+
return new CardholderClient(http, configuration);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
|
+
import { type TokenManager } from '../oauth';
|
|
3
|
+
import { Configuration } from './configuration';
|
|
4
|
+
import { CardsApi } from './api';
|
|
5
|
+
/**
|
|
6
|
+
* Fluent entry point for this module. Build one with {@link CardsClient.builder}:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = CardsClient.builder()
|
|
10
|
+
* .baseUrl('https://api.example.com/...')
|
|
11
|
+
* .oauth(tokens)
|
|
12
|
+
* .build();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class CardsClient {
|
|
16
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
17
|
+
readonly http: AxiosInstance;
|
|
18
|
+
/** The module configuration — base path applied. */
|
|
19
|
+
readonly configuration: Configuration;
|
|
20
|
+
constructor(
|
|
21
|
+
/** The axios instance — OAuth interceptors and any customizations already applied. */
|
|
22
|
+
http: AxiosInstance,
|
|
23
|
+
/** The module configuration — base path applied. */
|
|
24
|
+
configuration: Configuration);
|
|
25
|
+
/** Build any API in this module bound to this client (for APIs without a named getter). */
|
|
26
|
+
api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T;
|
|
27
|
+
/** {@link CardsApi} bound to this client. */
|
|
28
|
+
cardsApi(): CardsApi;
|
|
29
|
+
static builder(): CardsClientBuilder;
|
|
30
|
+
}
|
|
31
|
+
/** Builds a {@link CardsClient}: base URL + optional OAuth + transport customization. */
|
|
32
|
+
export declare class CardsClientBuilder {
|
|
33
|
+
private _baseUrl?;
|
|
34
|
+
private _tokens?;
|
|
35
|
+
private _customizers;
|
|
36
|
+
/** The module's host, e.g. `https://api.<tenant>.../issuer`. */
|
|
37
|
+
baseUrl(baseUrl: string): this;
|
|
38
|
+
/** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
|
|
39
|
+
oauth(tokens: TokenManager): this;
|
|
40
|
+
/**
|
|
41
|
+
* Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
|
|
42
|
+
* default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
|
|
43
|
+
* calls run in order.
|
|
44
|
+
*/
|
|
45
|
+
configure(customizer: (http: AxiosInstance) => void): this;
|
|
46
|
+
build(): CardsClient;
|
|
47
|
+
}
|