@adtrackify/at-service-common 1.0.21 → 1.0.23
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/index.d.ts
CHANGED
|
@@ -76,8 +76,8 @@ declare module '@adtrackify/at-service-common/clients/index' {
|
|
|
76
76
|
|
|
77
77
|
}
|
|
78
78
|
declare module '@adtrackify/at-service-common/clients/internal-api/destinations-client' {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
79
|
+
import { ApiResponse } from '@adtrackify/at-service-common/types/api-response';
|
|
80
|
+
import { Destination } from '@adtrackify/at-service-common/types/db/destination';
|
|
81
81
|
export class DestinationsClient {
|
|
82
82
|
BASE_API_URL: string;
|
|
83
83
|
DESTINATIONS_API_KEY: string;
|
|
@@ -119,12 +119,16 @@ declare module '@adtrackify/at-service-common/clients/internal-api/destinations-
|
|
|
119
119
|
}>;
|
|
120
120
|
setBaseUrl: (url: string) => boolean;
|
|
121
121
|
}>;
|
|
122
|
-
createDestination: (createDestinationRequest: any) => Promise<ApiResponse<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
createDestination: (createDestinationRequest: any) => Promise<ApiResponse<CreateDestinationResponseData>>;
|
|
123
|
+
getPixelDestinations: (pixelId: string) => Promise<ApiResponse<GetDestinationsResponseData>>;
|
|
124
|
+
}
|
|
125
|
+
export interface GetDestinationsResponseData {
|
|
126
|
+
destinations: Destination[];
|
|
127
|
+
[key: string]: any;
|
|
128
|
+
}
|
|
129
|
+
export interface CreateDestinationResponseData {
|
|
130
|
+
destination: Destination;
|
|
131
|
+
[key: string]: any;
|
|
128
132
|
}
|
|
129
133
|
export default DestinationsClient;
|
|
130
134
|
|
|
@@ -303,7 +307,6 @@ declare module '@adtrackify/at-service-common/types/api-response' {
|
|
|
303
307
|
status: number;
|
|
304
308
|
headers?: AxiosResponseHeaders;
|
|
305
309
|
}
|
|
306
|
-
export type ErrorData = any;
|
|
307
310
|
|
|
308
311
|
}
|
|
309
312
|
declare module '@adtrackify/at-service-common/types/db/destination' {
|
package/package.json
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { Destination } from 'aws-sdk/clients/lexmodelbuildingservice';
|
|
2
1
|
import * as log from 'lambda-log';
|
|
3
|
-
import {
|
|
4
|
-
import { ApiResponse, ErrorData } from '../../types/api-response';
|
|
2
|
+
import { ApiResponse } from '../../types/api-response';
|
|
5
3
|
import { axiosHttpService } from '../generic/http-client';
|
|
6
|
-
|
|
4
|
+
import { Destination } from '../../types/db/destination';
|
|
7
5
|
//const BASE_API_URL = process.env.BASE_API_URL;
|
|
8
6
|
//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;
|
|
9
7
|
|
|
@@ -33,28 +31,28 @@ export class DestinationsClient {
|
|
|
33
31
|
return axiosHttpService(this.getConfig());
|
|
34
32
|
};
|
|
35
33
|
|
|
36
|
-
createDestination = async (createDestinationRequest: any): Promise<ApiResponse<
|
|
34
|
+
createDestination = async (createDestinationRequest: any): Promise<ApiResponse<CreateDestinationResponseData>> => {
|
|
37
35
|
const client = await this.getClient();
|
|
38
|
-
const
|
|
39
|
-
log.info('createDestinationResponse', {
|
|
40
|
-
return
|
|
41
|
-
status: createDestinationResponse.status,
|
|
42
|
-
headers: createDestinationResponse.headers,
|
|
43
|
-
data: createDestinationResponse.status === HttpStatusCodes.OK ? createDestinationResponse.data as { destination: Destination; } : createDestinationResponse.data
|
|
44
|
-
} as ApiResponse<{ destination: Destination; } | any>;
|
|
36
|
+
const response = await client.post('/', createDestinationRequest);
|
|
37
|
+
log.info('createDestinationResponse', { response });
|
|
38
|
+
return response as ApiResponse<CreateDestinationResponseData>;
|
|
45
39
|
};
|
|
46
40
|
|
|
47
|
-
getPixelDestinations = async (pixelId: string): Promise<ApiResponse<
|
|
41
|
+
getPixelDestinations = async (pixelId: string): Promise<ApiResponse<GetDestinationsResponseData>> => {
|
|
48
42
|
const client = await this.getClient();
|
|
49
43
|
const response = await client.get(`/?pixelId=${pixelId}`);
|
|
50
44
|
log.info('getPixelResponse', { response });
|
|
51
|
-
return
|
|
52
|
-
status: response.status,
|
|
53
|
-
headers: response.headers,
|
|
54
|
-
data: response.status === HttpStatusCodes.OK ? response.data as { destinations: Destination[]; } : response.data as ErrorData
|
|
55
|
-
} as ApiResponse<{ destination: Destination; } | ErrorData>;
|
|
45
|
+
return response as ApiResponse<GetDestinationsResponseData>;
|
|
56
46
|
};
|
|
57
47
|
}
|
|
58
48
|
|
|
49
|
+
export interface GetDestinationsResponseData {
|
|
50
|
+
destinations: Destination[];
|
|
51
|
+
[ key: string ]: any;
|
|
52
|
+
}
|
|
53
|
+
export interface CreateDestinationResponseData {
|
|
54
|
+
destination: Destination;
|
|
55
|
+
[ key: string ]: any;
|
|
56
|
+
}
|
|
59
57
|
|
|
60
58
|
export default DestinationsClient;
|