drapcode-developer-sdk 1.0.10 → 1.0.12

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
@@ -28,7 +28,14 @@ const api = new DrapcodeApis(
28
28
  If using version 2:
29
29
 
30
30
  ```typescript
31
- const opts = { xApiKey: "", authorization: "", environment, version: 2 };
31
+ const opts = {
32
+ xApiKey: "",
33
+ authorization: "",
34
+ xTenantId: "",
35
+ xSubTenantId: "",
36
+ environment,
37
+ version: 2,
38
+ };
32
39
  const api = new DrapcodeApis(project_seo_name, opts);
33
40
  ```
34
41
 
@@ -38,6 +45,10 @@ const api = new DrapcodeApis(project_seo_name, opts);
38
45
 
39
46
  **authorization (Optional)**: Authorization token for authentication, if applicable.
40
47
 
48
+ **xTenantId (Optional)**: Tenant UUID for filtering Tenant based data, if applicable.
49
+
50
+ **xSubTenantId (Optional)**: Sub-Tenant UUID for filtering Sub-Tenant based data, if applicable.
51
+
41
52
  **environment (Optional)**: The environment (PRODUCTION, PREVIEW, SANDBOX, UAT). Defaults to PRODUCTION if not provided.
42
53
 
43
54
  **version (Optional, default version is 1)**: This is used to decide which version you want to use.
@@ -61,6 +72,8 @@ If using version 2:
61
72
  V2: const opts = {
62
73
  xApiKey: "xApiKey",
63
74
  authorization: "authorization",
75
+ xTenantId: "xTenantId",
76
+ xSubTenantId: "xSubTenantId",
64
77
  environment: "environment",
65
78
  version: 2,
66
79
  };
package/build/index.d.ts CHANGED
@@ -7,6 +7,8 @@ export declare enum Environment {
7
7
  }
8
8
  export interface DrapcodeApiOptions {
9
9
  xApiKey?: string;
10
+ xTenantId?: string;
11
+ xSubTenantId?: string;
10
12
  authorization?: string;
11
13
  environment?: Environment | keyof typeof Environment | string;
12
14
  builderKey?: string;
@@ -15,6 +17,8 @@ export interface DrapcodeApiOptions {
15
17
  export declare class DrapcodeApis {
16
18
  private seoName;
17
19
  private xApiKey?;
20
+ private xTenantId?;
21
+ private xSubTenantId?;
18
22
  private authorization?;
19
23
  private environment;
20
24
  private builderKey?;
@@ -34,6 +38,10 @@ export declare class DrapcodeApis {
34
38
  getBuilderKey(): string | undefined;
35
39
  setVersion(version: number): void;
36
40
  getVersion(): number | undefined;
41
+ setXTenantId(tenantId: string): void;
42
+ getXTenantId(): string | undefined;
43
+ setXSubTenantId(subTenantId: string): void;
44
+ getXSubTenantId(): string | undefined;
37
45
  info(): any;
38
46
  private getEnvSubdomain;
39
47
  getBaseUrl(): string;
package/build/index.js CHANGED
@@ -81,6 +81,8 @@ var DrapcodeApis = /** @class */ (function () {
81
81
  this.protocol = "https";
82
82
  this.seoName = projectSeoName;
83
83
  this.xApiKey = opts.xApiKey;
84
+ this.xTenantId = opts.xTenantId;
85
+ this.xSubTenantId = opts.xSubTenantId;
84
86
  this.authorization = opts.authorization;
85
87
  this.environment =
86
88
  (_a = opts.environment) !== null && _a !== void 0 ? _a : Environment.PRODUCTION;
@@ -123,11 +125,25 @@ var DrapcodeApis = /** @class */ (function () {
123
125
  DrapcodeApis.prototype.getVersion = function () {
124
126
  return this.version;
125
127
  };
128
+ DrapcodeApis.prototype.setXTenantId = function (tenantId) {
129
+ this.xTenantId = tenantId;
130
+ };
131
+ DrapcodeApis.prototype.getXTenantId = function () {
132
+ return this.xTenantId;
133
+ };
134
+ DrapcodeApis.prototype.setXSubTenantId = function (subTenantId) {
135
+ this.xSubTenantId = subTenantId;
136
+ };
137
+ DrapcodeApis.prototype.getXSubTenantId = function () {
138
+ return this.xSubTenantId;
139
+ };
126
140
  DrapcodeApis.prototype.info = function () {
127
141
  // private protocol :string= "https"
128
142
  return {
129
143
  seoName: this.seoName,
130
144
  xApiKey: this.xApiKey,
145
+ xTenantId: this.xTenantId,
146
+ xSubTenantId: this.xSubTenantId,
131
147
  authorization: this.authorization,
132
148
  environment: this.environment,
133
149
  builderKey: this.builderKey,
@@ -167,11 +183,17 @@ var DrapcodeApis = /** @class */ (function () {
167
183
  if (this.xApiKey) {
168
184
  headers["x-api-key"] = this.xApiKey;
169
185
  }
186
+ if (this.xTenantId) {
187
+ headers["x-tenant-id"] = this.xTenantId;
188
+ }
189
+ if (this.xSubTenantId) {
190
+ headers["x-sub-tenant-id"] = this.xSubTenantId;
191
+ }
170
192
  if (this.authorization) {
171
193
  headers["Authorization"] = this.authorization;
172
194
  }
173
195
  if (this.builderKey) {
174
- headers["BuilderKey"] = this.builderKey;
196
+ headers["builder-key"] = this.builderKey;
175
197
  }
176
198
  return headers;
177
199
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drapcode-developer-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "files": [