@agenus-io/pixel-backend-sdk 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.
@@ -22,10 +22,10 @@ export declare class PixelSDK implements IPixelSdk {
22
22
  * @throws {Error} Se houver erro ao enviar a mensagem para a fila
23
23
  */
24
24
  SendOrder(params: SendSaleParams): Promise<void>;
25
- Create({ data, workspaceId }: ICreatePixelDTO.Params): Promise<void>;
25
+ Create({ data, workspaceId }: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
26
26
  Update({ data, workspaceId, id }: IUpdatePixelDTO.Params): Promise<void>;
27
27
  Delete({ id, workspaceId }: IDeletePixelDTO.Params): Promise<void>;
28
- Get({ page, pageSize, filter, workSpaceId }: IGetPixelDTO.Params): Promise<IGetPixelDTO.Result>;
28
+ Get({ page, pageSize, filter, workSpaceId, platform, productIds, offerIds }: IGetPixelDTO.Params): Promise<IGetPixelDTO.Result>;
29
29
  GetOne({ id, workSpaceId }: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
30
30
  UpdateOffers({ id, workspaceId, offerIds, type }: IUpdateOffersDTO.Params): Promise<void>;
31
31
  }
@@ -98,7 +98,8 @@ class PixelSDK {
98
98
  secretToken: this.appToken,
99
99
  workSpaceId: workspaceId,
100
100
  };
101
- await axios_1.default.post(`${this.apiUrl}/pixels`, { token, ...data });
101
+ const response = await axios_1.default.post(`${this.apiUrl}/pixels`, { token, ...data });
102
+ return response.data;
102
103
  }
103
104
  catch (error) {
104
105
  if (error instanceof axios_1.AxiosError) {
@@ -150,7 +151,7 @@ class PixelSDK {
150
151
  throw "Erro ao deletar pixel";
151
152
  }
152
153
  }
153
- async Get({ page, pageSize, filter, workSpaceId }) {
154
+ async Get({ page, pageSize, filter, workSpaceId, platform, productIds, offerIds }) {
154
155
  try {
155
156
  const token = {
156
157
  appId: this.appId,
@@ -159,7 +160,7 @@ class PixelSDK {
159
160
  };
160
161
  const response = await axios_1.default.get(`${this.apiUrl}/pixels`, {
161
162
  headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
162
- params: { page, pageSize, filter },
163
+ params: { page, pageSize, filter, platform, productIds, offerIds },
163
164
  });
164
165
  return response.data;
165
166
  }
@@ -37,6 +37,9 @@ export declare namespace ICreatePixelDTO {
37
37
  workspaceId: string;
38
38
  data: CreatePixel;
39
39
  };
40
+ type Result = {
41
+ id: string;
42
+ };
40
43
  }
41
44
  export declare namespace IUpdatePixelDTO {
42
45
  type Params = {
@@ -57,6 +60,9 @@ export declare namespace IGetPixelDTO {
57
60
  page: number;
58
61
  pageSize: number;
59
62
  filter?: string;
63
+ platform?: MarketingPlatform;
64
+ productIds?: string[];
65
+ offerIds?: string[];
60
66
  };
61
67
  type Result = {
62
68
  data: {
@@ -145,7 +151,7 @@ export declare namespace IUpdateOffersDTO {
145
151
  };
146
152
  }
147
153
  export interface IPixelSdk {
148
- Create(params: ICreatePixelDTO.Params): Promise<void>;
154
+ Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
149
155
  Update(params: IUpdatePixelDTO.Params): Promise<void>;
150
156
  Delete(params: IDeletePixelDTO.Params): Promise<void>;
151
157
  Get(params: IGetPixelDTO.Params): Promise<IGetPixelDTO.Result>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenus-io/pixel-backend-sdk",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "SDK para envio de vendas para fila AWS SQS do micro-serviço de pixels",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",