@parra/parra-js-sdk 0.3.0 → 0.3.3

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.
@@ -144,7 +144,7 @@ export interface CreateAuthTokenRequestBody {
144
144
  }
145
145
  export interface Entitlement {
146
146
  }
147
- export declare type UpdateEntitlementsRequestBody = Array<Entitlement>;
147
+ export type UpdateEntitlementsRequestBody = Array<Entitlement>;
148
148
  export interface UpdateTenantRequestBody {
149
149
  name: string;
150
150
  }
@@ -191,7 +191,7 @@ export interface TenantMember {
191
191
  metrics?: TenantMetrics | null;
192
192
  scopes: Array<string>;
193
193
  }
194
- export declare type TenantListResponse = Array<Tenant>;
194
+ export type TenantListResponse = Array<Tenant>;
195
195
  export interface TenantCollectionResponse {
196
196
  page: number;
197
197
  page_count: number;
@@ -296,7 +296,7 @@ export interface TenantInvitation {
296
296
  expires_at?: string;
297
297
  accepted_at?: string | null;
298
298
  }
299
- export declare type TenantInvitationListResponse = Array<TenantInvitation>;
299
+ export type TenantInvitationListResponse = Array<TenantInvitation>;
300
300
  export interface TeamMember {
301
301
  id: string;
302
302
  created_at: string;
@@ -308,7 +308,7 @@ export interface TeamMember {
308
308
  email: string;
309
309
  avatar_url?: string;
310
310
  }
311
- export declare type TeamMemberListResponse = Array<TeamMember>;
311
+ export type TeamMemberListResponse = Array<TeamMember>;
312
312
  export interface AnswerData {
313
313
  }
314
314
  export interface AnswerCollectionResponse {
@@ -342,7 +342,7 @@ export interface AnalyticEventTypeCollectionResponse {
342
342
  total_count: number;
343
343
  data: Array<AnalyticEventType>;
344
344
  }
345
- export declare type AnalyticEventTypeListResponse = Array<AnalyticEventType>;
345
+ export type AnalyticEventTypeListResponse = Array<AnalyticEventType>;
346
346
  export interface UpdateAppAreaRequestBody {
347
347
  title: string;
348
348
  slug: string;
@@ -370,7 +370,7 @@ export interface AppAreaCollectionResponse {
370
370
  total_count: number;
371
371
  data: Array<AppArea>;
372
372
  }
373
- export declare type AppAreaListResponse = Array<AppArea>;
373
+ export type AppAreaListResponse = Array<AppArea>;
374
374
  export declare enum CampaignStatus {
375
375
  active = "active",
376
376
  paused = "paused",
@@ -422,12 +422,12 @@ export interface CampaignCollectionResponse {
422
422
  total_count: number;
423
423
  data: Array<Campaign>;
424
424
  }
425
- export declare type CampaignListResponse = Array<Campaign>;
425
+ export type CampaignListResponse = Array<Campaign>;
426
426
  export interface UpdateCampaignTriggerRequestBody {
427
427
  type: string;
428
428
  analytic_event_type_id?: string | null;
429
429
  }
430
- export declare type UpdateCampaignTriggerList = Array<UpdateCampaignTriggerRequestBody>;
430
+ export type UpdateCampaignTriggerList = Array<UpdateCampaignTriggerRequestBody>;
431
431
  export interface CampaignTrigger {
432
432
  id: string;
433
433
  created_at: string;
@@ -436,9 +436,10 @@ export interface CampaignTrigger {
436
436
  type: string;
437
437
  analytic_event_type_id?: string | null;
438
438
  }
439
- export declare type CampaignTriggerList = Array<CampaignTrigger>;
439
+ export type CampaignTriggerList = Array<CampaignTrigger>;
440
440
  export declare enum CampaignActionType {
441
- question = "question"
441
+ question = "question",
442
+ notification = "notification"
442
443
  }
443
444
  export declare enum CampaignActionDisplayType {
444
445
  popup = "popup",
@@ -446,22 +447,24 @@ export declare enum CampaignActionDisplayType {
446
447
  }
447
448
  export interface UpdateCampaignActionRequestBody {
448
449
  type: CampaignActionType;
450
+ notification_template_id?: string;
449
451
  question_id?: string;
450
452
  display_type?: CampaignActionDisplayType | null;
451
453
  app_area_id?: string | null;
452
454
  }
453
- export declare type UpdateCampaignActionList = Array<UpdateCampaignActionRequestBody>;
455
+ export type UpdateCampaignActionList = Array<UpdateCampaignActionRequestBody>;
454
456
  export interface CampaignAction {
455
457
  id: string;
456
458
  created_at: string;
457
459
  updated_at: string;
458
460
  deleted_at?: string | null;
459
461
  type: CampaignActionType;
462
+ notification_template_id?: string;
460
463
  question_id?: string;
461
464
  display_type?: CampaignActionDisplayType | null;
462
465
  app_area_id?: string | null;
463
466
  }
464
- export declare type CampaignActionList = Array<CampaignAction>;
467
+ export type CampaignActionList = Array<CampaignAction>;
465
468
  export interface UpdateFeedbackFormRequestBody {
466
469
  title: string;
467
470
  description?: string | null;
@@ -532,7 +535,7 @@ export interface FeedbackFormField {
532
535
  required?: boolean;
533
536
  data: FeedbackFormFieldData;
534
537
  }
535
- export declare type FeedbackFormFieldData = FeedbackFormTextFieldData | FeedbackFormSelectFieldData | FeedbackFormInputFieldData;
538
+ export type FeedbackFormFieldData = FeedbackFormTextFieldData | FeedbackFormSelectFieldData | FeedbackFormInputFieldData;
536
539
  export interface FeedbackFormTextFieldData {
537
540
  placeholder?: string;
538
541
  lines?: number;
@@ -587,8 +590,8 @@ export interface BulkAnswerQuestionBody {
587
590
  bucket_item_id?: string | null;
588
591
  data: AnswerData;
589
592
  }
590
- export declare type BulkAnswerQuestionsBody = Array<BulkAnswerQuestionBody>;
591
- export declare type CardItemData = Question;
593
+ export type BulkAnswerQuestionsBody = Array<BulkAnswerQuestionBody>;
594
+ export type CardItemData = Question;
592
595
  export declare enum CardItemDisplayType {
593
596
  inline = "inline",
594
597
  popup = "popup"
@@ -750,8 +753,8 @@ export interface BooleanQuestionBody {
750
753
  export interface MutableBooleanQuestionBody {
751
754
  options: Array<MutableBooleanQuestionOption>;
752
755
  }
753
- export declare type MutableQuestionData = MutableChoiceQuestionBody | MutableCheckboxQuestionBody | MutableImageQuestionBody | MutableRatingQuestionBody | MutableStarQuestionBody | MutableShortTextQuestionBody | MutableLongTextQuestionBody | MutableBooleanQuestionBody;
754
- export declare type QuestionData = ChoiceQuestionBody | CheckboxQuestionBody | ImageQuestionBody | RatingQuestionBody | StarQuestionBody | ShortTextQuestionBody | LongTextQuestionBody | BooleanQuestionBody;
756
+ export type MutableQuestionData = MutableChoiceQuestionBody | MutableCheckboxQuestionBody | MutableImageQuestionBody | MutableRatingQuestionBody | MutableStarQuestionBody | MutableShortTextQuestionBody | MutableLongTextQuestionBody | MutableBooleanQuestionBody;
757
+ export type QuestionData = ChoiceQuestionBody | CheckboxQuestionBody | ImageQuestionBody | RatingQuestionBody | StarQuestionBody | ShortTextQuestionBody | LongTextQuestionBody | BooleanQuestionBody;
755
758
  export interface UpdateQuestionRequestBody {
756
759
  title: string;
757
760
  subtitle?: string | null;
@@ -801,7 +804,7 @@ export interface QuestionMetrics {
801
804
  kind: QuestionKind;
802
805
  data: QuestionMetricsData;
803
806
  }
804
- export declare type QuestionMetricsData = ChoiceQuestionMetricsBody | CheckboxQuestionMetricsBody | InageQuestionMetricsBody | RatingQuestionMetricsBody | StarQuestionMetricsBody | LongTextQuestionMetricsBody | ShortTextQuestionMetricsBody | BooleanQuestionMetricsBody;
807
+ export type QuestionMetricsData = ChoiceQuestionMetricsBody | CheckboxQuestionMetricsBody | InageQuestionMetricsBody | RatingQuestionMetricsBody | StarQuestionMetricsBody | LongTextQuestionMetricsBody | ShortTextQuestionMetricsBody | BooleanQuestionMetricsBody;
805
808
  export interface ChoiceQuestionMetricsBody {
806
809
  options: Array<ChoiceQuestionMetricsOption>;
807
810
  }
@@ -932,7 +935,7 @@ export interface TemplateCollectionResponse {
932
935
  total_count: number;
933
936
  data: Array<Template>;
934
937
  }
935
- export declare type TemplateResponse = Array<Template>;
938
+ export type TemplateResponse = Array<Template>;
936
939
  export interface UpdateTemplateTagRequestBody {
937
940
  description?: string | null;
938
941
  }
@@ -990,7 +993,7 @@ export interface ApplicationCollectionResponse {
990
993
  total_count: number;
991
994
  data: Array<Application>;
992
995
  }
993
- export declare type ApplicationListResponse = Array<Application>;
996
+ export type ApplicationListResponse = Array<Application>;
994
997
  export declare enum ApnsEnvironment {
995
998
  production = "production",
996
999
  sandbox = "sandbox"
@@ -1053,6 +1056,26 @@ export interface InboxChannel {
1053
1056
  title: string;
1054
1057
  description?: string | null;
1055
1058
  }
1059
+ export interface InboxItem {
1060
+ id: string;
1061
+ created_at: string;
1062
+ updated_at: string;
1063
+ deleted_at?: string | null;
1064
+ title: string;
1065
+ description?: string;
1066
+ read: boolean;
1067
+ read_at?: string | null;
1068
+ }
1069
+ export interface ReadInboxItemsRequestBody {
1070
+ item_ids: Array<string>;
1071
+ }
1072
+ export interface InboxItemCollectionResponse {
1073
+ page: number;
1074
+ page_count: number;
1075
+ page_size: number;
1076
+ total_count: number;
1077
+ data: Array<InboxItem>;
1078
+ }
1056
1079
  export interface UpdateApnsConfigurationRequestBody {
1057
1080
  name: string;
1058
1081
  description?: string | null;
@@ -1135,7 +1158,7 @@ export interface NotificationTemplateCollectionResponse {
1135
1158
  total_count: number;
1136
1159
  data: Array<NotificationTemplate>;
1137
1160
  }
1138
- export declare type NotificationTemplateListResponse = Array<NotificationTemplate>;
1161
+ export type NotificationTemplateListResponse = Array<NotificationTemplate>;
1139
1162
  export interface NotificationRecipient {
1140
1163
  user_id?: string;
1141
1164
  data?: object | null;
@@ -1146,7 +1169,7 @@ export interface SendNotificationApnsChannelOverrides {
1146
1169
  priority?: number;
1147
1170
  }
1148
1171
  export interface SendNotificationInboxChannelOverrides {
1149
- title: string;
1172
+ title?: string;
1150
1173
  description?: string | null;
1151
1174
  }
1152
1175
  export interface SendNotificationChannels {
@@ -1228,193 +1251,200 @@ declare class ParraAPI {
1228
1251
  constructor(http: HTTPClient, options: {
1229
1252
  baseUrl: string;
1230
1253
  });
1231
- uploadImageAssetForTenantById: (tenant_id: string, body?: UploadImageAssetRequestBody | undefined) => Promise<ImageAsset>;
1232
- createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
1254
+ uploadImageAssetForTenantById: (tenant_id: string, body?: UploadImageAssetRequestBody) => Promise<ImageAsset>;
1255
+ createCustomer: (body?: CreateCustomerRequestBody) => Promise<Customer>;
1233
1256
  updateEntitlementsForCustomerById: (customer_id: string) => Promise<Response>;
1234
1257
  createBillingPortalSession: (tenant_id: string) => Promise<BillingPortalSession>;
1235
- createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
1258
+ createCheckoutSession: (body?: CreateCheckoutSessionRequestBody) => Promise<CheckoutSession>;
1236
1259
  getPlansForTenantById: (tenant_id: string) => Promise<TenantPlansResponse>;
1237
- createAudience: (body?: CreateAudienceRequestBody | undefined) => Promise<Audience>;
1238
- createSubscriberForAudienceById: (audience_id: string, body?: CreateSubscriberRequestBody | undefined) => Promise<Response>;
1239
- createTenant: (body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
1260
+ createAudience: (body?: CreateAudienceRequestBody) => Promise<Audience>;
1261
+ createSubscriberForAudienceById: (audience_id: string, body?: CreateSubscriberRequestBody) => Promise<Response>;
1262
+ createTenant: (body?: CreateTenantRequestBody) => Promise<Tenant>;
1240
1263
  getTenantById: (tenant_id: string, query?: {
1241
- include?: string | undefined;
1242
- } | undefined) => Promise<Tenant>;
1243
- updateTenantById: (tenant_id: string, body?: UpdateTenantRequestBody | undefined) => Promise<Tenant>;
1264
+ include?: string;
1265
+ }) => Promise<Tenant>;
1266
+ updateTenantById: (tenant_id: string, body?: UpdateTenantRequestBody) => Promise<Tenant>;
1244
1267
  deleteTenantById: (tenant_id: string) => Promise<Response>;
1245
1268
  paginateTenantUsersForTenantById: (tenant_id: string, query?: {
1246
- $select?: string | undefined;
1247
- $top?: number | undefined;
1248
- $skip?: number | undefined;
1249
- $orderby?: string | undefined;
1250
- $filter?: string | undefined;
1251
- $expand?: string | undefined;
1252
- $search?: string | undefined;
1253
- } | undefined) => Promise<TenantUserCollectionResponse>;
1269
+ $select?: string;
1270
+ $top?: number;
1271
+ $skip?: number;
1272
+ $orderby?: string;
1273
+ $filter?: string;
1274
+ $expand?: string;
1275
+ $search?: string;
1276
+ }) => Promise<TenantUserCollectionResponse>;
1254
1277
  getUserForTenantById: (tenant_id: string, user_id: string) => Promise<TenantUser>;
1255
- createTenantForUserById: (user_id: string, body?: CreateTenantForUserRequestBody | undefined) => Promise<Tenant>;
1278
+ createTenantForUserById: (user_id: string, body?: CreateTenantForUserRequestBody) => Promise<Tenant>;
1256
1279
  getTenantsForUserById: (user_id: string) => Promise<TenantListResponse>;
1257
- createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody | undefined) => Promise<ApiKeyWithSecretResponse>;
1280
+ createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody) => Promise<ApiKeyWithSecretResponse>;
1258
1281
  getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyCollectionResponse>;
1259
1282
  deleteApiKeyForTenantById: (tenant_id: string, api_key_id: string) => Promise<Response>;
1260
1283
  getTenantForApiKeyById: (api_key_id: string) => Promise<Tenant>;
1261
1284
  getInvitationsForTenantById: (tenant_id: string) => Promise<TenantInvitationListResponse>;
1262
- createInvitationForTenantById: (tenant_id: string, body?: TenantInvitationRequestBody | undefined) => Promise<TenantInvitation>;
1285
+ createInvitationForTenantById: (tenant_id: string, body?: TenantInvitationRequestBody) => Promise<TenantInvitation>;
1263
1286
  acceptInvitationByCode: (invitation_code: string) => Promise<TenantInvitation>;
1264
1287
  getTeamMembersForTenantById: (tenant_id: string) => Promise<TeamMemberListResponse>;
1265
1288
  deleteTeamMemberForTenantById: (tenant_id: string, team_member_id: string) => Promise<Response>;
1266
1289
  updateTeamMemberUserForTenantById: (tenant_id: string, team_member_id: string) => Promise<Response>;
1267
- createAnalyticEventTypeForTenantById: (tenant_id: string, body?: CreateAnalyticEventTypeRequestBody | undefined) => Promise<AnalyticEventType>;
1290
+ createAnalyticEventTypeForTenantById: (tenant_id: string, body?: CreateAnalyticEventTypeRequestBody) => Promise<AnalyticEventType>;
1268
1291
  paginateAnalyticEventTypesForTenantById: (tenant_id: string, query?: {
1269
- $select?: string | undefined;
1270
- $top?: number | undefined;
1271
- $skip?: number | undefined;
1272
- $orderby?: string | undefined;
1273
- $filter?: string | undefined;
1274
- $expand?: string | undefined;
1275
- $search?: string | undefined;
1276
- } | undefined) => Promise<AnalyticEventTypeCollectionResponse>;
1292
+ $select?: string;
1293
+ $top?: number;
1294
+ $skip?: number;
1295
+ $orderby?: string;
1296
+ $filter?: string;
1297
+ $expand?: string;
1298
+ $search?: string;
1299
+ }) => Promise<AnalyticEventTypeCollectionResponse>;
1277
1300
  getAnalyticEventTypeById: (tenant_id: string, analytic_event_type_id: string) => Promise<AnalyticEventType>;
1278
- updateAnalyticEventTypeById: (tenant_id: string, analytic_event_type_id: string, body?: UpdateAnalyticEventTypeRequestBody | undefined) => Promise<AnalyticEventType>;
1301
+ updateAnalyticEventTypeById: (tenant_id: string, analytic_event_type_id: string, body?: UpdateAnalyticEventTypeRequestBody) => Promise<AnalyticEventType>;
1279
1302
  deleteAnalyticEventTypeById: (tenant_id: string, analytic_event_type_id: string) => Promise<Response>;
1280
- createAppArea: (tenant_id: string, body?: CreateAppAreaRequestBody | undefined) => Promise<AppArea>;
1303
+ createAppArea: (tenant_id: string, body?: CreateAppAreaRequestBody) => Promise<AppArea>;
1281
1304
  listAppAreas: (tenant_id: string) => Promise<AppAreaListResponse>;
1282
1305
  getAppAreaById: (tenant_id: string, app_area_id: string) => Promise<AppArea>;
1283
- updateAppAreaById: (tenant_id: string, app_area_id: string, body?: UpdateAppAreaRequestBody | undefined) => Promise<AppArea>;
1306
+ updateAppAreaById: (tenant_id: string, app_area_id: string, body?: UpdateAppAreaRequestBody) => Promise<AppArea>;
1284
1307
  deleteAppAreaById: (tenant_id: string, app_area_id: string) => Promise<Response>;
1285
- createCampaign: (tenant_id: string, body?: CreateCampaignRequestBody | undefined) => Promise<Campaign>;
1308
+ createCampaign: (tenant_id: string, body?: CreateCampaignRequestBody) => Promise<Campaign>;
1286
1309
  paginateCampaignsForTenantById: (tenant_id: string, query?: {
1287
- $select?: string | undefined;
1288
- $top?: number | undefined;
1289
- $skip?: number | undefined;
1290
- $orderby?: string | undefined;
1291
- $filter?: string | undefined;
1292
- $expand?: string | undefined;
1293
- $search?: string | undefined;
1294
- } | undefined) => Promise<CampaignCollectionResponse>;
1310
+ $select?: string;
1311
+ $top?: number;
1312
+ $skip?: number;
1313
+ $orderby?: string;
1314
+ $filter?: string;
1315
+ $expand?: string;
1316
+ $search?: string;
1317
+ }) => Promise<CampaignCollectionResponse>;
1295
1318
  getCampaignById: (tenant_id: string, campaign_id: string, query?: {
1296
- include?: string | undefined;
1297
- } | undefined) => Promise<Campaign>;
1298
- updateCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody | undefined) => Promise<Campaign>;
1319
+ include?: string;
1320
+ }) => Promise<Campaign>;
1321
+ updateCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody) => Promise<Campaign>;
1299
1322
  deleteCampaignById: (tenant_id: string, campaign_id: string) => Promise<Response>;
1300
- publishCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody | undefined) => Promise<Campaign>;
1323
+ publishCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody) => Promise<Campaign>;
1301
1324
  enrollEligibleUsersForCampaignById: (campaign_id: string) => Promise<Response>;
1302
1325
  closeCampaignById: (tenant_id: string, campaign_id: string) => Promise<Campaign>;
1303
1326
  getCards: (query?: {
1304
- app_area_id?: string | undefined;
1305
- } | undefined) => Promise<CardsResponse>;
1327
+ app_area_id?: string;
1328
+ }) => Promise<CardsResponse>;
1306
1329
  paginateFeedbackFormsForTenantById: (tenant_id: string, query?: {
1307
- $select?: string | undefined;
1308
- $top?: number | undefined;
1309
- $skip?: number | undefined;
1310
- $orderby?: string | undefined;
1311
- $filter?: string | undefined;
1312
- $expand?: string | undefined;
1313
- $search?: string | undefined;
1314
- } | undefined) => Promise<FeedbackFormCollectionResponse>;
1315
- createFeedbackFormForTenantById: (tenant_id: string, body?: CreateFeedbackFormRequestBody | undefined) => Promise<FeedbackFormResponse>;
1330
+ $select?: string;
1331
+ $top?: number;
1332
+ $skip?: number;
1333
+ $orderby?: string;
1334
+ $filter?: string;
1335
+ $expand?: string;
1336
+ $search?: string;
1337
+ }) => Promise<FeedbackFormCollectionResponse>;
1338
+ createFeedbackFormForTenantById: (tenant_id: string, body?: CreateFeedbackFormRequestBody) => Promise<FeedbackFormResponse>;
1316
1339
  getFeedbackFormForTenantById: (tenant_id: string, feedback_form_id: string) => Promise<FeedbackFormResponse>;
