@parra/parra-js-sdk 0.2.10 → 0.2.14

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.
@@ -11,7 +11,7 @@ export interface Tenant {
11
11
  name: string;
12
12
  is_test: boolean;
13
13
  }
14
- export interface TenantColectionResponse {
14
+ export interface TenantCollectionResponse {
15
15
  page: number;
16
16
  page_count: number;
17
17
  page_size: number;
@@ -20,6 +20,7 @@ export interface TenantColectionResponse {
20
20
  }
21
21
  export interface CreateApiKeyRequestBody {
22
22
  name: string;
23
+ description?: string | null;
23
24
  }
24
25
  export interface ApiKey {
25
26
  id: string;
@@ -27,6 +28,7 @@ export interface ApiKey {
27
28
  updated_at: string;
28
29
  deleted_at?: string | null;
29
30
  name: string;
31
+ description?: string | null;
30
32
  tenant_id: string;
31
33
  }
32
34
  export interface ApiKeyWithSecretResponse {
@@ -35,10 +37,11 @@ export interface ApiKeyWithSecretResponse {
35
37
  updated_at: string;
36
38
  deleted_at?: string | null;
37
39
  name: string;
40
+ description?: string | null;
38
41
  tenant_id: string;
39
42
  secret: string;
40
43
  }
41
- export interface ApiKeyColectionResponse {
44
+ export interface ApiKeyCollectionResponse {
42
45
  page: number;
43
46
  page_count: number;
44
47
  page_size: number;
@@ -58,10 +61,14 @@ export interface Answer {
58
61
  data: AnswerData;
59
62
  }
60
63
  export interface AnswerQuestionBody {
64
+ data?: AnswerData;
61
65
  }
62
66
  export declare type CardItemData = Question;
67
+ export declare enum CardItemType {
68
+ question = "question"
69
+ }
63
70
  export interface CardItem {
64
- type: string;
71
+ type: CardItemType;
65
72
  version: string;
66
73
  data: CardItemData;
67
74
  }
@@ -69,19 +76,21 @@ export interface CardsResponse {
69
76
  items: Array<CardItem>;
70
77
  }
71
78
  export declare enum QuestionType {
72
- choice = "choice"
79
+ choice = "choice",
80
+ rating = "rating"
73
81
  }
74
82
  export declare enum QuestionKind {
75
83
  radio = "radio",
76
- checkbox = "checkbox"
84
+ checkbox = "checkbox",
85
+ star = "star"
77
86
  }
78
87
  export interface CreateChoiceQuestionOption {
79
- title?: string;
88
+ title: string;
80
89
  value: string;
81
90
  is_other?: boolean | null;
82
91
  }
83
92
  export interface ChoiceQuestionOption {
84
- title?: string;
93
+ title: string;
85
94
  value: string;
86
95
  is_other?: boolean | null;
87
96
  id: string;
@@ -97,8 +106,8 @@ export declare type QuestionData = ChoiceQuestionBody;
97
106
  export interface CreateQuestionRequestBody {
98
107
  title: string;
99
108
  subtitle?: string | null;
100
- type: string;
101
- kind: string;
109
+ type: QuestionType;
110
+ kind: QuestionKind;
102
111
  data: CreateQuestionData;
103
112
  active?: boolean;
104
113
  expires_at?: string | null;
@@ -109,18 +118,18 @@ export interface Question {
109
118
  created_at: string;
110
119
  updated_at: string;
111
120
  deleted_at?: string | null;
121
+ tenant_id: string;
112
122
  title: string;
113
123
  subtitle?: string | null;
114
- type: string;
115
- kind: string;
116
- data: CreateQuestionData;
124
+ type: QuestionType;
125
+ kind: QuestionKind;
126
+ data: QuestionData;
117
127
  active?: boolean;
118
128
  expires_at?: string | null;
119
129
  answer_quota?: number | null;
120
- tenant_id: string;
121
130
  answer?: Answer;
122
131
  }
123
- export interface QuestionColectionResponse {
132
+ export interface QuestionCollectionResponse {
124
133
  page: number;
125
134
  page_count: number;
126
135
  page_size: number;
@@ -168,7 +177,7 @@ export interface NotificationResponse {
168
177
  viewed_at?: string | null;
169
178
  version?: string;
170
179
  }
171
- export interface NotificationColectionResponse {
180
+ export interface NotificationCollectionResponse {
172
181
  page: number;
173
182
  page_count: number;
174
183
  page_size: number;
@@ -242,14 +251,23 @@ declare class ParraAPI {
242
251
  });
243
252
  getTenantById: (tenant_id: string) => Promise<Tenant>;
244
253
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
245
- getTenantsForUserById: (user_id: string) => Promise<TenantColectionResponse>;
254
+ getTenantsForUserById: (user_id: string) => Promise<TenantCollectionResponse>;
246
255
  getTenantByUserIdAndTenantId: (user_id: string, tenant_id: string) => Promise<Tenant>;
247
256
  createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody | undefined) => Promise<ApiKeyWithSecretResponse>;
248
- getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyColectionResponse>;
257
+ getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyCollectionResponse>;
249
258
  deleteApiKeyForTenantById: (tenant_id: string, api_key_id: string) => Promise<Response>;
250
259
  getTenantForApiKeyById: (api_key_id: string) => Promise<Tenant>;
251
260
  getCards: () => Promise<CardsResponse>;
252
261
  createQuestion: (body?: CreateQuestionRequestBody | undefined) => Promise<Question>;
262
+ paginateQuestions: (query?: {
263
+ $select?: string | undefined;
264
+ $top?: number | undefined;
265
+ $skip?: number | undefined;
266
+ $orderBy?: string | undefined;
267
+ $filter?: string | undefined;
268
+ $expand?: string | undefined;
269
+ $search?: string | undefined;
270
+ } | undefined) => Promise<QuestionCollectionResponse>;
253
271
  getQuestionById: (question_id: string) => Promise<Question>;
254
272
  answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
255
273
  createUser: (body: CreateUserRequestBody) => Promise<UserResponse>;
package/dist/ParraAPI.js CHANGED
@@ -1,14 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionKind = exports.QuestionType = void 0;
3
+ exports.QuestionKind = exports.QuestionType = exports.CardItemType = void 0;
4
+ var CardItemType;
5
+ (function (CardItemType) {
6
+ CardItemType["question"] = "question";
7
+ })(CardItemType = exports.CardItemType || (exports.CardItemType = {}));
4
8
  var QuestionType;
5
9
  (function (QuestionType) {
6
10
  QuestionType["choice"] = "choice";
11
+ QuestionType["rating"] = "rating";
7
12
  })(QuestionType = exports.QuestionType || (exports.QuestionType = {}));
8
13
  var QuestionKind;
9
14
  (function (QuestionKind) {
10
15
  QuestionKind["radio"] = "radio";
11
16
  QuestionKind["checkbox"] = "checkbox";
17
+ QuestionKind["star"] = "star";
12
18
  })(QuestionKind = exports.QuestionKind || (exports.QuestionKind = {}));
13
19
  var ParraAPI = /** @class */ (function () {
14
20
  function ParraAPI(http, options) {
@@ -77,6 +83,12 @@ var ParraAPI = /** @class */ (function () {
77
83
  },
78
84
  });
79
85
  };
86
+ this.paginateQuestions = function (query) {
87
+ return _this.http.execute(_this.options.baseUrl + "/v1/questions", {
88
+ method: "get",
89
+ query: query,
90
+ });
91
+ };
80
92
  this.getQuestionById = function (question_id) {
81
93
  return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
82
94
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.10",
3
+ "version": "0.2.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,6 @@
18
18
  "author": "Parra",
19
19
  "license": "ISC",
20
20
  "devDependencies": {
21
- "nyc": "^15.1.0",
22
21
  "prettier": "^2.0.5",
23
22
  "typescript": "^3.9.7"
24
23
  },