@abyss-project/link 1.0.0 → 1.1.0
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/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/link.admin.api.d.ts +14 -0
- package/dist/api/link.admin.api.js +64 -0
- package/dist/api/link.admin.api.js.map +1 -0
- package/dist/api/link.api.d.ts +15 -0
- package/dist/api/link.api.js +69 -0
- package/dist/api/link.api.js.map +1 -0
- package/dist/api/link.public.api.d.ts +2 -0
- package/dist/api/link.public.api.js +9 -0
- package/dist/api/link.public.api.js.map +1 -0
- package/dist/constants/link.constants.d.ts +11 -0
- package/dist/constants/link.constants.js +12 -1
- package/dist/constants/link.constants.js.map +1 -1
- package/dist/index.d.ts +37 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/api-error.enum.d.ts +9 -1
- package/dist/types/enum/api-error.enum.js +8 -0
- package/dist/types/enum/api-error.enum.js.map +1 -1
- package/dist/types/enum/index.d.ts +2 -0
- package/dist/types/enum/index.js +2 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/link-share.enum.d.ts +11 -0
- package/dist/types/enum/link-share.enum.js +17 -0
- package/dist/types/enum/link-share.enum.js.map +1 -0
- package/dist/types/enum/link-stats.enum.d.ts +5 -0
- package/dist/types/enum/link-stats.enum.js +10 -0
- package/dist/types/enum/link-stats.enum.js.map +1 -0
- package/dist/types/interface/api/requests/index.d.ts +3 -0
- package/dist/types/interface/api/requests/index.js +3 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/link.admin.request.d.ts +69 -0
- package/dist/types/interface/api/requests/link.admin.request.js +3 -0
- package/dist/types/interface/api/requests/link.admin.request.js.map +1 -0
- package/dist/types/interface/api/requests/link.public.request.d.ts +13 -0
- package/dist/types/interface/api/requests/link.public.request.js +3 -0
- package/dist/types/interface/api/requests/link.public.request.js.map +1 -0
- package/dist/types/interface/api/requests/link.request.d.ts +74 -0
- package/dist/types/interface/api/requests/link.request.js +3 -0
- package/dist/types/interface/api/requests/link.request.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +3 -0
- package/dist/types/interface/api/responses/index.js +3 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/link.admin.response.d.ts +43 -0
- package/dist/types/interface/api/responses/link.admin.response.js +3 -0
- package/dist/types/interface/api/responses/link.admin.response.js.map +1 -0
- package/dist/types/interface/api/responses/link.public.response.d.ts +5 -0
- package/dist/types/interface/api/responses/link.public.response.js +3 -0
- package/dist/types/interface/api/responses/link.public.response.js.map +1 -0
- package/dist/types/interface/api/responses/link.response.d.ts +43 -0
- package/dist/types/interface/api/responses/link.response.js +3 -0
- package/dist/types/interface/api/responses/link.response.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +1 -0
- package/dist/types/interface/models/index.js +1 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/link-list.dto.d.ts +20 -0
- package/dist/types/interface/models/link-list.dto.js +3 -0
- package/dist/types/interface/models/link-list.dto.js.map +1 -0
- package/package.json +15 -10
- package/src/api/index.ts +3 -0
- package/src/api/link.admin.api.ts +168 -0
- package/src/api/link.api.ts +158 -0
- package/src/api/link.public.api.ts +19 -0
- package/src/constants/link.constants.ts +17 -0
- package/src/index.ts +71 -0
- package/src/tests/link-public-api.spec.ts +37 -0
- package/src/tests/link-sdk-surface.spec.ts +191 -0
- package/src/tests/sdk-surface.spec.ts +1 -1
- package/src/types/enum/api-error.enum.ts +13 -0
- package/src/types/enum/index.ts +2 -0
- package/src/types/enum/link-share.enum.ts +17 -0
- package/src/types/enum/link-stats.enum.ts +6 -0
- package/src/types/interface/api/requests/index.ts +3 -0
- package/src/types/interface/api/requests/link.admin.request.ts +104 -0
- package/src/types/interface/api/requests/link.public.request.ts +18 -0
- package/src/types/interface/api/requests/link.request.ts +100 -0
- package/src/types/interface/api/responses/index.ts +3 -0
- package/src/types/interface/api/responses/link.admin.response.ts +56 -0
- package/src/types/interface/api/responses/link.public.response.ts +7 -0
- package/src/types/interface/api/responses/link.response.ts +55 -0
- package/src/types/interface/models/index.ts +1 -0
- package/src/types/interface/models/link-list.dto.ts +28 -0
- package/src/types/tests/link-enums.spec.ts +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.public.request.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/requests/link.public.request.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { LinkShareScope } from '../../../enum/link-share.enum';
|
|
2
|
+
import { LinkStatsGranularity } from '../../../enum/link-stats.enum';
|
|
3
|
+
import { ILinkOrigin } from '../../models/link.dto';
|
|
4
|
+
import { QueryPaginate } from '../type-message/base-paginate';
|
|
5
|
+
export interface ILinkIdParams {
|
|
6
|
+
linkId: string;
|
|
7
|
+
}
|
|
8
|
+
export type IGetLinkParams = ILinkIdParams;
|
|
9
|
+
export type IUpdateLinkParams = ILinkIdParams;
|
|
10
|
+
export type IDeleteLinkParams = ILinkIdParams;
|
|
11
|
+
export type ITransferLinkParams = ILinkIdParams;
|
|
12
|
+
export type IGetLinkStatsParams = ILinkIdParams;
|
|
13
|
+
export type IGetLinkVisitsParams = ILinkIdParams;
|
|
14
|
+
export interface IPaginateLinkQuery extends QueryPaginate {
|
|
15
|
+
search?: string;
|
|
16
|
+
isActive?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IPaginateProjectLinkParams {
|
|
19
|
+
projectId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface IPaginateOrganizationLinkParams {
|
|
22
|
+
organizationId: string;
|
|
23
|
+
}
|
|
24
|
+
export interface IPaginateOrganizationLinkQuery extends IPaginateLinkQuery {
|
|
25
|
+
scope?: LinkShareScope;
|
|
26
|
+
teamId?: string;
|
|
27
|
+
projectId?: string;
|
|
28
|
+
adminView?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ICountOrganizationLinkParams {
|
|
31
|
+
organizationId: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ICountOrganizationLinkQuery {
|
|
34
|
+
adminView?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface ICreateLinkBody {
|
|
37
|
+
targetUrl: string;
|
|
38
|
+
slug?: string;
|
|
39
|
+
password?: string;
|
|
40
|
+
title?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
expiresAt?: Date | string;
|
|
43
|
+
maxClicks?: number;
|
|
44
|
+
forwardCampaignParams?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ICreateForOrganizationLinkParams {
|
|
47
|
+
organizationId: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ICreateForOrganizationLinkBody extends ICreateLinkBody {
|
|
50
|
+
projectId?: string;
|
|
51
|
+
scope?: 'USER';
|
|
52
|
+
}
|
|
53
|
+
export interface IUpdateLinkBody {
|
|
54
|
+
targetUrl?: string;
|
|
55
|
+
slug?: string;
|
|
56
|
+
password?: string | null;
|
|
57
|
+
title?: string | null;
|
|
58
|
+
description?: string | null;
|
|
59
|
+
isActive?: boolean;
|
|
60
|
+
expiresAt?: Date | string | null;
|
|
61
|
+
maxClicks?: number | null;
|
|
62
|
+
forwardCampaignParams?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface ITransferLinkBody {
|
|
65
|
+
newOwnerId: string;
|
|
66
|
+
}
|
|
67
|
+
export interface IGetLinkStatsQuery {
|
|
68
|
+
from?: Date | string;
|
|
69
|
+
to?: Date | string;
|
|
70
|
+
granularity?: LinkStatsGranularity;
|
|
71
|
+
}
|
|
72
|
+
export type IGetLinkVisitsQuery = QueryPaginate;
|
|
73
|
+
export type IGetByOriginLinkQuery = ILinkOrigin;
|
|
74
|
+
export type IGetStatsByOriginLinkQuery = ILinkOrigin & IGetLinkStatsQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.request.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/requests/link.request.ts"],"names":[],"mappings":""}
|
|
@@ -15,4 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./abyss.admin.response"), exports);
|
|
18
|
+
__exportStar(require("./link.response"), exports);
|
|
19
|
+
__exportStar(require("./link.admin.response"), exports);
|
|
20
|
+
__exportStar(require("./link.public.response"), exports);
|
|
18
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,kDAAgC;AAChC,wDAAsC;AACtC,yDAAuC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ILink, ILinkStats, ILinkVisit } from '../../models/link.dto';
|
|
2
|
+
import { ILinkCampaignStatsRow } from '../../models/link-list.dto';
|
|
3
|
+
import { BasePaginate } from '../type-message/base-paginate';
|
|
4
|
+
import { IResponse } from '../type-message/response';
|
|
5
|
+
export type IPaginateLinkAdminData = BasePaginate<ILink>;
|
|
6
|
+
export type IPaginateLinkAdminResponse = IResponse<IPaginateLinkAdminData>;
|
|
7
|
+
export interface IGetLinkAdminData {
|
|
8
|
+
link: ILink;
|
|
9
|
+
}
|
|
10
|
+
export type IGetLinkAdminResponse = IResponse<IGetLinkAdminData>;
|
|
11
|
+
export type IGetVisitsLinkAdminData = BasePaginate<ILinkVisit>;
|
|
12
|
+
export type IGetVisitsLinkAdminResponse = IResponse<IGetVisitsLinkAdminData>;
|
|
13
|
+
export interface IGetCampaignStatsLinkAdminData {
|
|
14
|
+
rows: ILinkCampaignStatsRow[];
|
|
15
|
+
}
|
|
16
|
+
export type IGetCampaignStatsLinkAdminResponse = IResponse<IGetCampaignStatsLinkAdminData>;
|
|
17
|
+
export interface ISetProtectionLinkAdminData {
|
|
18
|
+
link: ILink;
|
|
19
|
+
}
|
|
20
|
+
export type ISetProtectionLinkAdminResponse = IResponse<ISetProtectionLinkAdminData>;
|
|
21
|
+
export interface IUpdateLinkAdminData {
|
|
22
|
+
link: ILink;
|
|
23
|
+
}
|
|
24
|
+
export type IUpdateLinkAdminResponse = IResponse<IUpdateLinkAdminData>;
|
|
25
|
+
export type IDeleteLinkAdminResponse = IResponse<Record<string, never>>;
|
|
26
|
+
export interface ICreateLinkAdminData {
|
|
27
|
+
link: ILink;
|
|
28
|
+
}
|
|
29
|
+
export type ICreateLinkAdminResponse = IResponse<ICreateLinkAdminData>;
|
|
30
|
+
export interface IGetByOriginLinkAdminData {
|
|
31
|
+
link: ILink;
|
|
32
|
+
}
|
|
33
|
+
export type IGetByOriginLinkAdminResponse = IResponse<IGetByOriginLinkAdminData>;
|
|
34
|
+
export interface IGetStatsByOriginLinkAdminData {
|
|
35
|
+
stats: ILinkStats;
|
|
36
|
+
}
|
|
37
|
+
export type IGetStatsByOriginLinkAdminResponse = IResponse<IGetStatsByOriginLinkAdminData>;
|
|
38
|
+
export type IRecordCampaignViewLinkAdminResponse = IResponse<Record<string, never>>;
|
|
39
|
+
export interface IListCampaignTokensLinkAdminData {
|
|
40
|
+
links: ILink[];
|
|
41
|
+
}
|
|
42
|
+
export type IListCampaignTokensLinkAdminResponse = IResponse<IListCampaignTokensLinkAdminData>;
|
|
43
|
+
export type IDeleteCampaignTokenLinkAdminResponse = IResponse<Record<string, never>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.admin.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/link.admin.response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.public.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/link.public.response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ILink, ILinkStats, ILinkVisit } from '../../models/link.dto';
|
|
2
|
+
import { ILinkListItem } from '../../models/link-list.dto';
|
|
3
|
+
import { BasePaginate } from '../type-message/base-paginate';
|
|
4
|
+
import { IResponse } from '../type-message/response';
|
|
5
|
+
export interface IGetLinkData {
|
|
6
|
+
link: ILink;
|
|
7
|
+
}
|
|
8
|
+
export type IGetLinkResponse = IResponse<IGetLinkData>;
|
|
9
|
+
export type IPaginateLinkData = BasePaginate<ILinkListItem>;
|
|
10
|
+
export type IPaginateLinkResponse = IResponse<IPaginateLinkData>;
|
|
11
|
+
export interface ICountOrganizationLinkData {
|
|
12
|
+
total: number;
|
|
13
|
+
orphan?: number;
|
|
14
|
+
unshared?: number;
|
|
15
|
+
}
|
|
16
|
+
export type ICountOrganizationLinkResponse = IResponse<ICountOrganizationLinkData>;
|
|
17
|
+
export interface ICreateLinkData {
|
|
18
|
+
link: ILink;
|
|
19
|
+
}
|
|
20
|
+
export type ICreateLinkResponse = IResponse<ICreateLinkData>;
|
|
21
|
+
export interface IUpdateLinkData {
|
|
22
|
+
link: ILink;
|
|
23
|
+
}
|
|
24
|
+
export type IUpdateLinkResponse = IResponse<IUpdateLinkData>;
|
|
25
|
+
export type IDeleteLinkResponse = IResponse<Record<string, never>>;
|
|
26
|
+
export interface ITransferLinkData {
|
|
27
|
+
link: ILink;
|
|
28
|
+
}
|
|
29
|
+
export type ITransferLinkResponse = IResponse<ITransferLinkData>;
|
|
30
|
+
export interface IGetLinkStatsData {
|
|
31
|
+
stats: ILinkStats;
|
|
32
|
+
}
|
|
33
|
+
export type IGetLinkStatsResponse = IResponse<IGetLinkStatsData>;
|
|
34
|
+
export type IGetLinkVisitsData = BasePaginate<ILinkVisit>;
|
|
35
|
+
export type IGetLinkVisitsResponse = IResponse<IGetLinkVisitsData>;
|
|
36
|
+
export interface IGetByOriginLinkData {
|
|
37
|
+
link: ILink;
|
|
38
|
+
}
|
|
39
|
+
export type IGetByOriginLinkResponse = IResponse<IGetByOriginLinkData>;
|
|
40
|
+
export interface IGetStatsByOriginLinkData {
|
|
41
|
+
stats: ILinkStats;
|
|
42
|
+
}
|
|
43
|
+
export type IGetStatsByOriginLinkResponse = IResponse<IGetStatsByOriginLinkData>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/link.response.ts"],"names":[],"mappings":""}
|
|
@@ -18,4 +18,5 @@ __exportStar(require("./user.dto"), exports);
|
|
|
18
18
|
__exportStar(require("./organization.dto"), exports);
|
|
19
19
|
__exportStar(require("./project.dto"), exports);
|
|
20
20
|
__exportStar(require("./link.dto"), exports);
|
|
21
|
+
__exportStar(require("./link-list.dto"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA2B;AAC3B,kDAAgC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LinkSharePermission } from '../../enum/link-share.enum';
|
|
2
|
+
import { ILink } from './link.dto';
|
|
3
|
+
export interface ILinkContentShare {
|
|
4
|
+
id: string;
|
|
5
|
+
targetType: string;
|
|
6
|
+
targetId: string | null;
|
|
7
|
+
permission: LinkSharePermission;
|
|
8
|
+
expiresAt: string | null;
|
|
9
|
+
createdByUserId: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface ILinkListItem extends ILink {
|
|
12
|
+
permission: LinkSharePermission;
|
|
13
|
+
shares: ILinkContentShare[];
|
|
14
|
+
}
|
|
15
|
+
export interface ILinkCampaignStatsRow {
|
|
16
|
+
utmCampaign: string | null;
|
|
17
|
+
utmMedium: string | null;
|
|
18
|
+
visits: number;
|
|
19
|
+
uniqueVisitors: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-list.dto.js","sourceRoot":"","sources":["../../../../src/types/interface/models/link-list.dto.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyss-project/link",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Core package to interact with AbyssLink",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"lint": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --fix",
|
|
13
|
+
"lint:check": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --max-warnings 0",
|
|
14
|
+
"tsc": "tsc",
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"prepublishOnly": "tsc && node ../../scripts/check-sdk-surface.cjs",
|
|
18
|
+
"dev": "tsc --watch"
|
|
19
|
+
},
|
|
7
20
|
"repository": {
|
|
8
21
|
"type": "git",
|
|
9
22
|
"url": "https://gitlab.com/abyss-group/abyss-link.git"
|
|
@@ -47,13 +60,5 @@
|
|
|
47
60
|
"ts-jest": "^29.4.15",
|
|
48
61
|
"tsc-watch": "^4.6.2",
|
|
49
62
|
"typescript": "5.9.3"
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"lint": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --fix",
|
|
53
|
-
"lint:check": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --max-warnings 0",
|
|
54
|
-
"tsc": "tsc",
|
|
55
|
-
"build": "tsc",
|
|
56
|
-
"test": "jest",
|
|
57
|
-
"dev": "tsc --watch"
|
|
58
63
|
}
|
|
59
|
-
}
|
|
64
|
+
}
|
package/src/api/index.ts
CHANGED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbyssLinkCore,
|
|
3
|
+
ICreateLinkAdminBody,
|
|
4
|
+
ICreateLinkAdminResponse,
|
|
5
|
+
IDeleteCampaignTokenLinkAdminParams,
|
|
6
|
+
IDeleteCampaignTokenLinkAdminResponse,
|
|
7
|
+
IDeleteLinkAdminParams,
|
|
8
|
+
IDeleteLinkAdminResponse,
|
|
9
|
+
IGetByOriginLinkAdminQuery,
|
|
10
|
+
IGetByOriginLinkAdminResponse,
|
|
11
|
+
IGetCampaignStatsLinkAdminParams,
|
|
12
|
+
IGetCampaignStatsLinkAdminQuery,
|
|
13
|
+
IGetCampaignStatsLinkAdminResponse,
|
|
14
|
+
IGetLinkAdminParams,
|
|
15
|
+
IGetLinkAdminResponse,
|
|
16
|
+
IGetLinkStatsQuery,
|
|
17
|
+
IGetStatsByOriginLinkAdminResponse,
|
|
18
|
+
IGetVisitsLinkAdminParams,
|
|
19
|
+
IGetVisitsLinkAdminQuery,
|
|
20
|
+
IGetVisitsLinkAdminResponse,
|
|
21
|
+
IListCampaignTokensLinkAdminQuery,
|
|
22
|
+
IListCampaignTokensLinkAdminResponse,
|
|
23
|
+
ILinkOrigin,
|
|
24
|
+
IPaginateLinkAdminQuery,
|
|
25
|
+
IPaginateLinkAdminResponse,
|
|
26
|
+
IRecordCampaignViewLinkAdminBody,
|
|
27
|
+
IRecordCampaignViewLinkAdminResponse,
|
|
28
|
+
ISetProtectionLinkAdminBody,
|
|
29
|
+
ISetProtectionLinkAdminParams,
|
|
30
|
+
ISetProtectionLinkAdminResponse,
|
|
31
|
+
IUpdateLinkAdminBody,
|
|
32
|
+
IUpdateLinkAdminParams,
|
|
33
|
+
IUpdateLinkAdminResponse,
|
|
34
|
+
} from '..';
|
|
35
|
+
|
|
36
|
+
export const paginateLinkAdmin = async (
|
|
37
|
+
query: IPaginateLinkAdminQuery,
|
|
38
|
+
): Promise<IPaginateLinkAdminResponse> => {
|
|
39
|
+
return (
|
|
40
|
+
await AbyssLinkCore.axios.get<IPaginateLinkAdminResponse>(`admin/link/paginate`, {
|
|
41
|
+
params: query,
|
|
42
|
+
})
|
|
43
|
+
).data;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const getLinkAdmin = async (params: IGetLinkAdminParams): Promise<IGetLinkAdminResponse> => {
|
|
47
|
+
return (await AbyssLinkCore.axios.get<IGetLinkAdminResponse>(`admin/link/${params.linkId}`)).data;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const getVisitsLinkAdmin = async (
|
|
51
|
+
params: IGetVisitsLinkAdminParams,
|
|
52
|
+
query: IGetVisitsLinkAdminQuery = {},
|
|
53
|
+
): Promise<IGetVisitsLinkAdminResponse> => {
|
|
54
|
+
return (
|
|
55
|
+
await AbyssLinkCore.axios.get<IGetVisitsLinkAdminResponse>(
|
|
56
|
+
`admin/link/${params.linkId}/visits`,
|
|
57
|
+
{ params: query },
|
|
58
|
+
)
|
|
59
|
+
).data;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const getCampaignStatsLinkAdmin = async (
|
|
63
|
+
params: IGetCampaignStatsLinkAdminParams,
|
|
64
|
+
query: IGetCampaignStatsLinkAdminQuery,
|
|
65
|
+
): Promise<IGetCampaignStatsLinkAdminResponse> => {
|
|
66
|
+
return (
|
|
67
|
+
await AbyssLinkCore.axios.get<IGetCampaignStatsLinkAdminResponse>(
|
|
68
|
+
`admin/link/${params.linkId}/campaign-stats`,
|
|
69
|
+
{ params: query },
|
|
70
|
+
)
|
|
71
|
+
).data;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const setProtectionLinkAdmin = async (
|
|
75
|
+
params: ISetProtectionLinkAdminParams,
|
|
76
|
+
body: ISetProtectionLinkAdminBody,
|
|
77
|
+
): Promise<ISetProtectionLinkAdminResponse> => {
|
|
78
|
+
return (
|
|
79
|
+
await AbyssLinkCore.axios.put<ISetProtectionLinkAdminResponse>(
|
|
80
|
+
`admin/link/${params.linkId}/protection`,
|
|
81
|
+
body,
|
|
82
|
+
)
|
|
83
|
+
).data;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const updateLinkAdmin = async (
|
|
87
|
+
params: IUpdateLinkAdminParams,
|
|
88
|
+
body: IUpdateLinkAdminBody,
|
|
89
|
+
): Promise<IUpdateLinkAdminResponse> => {
|
|
90
|
+
return (
|
|
91
|
+
await AbyssLinkCore.axios.put<IUpdateLinkAdminResponse>(`admin/link/${params.linkId}`, body)
|
|
92
|
+
).data;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const deleteLinkAdmin = async (
|
|
96
|
+
params: IDeleteLinkAdminParams,
|
|
97
|
+
): Promise<IDeleteLinkAdminResponse> => {
|
|
98
|
+
return (await AbyssLinkCore.axios.delete<IDeleteLinkAdminResponse>(`admin/link/${params.linkId}`))
|
|
99
|
+
.data;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* A RESOURCE address or a campaign token for a product resource, free on Link's lines. A RESOURCE
|
|
104
|
+
* is one per origin: a second call returns the same link.
|
|
105
|
+
*/
|
|
106
|
+
export const createLinkAdmin = async (
|
|
107
|
+
body: ICreateLinkAdminBody,
|
|
108
|
+
): Promise<ICreateLinkAdminResponse> => {
|
|
109
|
+
return (await AbyssLinkCore.axios.post<ICreateLinkAdminResponse>(`admin/link`, body)).data;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/** The RESOURCE address of a product resource; 404 when the product minted none. */
|
|
113
|
+
export const getByOriginLinkAdmin = async (
|
|
114
|
+
origin: IGetByOriginLinkAdminQuery,
|
|
115
|
+
): Promise<IGetByOriginLinkAdminResponse> => {
|
|
116
|
+
return (
|
|
117
|
+
await AbyssLinkCore.axios.get<IGetByOriginLinkAdminResponse>(`admin/link/origin`, {
|
|
118
|
+
params: origin,
|
|
119
|
+
})
|
|
120
|
+
).data;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/** The statistics of a product resource's RESOURCE address over `range` (30 days by default). */
|
|
124
|
+
export const getStatsByOriginLinkAdmin = async (
|
|
125
|
+
origin: ILinkOrigin,
|
|
126
|
+
range: IGetLinkStatsQuery = {},
|
|
127
|
+
): Promise<IGetStatsByOriginLinkAdminResponse> => {
|
|
128
|
+
return (
|
|
129
|
+
await AbyssLinkCore.axios.get<IGetStatsByOriginLinkAdminResponse>(`admin/link/origin/stats`, {
|
|
130
|
+
params: { ...origin, ...range },
|
|
131
|
+
})
|
|
132
|
+
).data;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/** Records a page view attributed to a campaign token; 404 for an unknown token. */
|
|
136
|
+
export const recordCampaignViewLinkAdmin = async (
|
|
137
|
+
body: IRecordCampaignViewLinkAdminBody,
|
|
138
|
+
): Promise<IRecordCampaignViewLinkAdminResponse> => {
|
|
139
|
+
return (
|
|
140
|
+
await AbyssLinkCore.axios.post<IRecordCampaignViewLinkAdminResponse>(
|
|
141
|
+
`admin/link/campaign-view`,
|
|
142
|
+
body,
|
|
143
|
+
)
|
|
144
|
+
).data;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/** The campaign tokens of a product resource, oldest first. */
|
|
148
|
+
export const listCampaignTokensLinkAdmin = async (
|
|
149
|
+
origin: IListCampaignTokensLinkAdminQuery,
|
|
150
|
+
): Promise<IListCampaignTokensLinkAdminResponse> => {
|
|
151
|
+
return (
|
|
152
|
+
await AbyssLinkCore.axios.get<IListCampaignTokensLinkAdminResponse>(
|
|
153
|
+
`admin/link/campaign-token`,
|
|
154
|
+
{ params: origin },
|
|
155
|
+
)
|
|
156
|
+
).data;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/** Deletes a campaign token; 404 for any other link. */
|
|
160
|
+
export const deleteCampaignTokenLinkAdmin = async (
|
|
161
|
+
params: IDeleteCampaignTokenLinkAdminParams,
|
|
162
|
+
): Promise<IDeleteCampaignTokenLinkAdminResponse> => {
|
|
163
|
+
return (
|
|
164
|
+
await AbyssLinkCore.axios.delete<IDeleteCampaignTokenLinkAdminResponse>(
|
|
165
|
+
`admin/link/campaign-token/${params.linkId}`,
|
|
166
|
+
)
|
|
167
|
+
).data;
|
|
168
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbyssLinkCore,
|
|
3
|
+
ICountOrganizationLinkParams,
|
|
4
|
+
ICountOrganizationLinkQuery,
|
|
5
|
+
ICountOrganizationLinkResponse,
|
|
6
|
+
ICreateForOrganizationLinkBody,
|
|
7
|
+
ICreateForOrganizationLinkParams,
|
|
8
|
+
ICreateLinkBody,
|
|
9
|
+
ICreateLinkResponse,
|
|
10
|
+
IDeleteLinkParams,
|
|
11
|
+
IDeleteLinkResponse,
|
|
12
|
+
IGetByOriginLinkQuery,
|
|
13
|
+
IGetByOriginLinkResponse,
|
|
14
|
+
IGetLinkParams,
|
|
15
|
+
IGetLinkResponse,
|
|
16
|
+
IGetLinkStatsParams,
|
|
17
|
+
IGetLinkStatsQuery,
|
|
18
|
+
IGetLinkStatsResponse,
|
|
19
|
+
IGetLinkVisitsParams,
|
|
20
|
+
IGetLinkVisitsQuery,
|
|
21
|
+
IGetLinkVisitsResponse,
|
|
22
|
+
IGetStatsByOriginLinkQuery,
|
|
23
|
+
IGetStatsByOriginLinkResponse,
|
|
24
|
+
IPaginateLinkQuery,
|
|
25
|
+
IPaginateLinkResponse,
|
|
26
|
+
IPaginateOrganizationLinkParams,
|
|
27
|
+
IPaginateOrganizationLinkQuery,
|
|
28
|
+
IPaginateProjectLinkParams,
|
|
29
|
+
ITransferLinkBody,
|
|
30
|
+
ITransferLinkParams,
|
|
31
|
+
ITransferLinkResponse,
|
|
32
|
+
IUpdateLinkBody,
|
|
33
|
+
IUpdateLinkParams,
|
|
34
|
+
IUpdateLinkResponse,
|
|
35
|
+
} from '..';
|
|
36
|
+
|
|
37
|
+
/** The caller's own SHORTENED links. */
|
|
38
|
+
export const paginateLink = async (query: IPaginateLinkQuery): Promise<IPaginateLinkResponse> => {
|
|
39
|
+
return (await AbyssLinkCore.axios.get<IPaginateLinkResponse>(`link/paginate`, { params: query }))
|
|
40
|
+
.data;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const paginateProjectLink = async (
|
|
44
|
+
params: IPaginateProjectLinkParams,
|
|
45
|
+
query: IPaginateLinkQuery,
|
|
46
|
+
): Promise<IPaginateLinkResponse> => {
|
|
47
|
+
return (
|
|
48
|
+
await AbyssLinkCore.axios.get<IPaginateLinkResponse>(
|
|
49
|
+
`link/project/${params.projectId}/paginate`,
|
|
50
|
+
{ params: query },
|
|
51
|
+
)
|
|
52
|
+
).data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const paginateOrganizationLink = async (
|
|
56
|
+
params: IPaginateOrganizationLinkParams,
|
|
57
|
+
query: IPaginateOrganizationLinkQuery,
|
|
58
|
+
): Promise<IPaginateLinkResponse> => {
|
|
59
|
+
return (
|
|
60
|
+
await AbyssLinkCore.axios.get<IPaginateLinkResponse>(
|
|
61
|
+
`link/organization/${params.organizationId}/paginate`,
|
|
62
|
+
{ params: query },
|
|
63
|
+
)
|
|
64
|
+
).data;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const countOrganizationLink = async (
|
|
68
|
+
params: ICountOrganizationLinkParams,
|
|
69
|
+
query: ICountOrganizationLinkQuery = {},
|
|
70
|
+
): Promise<ICountOrganizationLinkResponse> => {
|
|
71
|
+
return (
|
|
72
|
+
await AbyssLinkCore.axios.get<ICountOrganizationLinkResponse>(
|
|
73
|
+
`link/organization/${params.organizationId}/count`,
|
|
74
|
+
{ params: query },
|
|
75
|
+
)
|
|
76
|
+
).data;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const getLink = async (params: IGetLinkParams): Promise<IGetLinkResponse> => {
|
|
80
|
+
return (await AbyssLinkCore.axios.get<IGetLinkResponse>(`link/${params.linkId}`)).data;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const createLink = async (body: ICreateLinkBody): Promise<ICreateLinkResponse> => {
|
|
84
|
+
return (await AbyssLinkCore.axios.post<ICreateLinkResponse>(`link`, body)).data;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const createForOrganizationLink = async (
|
|
88
|
+
params: ICreateForOrganizationLinkParams,
|
|
89
|
+
body: ICreateForOrganizationLinkBody,
|
|
90
|
+
): Promise<ICreateLinkResponse> => {
|
|
91
|
+
return (
|
|
92
|
+
await AbyssLinkCore.axios.post<ICreateLinkResponse>(
|
|
93
|
+
`link/organization/${params.organizationId}`,
|
|
94
|
+
body,
|
|
95
|
+
)
|
|
96
|
+
).data;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const updateLink = async (
|
|
100
|
+
params: IUpdateLinkParams,
|
|
101
|
+
body: IUpdateLinkBody,
|
|
102
|
+
): Promise<IUpdateLinkResponse> => {
|
|
103
|
+
return (await AbyssLinkCore.axios.put<IUpdateLinkResponse>(`link/${params.linkId}`, body)).data;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const deleteLink = async (params: IDeleteLinkParams): Promise<IDeleteLinkResponse> => {
|
|
107
|
+
return (await AbyssLinkCore.axios.delete<IDeleteLinkResponse>(`link/${params.linkId}`)).data;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const transferLink = async (
|
|
111
|
+
params: ITransferLinkParams,
|
|
112
|
+
body: ITransferLinkBody,
|
|
113
|
+
): Promise<ITransferLinkResponse> => {
|
|
114
|
+
return (
|
|
115
|
+
await AbyssLinkCore.axios.post<ITransferLinkResponse>(`link/${params.linkId}/transfer`, body)
|
|
116
|
+
).data;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const getStatsLink = async (
|
|
120
|
+
params: IGetLinkStatsParams,
|
|
121
|
+
query: IGetLinkStatsQuery = {},
|
|
122
|
+
): Promise<IGetLinkStatsResponse> => {
|
|
123
|
+
return (
|
|
124
|
+
await AbyssLinkCore.axios.get<IGetLinkStatsResponse>(`link/${params.linkId}/stats`, {
|
|
125
|
+
params: query,
|
|
126
|
+
})
|
|
127
|
+
).data;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const getVisitsLink = async (
|
|
131
|
+
params: IGetLinkVisitsParams,
|
|
132
|
+
query: IGetLinkVisitsQuery = {},
|
|
133
|
+
): Promise<IGetLinkVisitsResponse> => {
|
|
134
|
+
return (
|
|
135
|
+
await AbyssLinkCore.axios.get<IGetLinkVisitsResponse>(`link/${params.linkId}/visits`, {
|
|
136
|
+
params: query,
|
|
137
|
+
})
|
|
138
|
+
).data;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/** The RESOURCE address of a product resource, from EDIT on the resource. */
|
|
142
|
+
export const getByOriginLink = async (
|
|
143
|
+
query: IGetByOriginLinkQuery,
|
|
144
|
+
): Promise<IGetByOriginLinkResponse> => {
|
|
145
|
+
return (await AbyssLinkCore.axios.get<IGetByOriginLinkResponse>(`link/origin`, { params: query }))
|
|
146
|
+
.data;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/** The statistics of a product resource's RESOURCE address, from EDIT on the resource. */
|
|
150
|
+
export const getStatsByOriginLink = async (
|
|
151
|
+
query: IGetStatsByOriginLinkQuery,
|
|
152
|
+
): Promise<IGetStatsByOriginLinkResponse> => {
|
|
153
|
+
return (
|
|
154
|
+
await AbyssLinkCore.axios.get<IGetStatsByOriginLinkResponse>(`link/origin/stats`, {
|
|
155
|
+
params: query,
|
|
156
|
+
})
|
|
157
|
+
).data;
|
|
158
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbyssLinkCore,
|
|
3
|
+
IUnlockLinkPublicBody,
|
|
4
|
+
IUnlockLinkPublicParams,
|
|
5
|
+
IUnlockLinkPublicResponse,
|
|
6
|
+
} from '..';
|
|
7
|
+
|
|
8
|
+
/** Unlocks a shortened link protected by a password: the right password answers its destination. */
|
|
9
|
+
export const unlockLinkPublic = async ({
|
|
10
|
+
slug,
|
|
11
|
+
...body
|
|
12
|
+
}: IUnlockLinkPublicParams & IUnlockLinkPublicBody): Promise<IUnlockLinkPublicResponse> => {
|
|
13
|
+
return (
|
|
14
|
+
await AbyssLinkCore.axios.post<IUnlockLinkPublicResponse>(
|
|
15
|
+
`link/public/${encodeURIComponent(slug)}/unlock`,
|
|
16
|
+
body,
|
|
17
|
+
)
|
|
18
|
+
).data;
|
|
19
|
+
};
|