1317
- updateFeedbackFormForTenantById: (tenant_id: string, feedback_form_id: string, body?: UpdateFeedbackFormRequestBody | undefined) => Promise<FeedbackFormResponse>;
1340
+ updateFeedbackFormForTenantById: (tenant_id: string, feedback_form_id: string, body?: UpdateFeedbackFormRequestBody) => Promise<FeedbackFormResponse>;
1318
1341
  deleteFeedbackFormForTenantById: (tenant_id: string, feedback_form_id: string) => Promise<Response>;
1319
1342
  paginateFeedbackFormResponsesForTenantById: (tenant_id: string, feedback_form_id: string, query?: {
1320
- $select?: string | undefined;
1321
- $top?: number | undefined;
1322
- $skip?: number | undefined;
1323
- $orderby?: string | undefined;
1324
- $filter?: string | undefined;
1325
- $expand?: string | undefined;
1326
- $search?: string | undefined;
1327
- } | undefined) => Promise<FeedbackFormSubmissionCollectionResponse>;
1343
+ $select?: string;
1344
+ $top?: number;
1345
+ $skip?: number;
1346
+ $orderby?: string;
1347
+ $filter?: string;
1348
+ $expand?: string;
1349
+ $search?: string;
1350
+ }) => Promise<FeedbackFormSubmissionCollectionResponse>;
1328
1351
  getFormById: (feedback_form_id: string) => Promise<FeedbackFormDataStub>;
