@parra/parra-js-sdk 0.2.109 → 0.2.112

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.
@@ -330,6 +330,7 @@ export interface AppAreaCollectionResponse {
330
330
  export declare type AppAreaListResponse = Array<AppArea>;
331
331
  export declare enum CampaignStatus {
332
332
  active = "active",
333
+ paused = "paused",
333
334
  draft = "draft",
334
335
  scheduled = "scheduled",
335
336
  complete = "complete",
@@ -337,12 +338,20 @@ export declare enum CampaignStatus {
337
338
  archived = "archived"
338
339
  }
339
340
  export interface UpdateCampaignRequestBody {
340
- name: string;
341
+ name?: string;
341
342
  description?: string | null;
343
+ start_at?: string | null;
344
+ end_at?: string | null;
345
+ triggers?: UpdateCampaignTriggerList;
346
+ actions?: UpdateCampaignActionList;
342
347
  }
343
348
  export interface CreateCampaignRequestBody {
344
- name: string;
349
+ name?: string;
345
350
  description?: string | null;
351
+ start_at?: string | null;
352
+ end_at?: string | null;
353
+ triggers?: UpdateCampaignTriggerList;
354
+ actions?: UpdateCampaignActionList;
346
355
  }
347
356
  export interface Campaign {
348
357
  id: string;
@@ -355,7 +364,11 @@ export interface Campaign {
355
364
  published_at?: string | null;
356
365
  start_at?: string | null;
357
366
  end_at?: string | null;
367
+ paused_at?: string | null;
368
+ closed_at?: string | null;
358
369
  status: CampaignStatus;
370
+ triggers?: CampaignTriggerList;
371
+ actions?: CampaignActionList;
359
372
  }
360
373
  export interface CampaignCollectionResponse {
361
374
  page: number;
@@ -365,6 +378,30 @@ export interface CampaignCollectionResponse {
365
378
  data: Array<Campaign>;
366
379
  }
367
380
  export declare type CampaignListResponse = Array<Campaign>;
381
+ export interface UpdateCampaignTriggerRequestBody {
382
+ analytic_event_type_id: string;
383
+ }
384
+ export declare type UpdateCampaignTriggerList = Array<UpdateCampaignTriggerRequestBody>;
385
+ export interface CampaignTrigger {
386
+ id: string;
387
+ created_at: string;
388
+ updated_at: string;
389
+ deleted_at?: string | null;
390
+ analytic_event_type_id: string;
391
+ }
392
+ export declare type CampaignTriggerList = Array<CampaignTrigger>;
393
+ export interface UpdateCampaignActionRequestBody {
394
+ question_id?: string;
395
+ }
396
+ export declare type UpdateCampaignActionList = Array<UpdateCampaignActionRequestBody>;
397
+ export interface CampaignAction {
398
+ id: string;
399
+ created_at: string;
400
+ updated_at: string;
401
+ deleted_at?: string | null;
402
+ question_id?: string;
403
+ }
404
+ export declare type CampaignActionList = Array<CampaignAction>;
368
405
  export interface FormResponse {
369
406
  }
370
407
  export interface Form {
@@ -974,9 +1011,13 @@ declare class ParraAPI {
974
1011
  $expand?: string | undefined;
975
1012
  $search?: string | undefined;
976
1013
  } | undefined) => Promise<CampaignCollectionResponse>;
977
- getCampaignById: (tenant_id: string, campaign_id: string) => Promise<Campaign>;
1014
+ getCampaignById: (tenant_id: string, campaign_id: string, query?: {
1015
+ include?: string | undefined;
1016
+ } | undefined) => Promise<Campaign>;
978
1017
  updateCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody | undefined) => Promise<Campaign>;
979
1018
  deleteCampaignById: (tenant_id: string, campaign_id: string) => Promise<Response>;
1019
+ publishCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody | undefined) => Promise<Campaign>;
1020
+ closeCampaignById: (tenant_id: string, campaign_id: string) => Promise<Campaign>;
980
1021
  getCards: (query?: {
981
1022
  app_area_id?: string | undefined;
982
1023
  } | undefined) => Promise<CardsResponse>;
package/dist/ParraAPI.js CHANGED
@@ -23,6 +23,7 @@ var SubscriptionStatus;
23
23
  var CampaignStatus;
24
24
  (function (CampaignStatus) {
25
25
  CampaignStatus["active"] = "active";
26
+ CampaignStatus["paused"] = "paused";
26
27
  CampaignStatus["draft"] = "draft";
27
28
  CampaignStatus["scheduled"] = "scheduled";
28
29
  CampaignStatus["complete"] = "complete";
@@ -317,14 +318,15 @@ var ParraAPI = /** @class */ (function () {
317
318
  query: query,
318
319
  });
319
320
  };
320
- this.getCampaignById = function (tenant_id, campaign_id) {
321
+ this.getCampaignById = function (tenant_id, campaign_id, query) {
321
322
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id), {
322
323
  method: "get",
324
+ query: query,
323
325
  });
324
326
  };
325
327
  this.updateCampaignById = function (tenant_id, campaign_id, body) {
326
328
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id), {
327
- method: "put",
329
+ method: "patch",
328
330
  body: JSON.stringify(body),
329
331
  headers: {
330
332
  "content-type": "application/json",
@@ -336,6 +338,20 @@ var ParraAPI = /** @class */ (function () {
336
338
  method: "delete",
337
339
  });
338
340
  };
341
+ this.publishCampaignById = function (tenant_id, campaign_id, body) {
342
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id, "/publish"), {
343
+ method: "post",
344
+ body: JSON.stringify(body),
345
+ headers: {
346
+ "content-type": "application/json",
347
+ },
348
+ });
349
+ };
350
+ this.closeCampaignById = function (tenant_id, campaign_id) {
351
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id, "/close"), {
352
+ method: "post",
353
+ });
354
+ };
339
355
  this.getCards = function (query) {
340
356
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/cards"), {
341
357
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.109",
3
+ "version": "0.2.112",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",