@spritz-finance/service-client 0.3.140 → 0.4.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/lib/users/types.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export * as UsersClient from './usersServiceClient';
|
|
2
2
|
import { Integrator, IntegratorWebhook, User } from './types';
|
|
3
3
|
export declare function getActiveUsers(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<string[]>>;
|
|
4
|
-
export declare function getUserById(id: string): Promise<User
|
|
5
|
-
export declare function setMembership(userId: string, membership: string): Promise<User
|
|
6
|
-
export declare function findOrInitialize(email: string): Promise<User
|
|
7
|
-
export declare function findByEmail(email: string): Promise<User
|
|
8
|
-
export declare function getIntegratorWebhooks(integratorId: string): Promise<IntegratorWebhook[]>;
|
|
9
|
-
export declare function getIntegrator(integratorId: string): Promise<Integrator>;
|
|
4
|
+
export declare function getUserById(id: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<User>>;
|
|
5
|
+
export declare function setMembership(userId: string, membership: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<User>>;
|
|
6
|
+
export declare function findOrInitialize(email: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<User>>;
|
|
7
|
+
export declare function findByEmail(email: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<User>>;
|
|
10
8
|
export declare function validateAdIdentifiers(adIdentifiers?: {
|
|
11
9
|
gclid?: string;
|
|
12
10
|
twclid?: string;
|
|
13
11
|
fbclid?: string;
|
|
14
12
|
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<boolean>>;
|
|
13
|
+
export declare function getIntegratorWebhooks(integratorId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<IntegratorWebhook[]>>;
|
|
14
|
+
export declare function getIntegrator(integratorId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Integrator>>;
|
|
@@ -23,25 +23,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.getIntegrator = exports.getIntegratorWebhooks = exports.validateAdIdentifiers = exports.findByEmail = exports.findOrInitialize = exports.setMembership = exports.getUserById = exports.getActiveUsers = exports.UsersClient = void 0;
|
|
27
27
|
exports.UsersClient = __importStar(require("./usersServiceClient"));
|
|
28
28
|
const serviceClient_1 = require("../serviceClient");
|
|
29
|
-
const
|
|
29
|
+
const NEW_USER_ENDPOINT = '/v2/users/api';
|
|
30
30
|
async function getActiveUsers() {
|
|
31
31
|
return serviceClient_1.baseClient
|
|
32
|
-
.get(
|
|
32
|
+
.get(`${NEW_USER_ENDPOINT}/users/active`)
|
|
33
33
|
.then((res) => res.data);
|
|
34
34
|
}
|
|
35
35
|
exports.getActiveUsers = getActiveUsers;
|
|
36
36
|
async function getUserById(id) {
|
|
37
37
|
return serviceClient_1.baseClient
|
|
38
|
-
.get(`${
|
|
38
|
+
.get(`${NEW_USER_ENDPOINT}/users/${id}`)
|
|
39
39
|
.then((res) => res.data);
|
|
40
40
|
}
|
|
41
41
|
exports.getUserById = getUserById;
|
|
42
42
|
async function setMembership(userId, membership) {
|
|
43
43
|
return serviceClient_1.baseClient
|
|
44
|
-
.post(`${
|
|
44
|
+
.post(`${NEW_USER_ENDPOINT}/users/${userId}/membership`, {
|
|
45
45
|
membership,
|
|
46
46
|
})
|
|
47
47
|
.then((res) => res.data);
|
|
@@ -49,7 +49,7 @@ async function setMembership(userId, membership) {
|
|
|
49
49
|
exports.setMembership = setMembership;
|
|
50
50
|
async function findOrInitialize(email) {
|
|
51
51
|
return serviceClient_1.baseClient
|
|
52
|
-
.post(`${
|
|
52
|
+
.post(`${NEW_USER_ENDPOINT}/users`, {
|
|
53
53
|
email,
|
|
54
54
|
})
|
|
55
55
|
.then((res) => res.data);
|
|
@@ -57,25 +57,25 @@ async function findOrInitialize(email) {
|
|
|
57
57
|
exports.findOrInitialize = findOrInitialize;
|
|
58
58
|
async function findByEmail(email) {
|
|
59
59
|
return serviceClient_1.baseClient
|
|
60
|
-
.get(`${
|
|
60
|
+
.get(`${NEW_USER_ENDPOINT}/users?email=${encodeURIComponent(email)}`)
|
|
61
61
|
.then((res) => res.data);
|
|
62
62
|
}
|
|
63
63
|
exports.findByEmail = findByEmail;
|
|
64
|
+
async function validateAdIdentifiers(adIdentifiers) {
|
|
65
|
+
return serviceClient_1.baseClient
|
|
66
|
+
.post(`${NEW_USER_ENDPOINT}/ad-identifiers/validations`, adIdentifiers)
|
|
67
|
+
.then((res) => res.data);
|
|
68
|
+
}
|
|
69
|
+
exports.validateAdIdentifiers = validateAdIdentifiers;
|
|
64
70
|
async function getIntegratorWebhooks(integratorId) {
|
|
65
71
|
return serviceClient_1.baseClient
|
|
66
|
-
.get(`${
|
|
72
|
+
.get(`${NEW_USER_ENDPOINT}/integrators/${integratorId}/webhooks`)
|
|
67
73
|
.then((res) => res.data);
|
|
68
74
|
}
|
|
69
75
|
exports.getIntegratorWebhooks = getIntegratorWebhooks;
|
|
70
76
|
async function getIntegrator(integratorId) {
|
|
71
77
|
return serviceClient_1.baseClient
|
|
72
|
-
.get(`${
|
|
78
|
+
.get(`${NEW_USER_ENDPOINT}/integrators/${integratorId}`)
|
|
73
79
|
.then((res) => res.data);
|
|
74
80
|
}
|
|
75
81
|
exports.getIntegrator = getIntegrator;
|
|
76
|
-
async function validateAdIdentifiers(adIdentifiers) {
|
|
77
|
-
return serviceClient_1.baseClient
|
|
78
|
-
.post(`${USERS_ENDPOINT}/ad-identifiers/validate`, adIdentifiers)
|
|
79
|
-
.then((res) => res.data);
|
|
80
|
-
}
|
|
81
|
-
exports.validateAdIdentifiers = validateAdIdentifiers;
|