1329
- submitFormById: (feedback_form_id: string, body?: SubmitFeedbackFormResponseBody | undefined) => Promise<Response>;
1330
- createQuestion: (body?: CreateQuestionRequestBody | undefined) => Promise<Question>;
1352
+ submitFormById: (feedback_form_id: string, body?: SubmitFeedbackFormResponseBody) => Promise<Response>;
1353
+ createQuestion: (body?: CreateQuestionRequestBody) => Promise<Question>;
1331
1354
  paginateQuestions: (query?: {
1332
- $select?: string | undefined;
1333
- $top?: number | undefined;
1334
- $skip?: number | undefined;
1335
- $orderby?: string | undefined;
1336
- $filter?: string | undefined;
1337
- $expand?: string | undefined;
1338
- $search?: string | undefined;
1339
- } | undefined) => Promise<QuestionCollectionResponse>;
1355
+ $select?: string;
1356
+ $top?: number;
1357
+ $skip?: number;
1358
+ $orderby?: string;
1359
+ $filter?: string;
1360
+ $expand?: string;
1361
+ $search?: string;
1362
+ }) => Promise<QuestionCollectionResponse>;
1340
1363
  getQuestionById: (question_id: string, query?: {
1341
- campaign_id?: string | undefined;
1342
- } | undefined) => Promise<Question>;
1343
- updateQuestionById: (question_id: string, body?: UpdateQuestionRequestBody | undefined) => Promise<Question>;
1364
+ campaign_id?: string;
1365
+ }) => Promise<Question>;
1366
+ updateQuestionById: (question_id: string, body?: UpdateQuestionRequestBody) => Promise<Question>;
1344
1367
  deleteQuestionById: (question_id: string) => Promise<Response>;
