@parra/parra-js-sdk 0.2.91 → 0.2.93

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.
@@ -296,6 +296,42 @@ export interface AppAreaCollectionResponse {
296
296
  data: Array<AppArea>;
297
297
  }
298
298
  export declare type AppAreaListResponse = Array<AppArea>;
299
+ export declare enum CampaignStatus {
300
+ active = "active",
301
+ draft = "draft",
302
+ scheduled = "scheduled",
303
+ complete = "complete",
304
+ closed = "closed"
305
+ }
306
+ export interface UpdateCampaignRequestBody {
307
+ name: string;
308
+ description?: string | null;
309
+ }
310
+ export interface CreateCampaignRequestBody {
311
+ name: string;
312
+ description?: string | null;
313
+ }
314
+ export interface Campaign {
315
+ id: string;
316
+ created_at: string;
317
+ updated_at: string;
318
+ deleted_at?: string | null;
319
+ tenant_id: string;
320
+ name: string;
321
+ description?: string | null;
322
+ published_at?: string | null;
323
+ start_at?: string | null;
324
+ end_at?: string | null;
325
+ status: CampaignStatus;
326
+ }
327
+ export interface CampaignCollectionResponse {
328
+ page: number;
329
+ page_count: number;
330
+ page_size: number;
331
+ total_count: number;
332
+ data: Array<Campaign>;
333
+ }
334
+ export declare type CampaignListResponse = Array<Campaign>;
299
335
  export interface FormResponse {
300
336
  }
301
337
  export interface Form {
@@ -508,7 +544,7 @@ export interface ImageQuestionMetricsOption {
508
544
  export interface Event {
509
545
  name: string;
510
546
  created_at: string | null;
511
- event_properties?: Map<string, any> | null;
547
+ metadata?: Map<string, any> | null;
512
548
  }
513
549
  export interface Session {
514
550
  user_properties?: Map<string, any> | null;
@@ -690,6 +726,19 @@ declare class ParraAPI {
690
726
  getAppAreaById: (tenant_id: string, app_area_id: string) => Promise<AppArea>;
691
727
  updateAppAreaById: (tenant_id: string, app_area_id: string, body?: UpdateAppAreaRequestBody | undefined) => Promise<AppArea>;
692
728
  deleteAppAreaById: (tenant_id: string, app_area_id: string) => Promise<Response>;
729
+ createCampaign: (tenant_id: string, body?: CreateCampaignRequestBody | undefined) => Promise<Campaign>;
730
+ paginateCampaignsForTenantById: (tenant_id: string, query?: {
731
+ $select?: string | undefined;
732
+ $top?: number | undefined;
733
+ $skip?: number | undefined;
734
+ $orderby?: string | undefined;
735
+ $filter?: string | undefined;
736
+ $expand?: string | undefined;
737
+ $search?: string | undefined;
738
+ } | undefined) => Promise<CampaignListResponse>;
739
+ getCampaignById: (tenant_id: string, campaign_id: string) => Promise<Campaign>;
740
+ updateCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody | undefined) => Promise<Campaign>;
741
+ deleteCampaignById: (tenant_id: string, campaign_id: string) => Promise<Response>;
693
742
  getCards: (query?: {
694
743
  app_area_id?: string | undefined;
695
744
  } | undefined) => Promise<CardsResponse>;
package/dist/ParraAPI.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionStatus = exports.QuestionKind = exports.QuestionType = exports.CardItemType = exports.SubscriptionStatus = exports.Interval = exports.Currency = void 0;
3
+ exports.QuestionStatus = exports.QuestionKind = exports.QuestionType = exports.CardItemType = exports.CampaignStatus = exports.SubscriptionStatus = exports.Interval = exports.Currency = void 0;
4
4
  var Currency;
5
5
  (function (Currency) {
6
6
  Currency["usd"] = "usd";
@@ -20,6 +20,14 @@ var SubscriptionStatus;
20
20
  SubscriptionStatus["canceled"] = "canceled";
21
21
  SubscriptionStatus["unpaid"] = "unpaid";
22
22
  })(SubscriptionStatus = exports.SubscriptionStatus || (exports.SubscriptionStatus = {}));
23
+ var CampaignStatus;
24
+ (function (CampaignStatus) {
25
+ CampaignStatus["active"] = "active";
26
+ CampaignStatus["draft"] = "draft";
27
+ CampaignStatus["scheduled"] = "scheduled";
28
+ CampaignStatus["complete"] = "complete";
29
+ CampaignStatus["closed"] = "closed";
30
+ })(CampaignStatus = exports.CampaignStatus || (exports.CampaignStatus = {}));
23
31
  var CardItemType;
24
32
  (function (CardItemType) {
25
33
  CardItemType["question"] = "question";
@@ -245,6 +253,40 @@ var ParraAPI = /** @class */ (function () {
245
253
  method: "delete",
246
254
  });
247
255
  };
256
+ this.createCampaign = function (tenant_id, body) {
257
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns"), {
258
+ method: "post",
259
+ body: JSON.stringify(body),
260
+ headers: {
261
+ "content-type": "application/json",
262
+ },
263
+ });
264
+ };
265
+ this.paginateCampaignsForTenantById = function (tenant_id, query) {
266
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns"), {
267
+ method: "get",
268
+ query: query,
269
+ });
270
+ };
271
+ this.getCampaignById = function (tenant_id, campaign_id) {
272
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id), {
273
+ method: "get",
274
+ });
275
+ };
276
+ this.updateCampaignById = function (tenant_id, campaign_id, body) {
277
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id), {
278
+ method: "put",
279
+ body: JSON.stringify(body),
280
+ headers: {
281
+ "content-type": "application/json",
282
+ },
283
+ });
284
+ };
285
+ this.deleteCampaignById = function (tenant_id, campaign_id) {
286
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id), {
287
+ method: "delete",
288
+ });
289
+ };
248
290
  this.getCards = function (query) {
249
291
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/cards"), {
250
292
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.91",
3
+ "version": "0.2.93",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",