@internxt/sdk 1.12.3 → 1.12.4
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.
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
|
|
1
2
|
export interface UserLocation {
|
|
2
3
|
ip: string;
|
|
3
4
|
location: string;
|
|
4
5
|
}
|
|
5
|
-
export declare
|
|
6
|
+
export declare class Location {
|
|
7
|
+
private readonly client;
|
|
8
|
+
private readonly appDetails;
|
|
9
|
+
private constructor();
|
|
10
|
+
static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity?: ApiSecurity): Location;
|
|
11
|
+
getUserLocation(): Promise<UserLocation>;
|
|
12
|
+
private basicUserHeaders;
|
|
13
|
+
}
|
|
@@ -36,13 +36,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.Location = void 0;
|
|
40
|
+
var headers_1 = require("../../shared/headers");
|
|
40
41
|
var client_1 = require("../../shared/http/client");
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
var Location = /** @class */ (function () {
|
|
43
|
+
function Location(apiUrl, appDetails, apiSecurity) {
|
|
44
|
+
this.client = client_1.HttpClient.create(apiUrl, apiSecurity === null || apiSecurity === void 0 ? void 0 : apiSecurity.unauthorizedCallback);
|
|
45
|
+
this.appDetails = appDetails;
|
|
46
|
+
}
|
|
47
|
+
Location.client = function (apiUrl, appDetails, apiSecurity) {
|
|
48
|
+
return new Location(apiUrl, appDetails, apiSecurity);
|
|
49
|
+
};
|
|
50
|
+
Location.prototype.getUserLocation = function () {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
return [2 /*return*/, this.client.get('', this.basicUserHeaders())];
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
Location.prototype.basicUserHeaders = function () {
|
|
58
|
+
return (0, headers_1.basicHeaders)({
|
|
59
|
+
clientName: this.appDetails.clientName,
|
|
60
|
+
clientVersion: this.appDetails.clientVersion,
|
|
61
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
62
|
+
customHeaders: this.appDetails.customHeaders,
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
return Location;
|
|
66
|
+
}());
|
|
67
|
+
exports.Location = Location;
|
|
@@ -2,6 +2,12 @@ import { BasicAuth, Token } from '../../auth';
|
|
|
2
2
|
export interface CustomHeaders {
|
|
3
3
|
[key: string]: string;
|
|
4
4
|
}
|
|
5
|
+
export interface BasicHeadersPayload {
|
|
6
|
+
clientName: string;
|
|
7
|
+
clientVersion: string;
|
|
8
|
+
customHeaders?: Record<string, string>;
|
|
9
|
+
desktopToken?: Token;
|
|
10
|
+
}
|
|
5
11
|
type InternxtHeaders = {
|
|
6
12
|
'content-type': string;
|
|
7
13
|
'internxt-version': string;
|
|
@@ -12,12 +18,7 @@ type InternxtHeaders = {
|
|
|
12
18
|
'internxt-resources-token'?: string;
|
|
13
19
|
'x-internxt-desktop-header'?: string;
|
|
14
20
|
};
|
|
15
|
-
export declare function basicHeaders({ clientName, clientVersion, customHeaders, desktopToken, }:
|
|
16
|
-
clientName: string;
|
|
17
|
-
clientVersion: string;
|
|
18
|
-
customHeaders?: Record<string, string>;
|
|
19
|
-
desktopToken?: Token;
|
|
20
|
-
}): InternxtHeaders;
|
|
21
|
+
export declare function basicHeaders({ clientName, clientVersion, customHeaders, desktopToken, }: BasicHeadersPayload): InternxtHeaders;
|
|
21
22
|
export declare function basicHeadersWithPassword({ clientName, clientVersion, password, desktopToken, }: {
|
|
22
23
|
clientName: string;
|
|
23
24
|
clientVersion: string;
|