1345
- createMetricsForQuestionById: (question_id: string, body?: CreateQuestionMetricsRequestBody | undefined) => Promise<QuestionMetrics>;
1346
- answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
1368
+ createMetricsForQuestionById: (question_id: string, body?: CreateQuestionMetricsRequestBody) => Promise<QuestionMetrics>;
1369
+ answerQuestionById: (question_id: string, body?: AnswerQuestionBody) => Promise<Response>;
1347
1370
  paginateAnswersForQuestionById: (question_id: string, query?: {
1348
- $select?: string | undefined;
1349
- $top?: number | undefined;
1350
- $skip?: number | undefined;
1351
- $orderby?: string | undefined;
1352
- $filter?: string | undefined;
1353
- $expand?: string | undefined;
1354
- $search?: string | undefined;
1355
- } | undefined) => Promise<AnswerCollectionResponse>;
1356
- bulkAnswerQuestions: (body?: BulkAnswerQuestionsBody | undefined) => Promise<Response>;
1371
+ $select?: string;
1372
+ $top?: number;
1373
+ $skip?: number;
1374
+ $orderby?: string;
1375
+ $filter?: string;
1376
+ $expand?: string;
1377
+ $search?: string;
1378
+ }) => Promise<AnswerCollectionResponse>;
1379
+ bulkAnswerQuestions: (body?: BulkAnswerQuestionsBody) => Promise<Response>;
1357
1380
  paginateTemplateTags: (query?: {
1358
- $select?: string | undefined;
1359
- $top?: number | undefined;
1360
- $skip?: number | undefined;
1361
- $orderby?: string | undefined;
1362
- $filter?: string | undefined;
1363
- $expand?: string | undefined;
1364
- $search?: string | undefined;
1365
- } | undefined) => Promise<TemplateTagCollectionResponse>;
1381
+ $select?: string;
1382
+ $top?: number;
1383
+ $skip?: number;
1384
+ $orderby?: string;
1385
+ $filter?: string;
1386
+ $expand?: string;
1387
+ $search?: string;
1388
+ }) => Promise<TemplateTagCollectionResponse>;
1366
1389
  paginateTemplatesForTenantById: (tenant_id: string, query?: {
1367
- $select?: string | undefined;
1368
- $top?: number | undefined;
1369
- $skip?: number | undefined;
1370
- $orderby?: string | undefined;
1371
- $filter?: string | undefined;
1372
- $expand?: string | undefined;
1373
- $search?: string | undefined;
1374
- } | undefined) => Promise<TemplateCollectionResponse>;
1375
- createApplicationForTenantById: (tenant_id: string, body?: CreateApplicationRequestBody | undefined) => Promise<Application>;
1390
+ $select?: string;
1391
+ $top?: number;
1392
+ $skip?: number;
1393
+ $orderby?: string;
1394
+ $filter?: string;
1395
+ $expand?: string;
1396
+ $search?: string;
1397
+ }) => Promise<TemplateCollectionResponse>;
1398
+ createApplicationForTenantById: (tenant_id: string, body?: CreateApplicationRequestBody) => Promise<Application>;
1376
1399
  paginateApplicationsForTenantById: (tenant_id: string) => Promise<ApplicationCollectionResponse>;
