@adtrackify/at-service-common 1.0.20 → 1.0.22
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 +13 -9
- package/dist/index.js +79 -127
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/src/clients/internal-api/destinations-client.ts +15 -16
- package/src/index.ts +1 -1
- package/src/types/api-response.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Destination } from 'aws-sdk/clients/lexmodelbuildingservice';
|
|
2
2
|
import * as log from 'lambda-log';
|
|
3
|
-
import {
|
|
4
|
-
import { ApiResponse, ErrorData } from '../../types/api-response';
|
|
3
|
+
import { ApiResponse } from '../../types/api-response';
|
|
5
4
|
import { axiosHttpService } from '../generic/http-client';
|
|
6
5
|
|
|
7
6
|
//const BASE_API_URL = process.env.BASE_API_URL;
|
|
@@ -33,28 +32,28 @@ export class DestinationsClient {
|
|
|
33
32
|
return axiosHttpService(this.getConfig());
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
createDestination = async (createDestinationRequest: any): Promise<ApiResponse<
|
|
35
|
+
createDestination = async (createDestinationRequest: any): Promise<ApiResponse<CreateDestinationResponseData>> => {
|
|
37
36
|
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>;
|
|
37
|
+
const response = await client.post('/', createDestinationRequest);
|
|
38
|
+
log.info('createDestinationResponse', { response });
|
|
39
|
+
return response as ApiResponse<CreateDestinationResponseData>;
|
|
45
40
|
};
|
|
46
41
|
|
|
47
|
-
getPixelDestinations = async (pixelId: string): Promise<ApiResponse<
|
|
42
|
+
getPixelDestinations = async (pixelId: string): Promise<ApiResponse<GetDestinationsResponseData>> => {
|
|
48
43
|
const client = await this.getClient();
|
|
49
44
|
const response = await client.get(`/?pixelId=${pixelId}`);
|
|
50
45
|
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; } | any>;
|
|
46
|
+
return response as ApiResponse<GetDestinationsResponseData>;
|
|
56
47
|
};
|
|
57
48
|
}
|
|
58
49
|
|
|
50
|
+
export interface GetDestinationsResponseData {
|
|
51
|
+
destinations: Destination[];
|
|
52
|
+
[ key: string ]: any;
|
|
53
|
+
}
|
|
54
|
+
export interface CreateDestinationResponseData {
|
|
55
|
+
destination: Destination;
|
|
56
|
+
[ key: string ]: any;
|
|
57
|
+
}
|
|
59
58
|
|
|
60
59
|
export default DestinationsClient;
|
package/src/index.ts
CHANGED