@internxt/sdk 1.12.4 → 1.12.6

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,13 +1,11 @@
1
- import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
1
+ import { ApiUrl } from '../../shared';
2
2
  export interface UserLocation {
3
3
  ip: string;
4
4
  location: string;
5
5
  }
6
6
  export declare class Location {
7
7
  private readonly client;
8
- private readonly appDetails;
9
8
  private constructor();
10
- static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity?: ApiSecurity): Location;
9
+ static client(apiUrl: ApiUrl): Location;
11
10
  getUserLocation(): Promise<UserLocation>;
12
- private basicUserHeaders;
13
11
  }
@@ -37,31 +37,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Location = void 0;
40
- var headers_1 = require("../../shared/headers");
41
40
  var client_1 = require("../../shared/http/client");
42
41
  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;
42
+ function Location(apiUrl) {
43
+ this.client = client_1.HttpClient.create(apiUrl);
46
44
  }
47
- Location.client = function (apiUrl, appDetails, apiSecurity) {
48
- return new Location(apiUrl, appDetails, apiSecurity);
45
+ Location.client = function (apiUrl) {
46
+ return new Location(apiUrl);
49
47
  };
50
48
  Location.prototype.getUserLocation = function () {
51
49
  return __awaiter(this, void 0, void 0, function () {
52
50
  return __generator(this, function (_a) {
53
- return [2 /*return*/, this.client.get('', this.basicUserHeaders())];
51
+ return [2 /*return*/, this.client.get('/', {})];
54
52
  });
55
53
  });
56
54
  };
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
55
  return Location;
66
56
  }());
67
57
  exports.Location = Location;
@@ -0,0 +1 @@
1
+ export * from './send';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./send"), exports);
@@ -0,0 +1,25 @@
1
+ import { ApiUrl, AppDetails } from '../shared';
2
+ import { CreateSendLinksPayload, CreateSendLinksResponse, GetSendLinkResponse } from './types';
3
+ export declare class Send {
4
+ private readonly client;
5
+ private readonly appDetails;
6
+ static client(apiUrl: ApiUrl, appDetails: AppDetails): Send;
7
+ private constructor();
8
+ /**
9
+ * Gets a send link by its id
10
+ * @param linkId id of the send link
11
+ * @returns a promise with the send link data
12
+ */
13
+ getSendLink(linkId: string): Promise<GetSendLinkResponse>;
14
+ /**
15
+ * Creates a new send link
16
+ * @param payload contains the data to create a new send link
17
+ * @returns a promise with the newly created send link data
18
+ */
19
+ createSendLink(payload: CreateSendLinksPayload): Promise<CreateSendLinksResponse>;
20
+ /**
21
+ * Returns the basic needed headers for the module requests
22
+ * @private
23
+ */
24
+ private headers;
25
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Send = void 0;
15
+ var headers_1 = require("../shared/headers");
16
+ var client_1 = require("../shared/http/client");
17
+ var Send = /** @class */ (function () {
18
+ function Send(apiUrl, appDetails) {
19
+ this.client = client_1.HttpClient.create(apiUrl);
20
+ this.appDetails = appDetails;
21
+ }
22
+ Send.client = function (apiUrl, appDetails) {
23
+ return new Send(apiUrl, appDetails);
24
+ };
25
+ /**
26
+ * Gets a send link by its id
27
+ * @param linkId id of the send link
28
+ * @returns a promise with the send link data
29
+ */
30
+ Send.prototype.getSendLink = function (linkId) {
31
+ return this.client.get('/links/' + linkId, this.headers());
32
+ };
33
+ /**
34
+ * Creates a new send link
35
+ * @param payload contains the data to create a new send link
36
+ * @returns a promise with the newly created send link data
37
+ */
38
+ Send.prototype.createSendLink = function (payload) {
39
+ // Spread payload into a plain object literal so it matches the `Parameters`/Record<string, unknown> expected by HttpClient.post
40
+ return this.client.post('/links/', __assign({}, payload), this.headers());
41
+ };
42
+ /**
43
+ * Returns the basic needed headers for the module requests
44
+ * @private
45
+ */
46
+ Send.prototype.headers = function () {
47
+ return (0, headers_1.basicHeaders)({
48
+ clientName: this.appDetails.clientName,
49
+ clientVersion: this.appDetails.clientVersion,
50
+ customHeaders: this.appDetails.customHeaders,
51
+ });
52
+ };
53
+ return Send;
54
+ }());
55
+ exports.Send = Send;
@@ -0,0 +1,59 @@
1
+ export interface SendItemBasic {
2
+ id: string;
3
+ name: string;
4
+ size: number;
5
+ type: 'file' | 'folder';
6
+ parent_folder: string | null;
7
+ }
8
+ export interface SendItem extends SendItemBasic {
9
+ linkId: string;
10
+ networkId: string;
11
+ encryptionKey: string;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ version: number;
15
+ path?: string;
16
+ countFiles?: number;
17
+ childrenFiles?: SendItem[];
18
+ childrenFolders?: SendItem[];
19
+ }
20
+ export interface GetSendLinkResponse {
21
+ id: string;
22
+ title: string;
23
+ subject: string;
24
+ code: string;
25
+ views: number;
26
+ userId: number | null;
27
+ items: SendItem[];
28
+ createdAt: string;
29
+ updatedAt: string;
30
+ expirationAt: string;
31
+ size: number;
32
+ }
33
+ export interface SendLink extends SendItemBasic {
34
+ networkId: string;
35
+ encryptionKey: string;
36
+ }
37
+ export interface CreateSendLinksPayload {
38
+ sender?: string;
39
+ receivers?: string[];
40
+ code: string;
41
+ title?: string;
42
+ subject?: string;
43
+ items: SendLink[];
44
+ mnemonic: string;
45
+ }
46
+ export interface CreateSendLinksResponse {
47
+ id: string;
48
+ title: string;
49
+ subject: string;
50
+ code: string;
51
+ sender: string;
52
+ receivers: string[];
53
+ views: number;
54
+ userId: number;
55
+ items: SendLink[];
56
+ createdAt: string;
57
+ updatedAt: string;
58
+ expirationAt: string;
59
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.12.4",
4
+ "version": "1.12.6",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",