1377
1400
  getApplicationByIdForTenantById: (tenant_id: string, application_id: string, query?: {
1378
- include?: string | undefined;
1379
- } | undefined) => Promise<Application>;
1380
- updateApplicationByIdForTenantById: (tenant_id: string, application_id: string, body?: UpdateApplicationRequestBody | undefined) => Promise<Application>;
1401
+ include?: string;
1402
+ }) => Promise<Application>;
1403
+ updateApplicationByIdForTenantById: (tenant_id: string, application_id: string, body?: UpdateApplicationRequestBody) => Promise<Application>;
1381
1404
  deleteApplicationByIdForTenantById: (tenant_id: string, application_id: string) => Promise<Response>;
1382
- updateApnsConfigurationForTenantApplication: (tenant_id: string, application_id: string, body?: UpdateApnsConfigurationRequestBody | undefined) => Promise<ApnsConfiguration>;
1383
- createNotificationTemplate: (tenant_id: string, body?: CreateNotificationTemplateRequestBody | undefined) => Promise<NotificationTemplate>;
1405
+ updateApnsConfigurationForTenantApplication: (tenant_id: string, application_id: string, body?: UpdateApnsConfigurationRequestBody) => Promise<ApnsConfiguration>;
1406
+ getInboxItemsForTenantUser: (tenant_id: string, query?: {
1407
+ limit?: number;
1408
+ offset?: number;
1409
+ segment?: string;
1410
+ archived?: boolean;
1411
+ }) => Promise<InboxItemCollectionResponse>;
1412
+ readInboxItemsForTenantUser: (tenant_id: string, body?: ReadInboxItemsRequestBody) => Promise<Response>;
1413
+ createNotificationTemplate: (tenant_id: string, body?: CreateNotificationTemplateRequestBody) => Promise<NotificationTemplate>;
1384
1414
  paginateNotificationTemplatesForTenantById: (tenant_id: string, query?: {
1385
- $select?: string | undefined;
1386
- $top?: number | undefined;
1387
- $skip?: number | undefined;
1388
- $orderby?: string | undefined;
1389
- $filter?: string | undefined;
1390
- $expand?: string | undefined;
1391
- $search?: string | undefined;
1392
- } | undefined) => Promise<NotificationTemplateCollectionResponse>;
1415
+ $select?: string;
1416
+ $top?: number;
1417
+ $skip?: number;
1418
+ $orderby?: string;
1419
+ $filter?: string;
1420
+ $expand?: string;
1421
+ $search?: string;
1422
+ }) => Promise<NotificationTemplateCollectionResponse>;
1393
1423
  getNotificationTemplateById: (tenant_id: string, notification_template_id: string, query?: {
1394
- include?: string | undefined;
1395
- } | undefined) => Promise<NotificationTemplate>;
1396
- updateNotificationTemplateById: (tenant_id: string, notification_template_id: string, body?: UpdateNotificationTemplateRequestBody | undefined) => Promise<NotificationTemplate>;
1424
+ include?: string;
1425
+ }) => Promise<NotificationTemplate>;
1426
+ updateNotificationTemplateById: (tenant_id: string, notification_template_id: string, body?: UpdateNotificationTemplateRequestBody) => Promise<NotificationTemplate>;
1397
1427
  deleteNotificationTemplateById: (tenant_id: string, notification_template_id: string) => Promise<Response>;
