@adtrackify/at-service-common 1.0.19 → 1.0.20
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Destination } from 'aws-sdk/clients/lexmodelbuildingservice';
|
|
2
2
|
import * as log from 'lambda-log';
|
|
3
3
|
import { HttpStatusCodes } from '../../libs';
|
|
4
|
-
import { ApiResponse } from '../../types/api-response';
|
|
4
|
+
import { ApiResponse, ErrorData } from '../../types/api-response';
|
|
5
5
|
import { axiosHttpService } from '../generic/http-client';
|
|
6
6
|
|
|
7
7
|
//const BASE_API_URL = process.env.BASE_API_URL;
|
|
@@ -44,11 +44,15 @@ export class DestinationsClient {
|
|
|
44
44
|
} as ApiResponse<{ destination: Destination; } | any>;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
getPixelDestinations = async (pixelId: string): Promise<ApiResponse<{ destinations: Destination[]; } |
|
|
47
|
+
getPixelDestinations = async (pixelId: string): Promise<ApiResponse<{ destinations: Destination[]; } | ErrorData>> => {
|
|
48
48
|
const client = await this.getClient();
|
|
49
|
-
const
|
|
50
|
-
log.info('
|
|
51
|
-
return
|
|
49
|
+
const response = await client.get(`/?pixelId=${pixelId}`);
|
|
50
|
+
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>;
|
|
52
56
|
};
|
|
53
57
|
}
|
|
54
58
|
|