drapcode-developer-sdk 1.0.11 → 1.0.13

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?;
@@ -22,6 +26,7 @@ export declare class DrapcodeApis {
22
26
  private version?;
23
27
  private protocol;
24
28
  constructor(projectSeoName: string, opts?: DrapcodeApiOptions);
29
+ constructor(project_seo_name: string, xApiKey: string, authorization: string, environment: Environment | string);
25
30
  setProjectSeoName(seo_name: string): void;
26
31
  getProjectSeoName(): string;
27
32
  setXApiKey(apiKey: string): void;
@@ -34,6 +39,10 @@ export declare class DrapcodeApis {
34
39
  getBuilderKey(): string | undefined;
35
40
  setVersion(version: number): void;
36
41
  getVersion(): number | undefined;
42
+ setXTenantId(tenantId: string): void;
43
+ getXTenantId(): string | undefined;
44
+ setXSubTenantId(subTenantId: string): void;
45
+ getXSubTenantId(): string | undefined;
37
46
  info(): any;
38
47
  private getEnvSubdomain;
39
48
  getBaseUrl(): string;
package/build/index.js CHANGED
@@ -69,9 +69,7 @@ var Environment;
69
69
  Environment["ALPHA"] = "ALPHA";
70
70
  })(Environment = exports.Environment || (exports.Environment = {}));
71
71
  var DrapcodeApis = /** @class */ (function () {
72
- // private protocol: string = "http";
73
- function DrapcodeApis(projectSeoName, opts) {
74
- if (opts === void 0) { opts = {}; }
72
+ function DrapcodeApis(projectSeoName, opts, authorization, environment) {
75
73
  var _a;
76
74
  //Network/URL Related
77
75
  this.API_PATH = "drapcode.io/api";
@@ -80,12 +78,22 @@ var DrapcodeApis = /** @class */ (function () {
80
78
  this.version = 1;
81
79
  this.protocol = "https";
82
80
  this.seoName = projectSeoName;
83
- this.xApiKey = opts.xApiKey;
84
- this.authorization = opts.authorization;
85
- this.environment =
86
- (_a = opts.environment) !== null && _a !== void 0 ? _a : Environment.PRODUCTION;
87
- this.builderKey = opts.builderKey;
88
- this.version = opts.version;
81
+ if (typeof opts === "object" && opts != null) {
82
+ this.xApiKey = opts.xApiKey;
83
+ this.xTenantId = opts.xTenantId;
84
+ this.xSubTenantId = opts.xSubTenantId;
85
+ this.authorization = opts.authorization;
86
+ this.environment =
87
+ (_a = opts.environment) !== null && _a !== void 0 ? _a : Environment.PRODUCTION;
88
+ this.builderKey = opts.builderKey;
89
+ this.version = opts.version;
90
+ }
91
+ else {
92
+ this.xApiKey = opts;
93
+ this.authorization = authorization;
94
+ this.environment = environment !== null && environment !== void 0 ? environment : Environment.PRODUCTION;
95
+ this.version = 1;
96
+ }
89
97
  }
90
98
  DrapcodeApis.prototype.setProjectSeoName = function (seo_name) {
91
99
  this.seoName = seo_name;
@@ -123,11 +131,25 @@ var DrapcodeApis = /** @class */ (function () {
123
131
  DrapcodeApis.prototype.getVersion = function () {
124
132
  return this.version;
125
133
  };
134
+ DrapcodeApis.prototype.setXTenantId = function (tenantId) {
135
+ this.xTenantId = tenantId;
136
+ };
137
+ DrapcodeApis.prototype.getXTenantId = function () {
138
+ return this.xTenantId;
139
+ };
140
+ DrapcodeApis.prototype.setXSubTenantId = function (subTenantId) {
141
+ this.xSubTenantId = subTenantId;
142
+ };
143
+ DrapcodeApis.prototype.getXSubTenantId = function () {
144
+ return this.xSubTenantId;
145
+ };
126
146
  DrapcodeApis.prototype.info = function () {
127
147
  // private protocol :string= "https"
128
148
  return {
129
149
  seoName: this.seoName,
130
150
  xApiKey: this.xApiKey,
151
+ xTenantId: this.xTenantId,
152
+ xSubTenantId: this.xSubTenantId,
131
153
  authorization: this.authorization,
132
154
  environment: this.environment,
133
155
  builderKey: this.builderKey,
@@ -167,6 +189,12 @@ var DrapcodeApis = /** @class */ (function () {
167
189
  if (this.xApiKey) {
168
190
  headers["x-api-key"] = this.xApiKey;
169
191
  }
192
+ if (this.xTenantId) {
193
+ headers["x-tenant-id"] = this.xTenantId;
194
+ }
195
+ if (this.xSubTenantId) {
196
+ headers["x-sub-tenant-id"] = this.xSubTenantId;
197
+ }
170
198
  if (this.authorization) {
171
199
  headers["Authorization"] = this.authorization;
172
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drapcode-developer-sdk",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "files": [