1398
- createChannelForNotificationTemplate: (tenant_id: string, notification_template_id: string, body?: CreateChannelRequestBody | undefined) => Promise<Channel>;
1399
- updateChannelForNotificationTemplate: (tenant_id: string, notification_template_id: string, channel_id: string, body?: UpdateChannelRequestBody | undefined) => Promise<Channel>;
1428
+ createChannelForNotificationTemplate: (tenant_id: string, notification_template_id: string, body?: CreateChannelRequestBody) => Promise<Channel>;
1429
+ updateChannelForNotificationTemplate: (tenant_id: string, notification_template_id: string, channel_id: string, body?: UpdateChannelRequestBody) => Promise<Channel>;
1400
1430
  deleteChannelForNotificationTemplate: (tenant_id: string, notification_template_id: string, channel_id: string) => Promise<Response>;
1401
1431
  createUser: (body: CreateUserRequestBody) => Promise<UserResponse>;
1402
1432
  listUsers: (query?: {
1403
- $select?: string | undefined;
1404
- $top?: number | undefined;
1405
- $skip?: number | undefined;
1406
- $orderby?: string | undefined;
1407
- $filter?: string | undefined;
1408
- $expand?: string | undefined;
1409
- $search?: string | undefined;
1410
- } | undefined) => Promise<UserCollectionResponse>;
1433
+ $select?: string;
1434
+ $top?: number;
1435
+ $skip?: number;
1436
+ $orderby?: string;
1437
+ $filter?: string;
1438
+ $expand?: string;
1439
+ $search?: string;
1440
+ }) => Promise<UserCollectionResponse>;
1411
1441
  getUserById: (user_id: string) => Promise<UserResponse>;
1412
1442
  updateUserById: (user_id: string, body: UpdateUserRequestBody) => Promise<UserResponse>;
1413
1443
  deleteUserById: (user_id: string) => Promise<Response>;
1414
1444
  createIdentityForUserById: (user_id: string, body: CreateIdentityRequestBody) => Promise<IdentityResponse>;
1415
1445
  listIdentitiesForUserById: (user_id: string) => Promise<Array<IdentityResponse>>;
1416
1446
  getUserByProviderAndProviderUserId: (provider: string, provider_user_id: string) => Promise<UserResponse>;
1417
- checkAuthorization: (body?: CheckAuthorizationRequestBody | undefined) => Promise<CheckAuthorization>;
1447
+ checkAuthorization: (body?: CheckAuthorizationRequestBody) => Promise<CheckAuthorization>;
1418
1448
  getUserInfo: () => Promise<UserInfoResponse>;
1419
1449
  getParraAuthToken: () => Promise<AuthToken>;
1420
1450
  }
package/dist/ParraAPI.js CHANGED
@@ -33,6 +33,7 @@ var CampaignStatus;
33
33
  var CampaignActionType;
34
34
  (function (CampaignActionType) {
35
35
  CampaignActionType["question"] = "question";
36
+ CampaignActionType["notification"] = "notification";
36
37
  })(CampaignActionType = exports.CampaignActionType || (exports.CampaignActionType = {}));
37
38
  var CampaignActionDisplayType;
38
39
  (function (CampaignActionDisplayType) {
@@ -595,6 +596,22 @@ var ParraAPI = /** @class */ (function () {
595
596
  },
596
597
  });
597
598
  };
599
+ this.getInboxItemsForTenantUser = function (tenant_id, query) {
600
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/notifications/inbox/items"), {
601
+ method: "get",
602
+ query: query,
603
+ });
604
+ };
605
+ this.readInboxItemsForTenantUser = function (tenant_id, body) {
606
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/notifications/inbox/items/read"), {
607
+ method: "post",
608
+ body: JSON.stringify(body),
609
+ headers: {
610
+ "content-type": "application/json",
611
+ },
612
+ raw: true,
613
+ });
614
+ };
598
615
  this.createNotificationTemplate = function (tenant_id, body) {
599
616
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/notifications/templates"), {
600
617
  method: "post",
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { AuthorizationProvider, HTTPInterceptor } from '@parra/http-client';
2
- import 'isomorphic-fetch';
3
2
  import { default as ParraAPI } from './ParraAPI';
4
3
  export { HTTPRequestBody, HTTPUrlComponent, HTTPResponse, HTTPHeaders, HTTPQuery, HTTPMethod, HTTPLogger, HTTPOptions, HTTPRequest, HTTPRequestWithoutMethod, HTTPClient, HTTPInterceptor, Authorization, AuthFunctionProvider, AuthPromiseProvider, AuthorizationProvider, AuthInterceptor } from '@parra/http-client';
5
4
  export * from './ParraAPI';
6
5
  export { ParraAPI };
7
- export declare type ParraAPIType = typeof ParraAPI;
6
+ export type ParraAPIType = typeof ParraAPI;
8
7
  export interface ParraAPIOptions {
9
- authorization?: AuthorizationProvider;
8
+ authorization: AuthorizationProvider;
10
9
  baseUrl?: string;
11
10
  interceptors?: HTTPInterceptor[];
11
+ fetch: any;
12
12
  }
13
- export default function (options?: ParraAPIOptions): ParraAPI;
13
+ export default function (options: ParraAPIOptions): ParraAPI;
package/dist/index.js CHANGED
@@ -19,7 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.ParraAPI = exports.AuthInterceptor = exports.HTTPClient = void 0;
21
21
  var http_client_1 = require("@parra/http-client");
22
- require("isomorphic-fetch");
23
22
  var ParraAPI_1 = __importDefault(require("./ParraAPI"));
24
23
  Object.defineProperty(exports, "ParraAPI", { enumerable: true, get: function () { return ParraAPI_1.default; } });
25
24
  var http_client_2 = require("@parra/http-client");
@@ -27,7 +26,6 @@ Object.defineProperty(exports, "HTTPClient", { enumerable: true, get: function (
27
26
  Object.defineProperty(exports, "AuthInterceptor", { enumerable: true, get: function () { return http_client_2.AuthInterceptor; } });
28
27
  __exportStar(require("./ParraAPI"), exports);
29
28
  function default_1(options) {
30
- if (options === void 0) { options = {}; }
31
29
  var baseUrl = options.baseUrl || 'https://api.parra.io';
32
30
  var interceptors = [];
33
31
  if (options.authorization) {
@@ -37,7 +35,7 @@ function default_1(options) {
37
35
  if (options.interceptors) {
38
36
  interceptors.push.apply(interceptors, options.interceptors);
39
37
  }
40
- var http = new http_client_1.HTTPClient(interceptors);
38
+ var http = new http_client_1.HTTPClient({ interceptors: interceptors, fetch: options.fetch });
41
39
  return new ParraAPI_1.default(http, { baseUrl: baseUrl });
42
40
  }
43
41
  exports.default = default_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,10 +18,10 @@
18
18
  "author": "Parra",
19
19
  "license": "ISC",
20
20
  "devDependencies": {
21
- "prettier": "^2.6.2",
22
- "typescript": "^4.6.4"
21
+ "prettier": "^3.0.3",
22
+ "typescript": "^5.2.2"
23
23
  },
24
24
  "dependencies": {
25
- "@parra/http-client": "0.5.1"
25
+ "@parra/http-client": "0.5.4"
26
26
  }
27
27
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,63 +0,0 @@
1
- 'use strict';
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var assert_1 = __importDefault(require("assert"));
7
- var jwt = require('jsonwebtoken');
8
- var AccessToken = /** @class */ (function () {
9
- /**
10
- * @constructor
11
- * @param {string} tenantId - The account's unique ID to which access is scoped
12
- * @param {string} apiKeyId - The signing key's unique ID
13
- * @param {string} apiKeySecret - The apiKeySecret to sign the token with
14
- * @param {object} options - ...
15
- * @param {number} [options.ttl=3600] - Time to live in seconds
16
- * @param {string} [options.identity] - The identity of the first person
17
- */
18
- function AccessToken(options) {
19
- assert_1.default(options.tenantId, 'tenantId is required');
20
- assert_1.default(options.apiKeyId, 'apiKeyId is required');
21
- assert_1.default(options.apiKeySecret, 'apiKeySecret is required');
22
- this.tenantId = options.tenantId;
23
- this.apiKeyId = options.apiKeyId;
24
- this.apiKeySecret = options.apiKeySecret;
25
- this.ttl = options.ttl || 3600;
26
- this.identity = String(options.identity);
27
- this.nbf = options.nbf;
28
- this.grants = [];
29
- }
30
- AccessToken.prototype.addGrant = function (grant) {
31
- this.grants.push(grant);
32
- };
33
- AccessToken.prototype.toJwt = function (algorithm) {
34
- algorithm = algorithm || AccessToken.DEFAULT_ALGORITHM;
35
- if (!AccessToken.ALGORITHMS.includes(algorithm)) {
36
- throw new Error('Algorithm not supported. Allowed values are ' + AccessToken.ALGORITHMS.join(', '));
37
- }
38
- var grants = this.grants.reduce(function (acc, grant) {
39
- acc[grant.key] = grant.toPayload();
40
- }, { identity: this.identity });
41
- var now = Math.floor(Date.now() / 1000);
42
- var payload = {
43
- jti: this.apiKeyId + '-' + now,
44
- grants: grants,
45
- nbf: this.nbf,
46
- };
47
- var header = {
48
- cty: 'parra-fpa;v=1',
49
- typ: 'JWT',
50
- };
51
- return jwt.sign(payload, this.apiKeySecret, {
52
- header: header,
53
- algorithm: algorithm,
54
- issuer: this.apiKeyId,
55
- subject: this.tenantId,
56
- expiresIn: this.ttl,
57
- });
58
- };
59
- AccessToken.DEFAULT_ALGORITHM = 'HS256';
60
- AccessToken.ALGORITHMS = ['HS256', 'HS384', 'HS512'];
61
- return AccessToken;
62
- }());
63
- module.exports = AccessToken;