@parra/parra-js-sdk 0.2.8 → 0.2.12

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
  }
@@ -97,8 +104,8 @@ export declare type QuestionData = ChoiceQuestionBody;
97
104
  export interface CreateQuestionRequestBody {
98
105
  title: string;
99
106
  subtitle?: string | null;
100
- type: string;
101
- kind: string;
107
+ type: QuestionType;
108
+ kind: QuestionKind;
102
109
  data: CreateQuestionData;
103
110
  active?: boolean;
104
111
  expires_at?: string | null;
@@ -109,18 +116,18 @@ export interface Question {
109
116
  created_at: string;
110
117
  updated_at: string;
111
118
  deleted_at?: string | null;
119
+ tenant_id: string;
112
120
  title: string;
113
121
  subtitle?: string | null;
114
- type: string;
115
- kind: string;
116
- data: CreateQuestionData;
122
+ type: QuestionType;
123
+ kind: QuestionKind;
124
+ data: QuestionData;
117
125
  active?: boolean;
118
126
  expires_at?: string | null;
119
127
  answer_quota?: number | null;
120
- tenant_id: string;
121
128
  answer?: Answer;
122
129
  }
123
- export interface QuestionColectionResponse {
130
+ export interface QuestionCollectionResponse {
124
131
  page: number;
125
132
  page_count: number;
126
133
  page_size: number;
@@ -168,7 +175,7 @@ export interface NotificationResponse {
168
175
  viewed_at?: string | null;
169
176
  version?: string;
170
177
  }
171
- export interface NotificationColectionResponse {
178
+ export interface NotificationCollectionResponse {
172
179
  page: number;
173
180
  page_count: number;
174
181
  page_size: number;
@@ -242,14 +249,23 @@ declare class ParraAPI {
242
249
  });
243
250
  getTenantById: (tenant_id: string) => Promise<Tenant>;
244
251
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
245
- getTenantsForUserById: (user_id: string) => Promise<TenantColectionResponse>;
252
+ getTenantsForUserById: (user_id: string) => Promise<TenantCollectionResponse>;
246
253
  getTenantByUserIdAndTenantId: (user_id: string, tenant_id: string) => Promise<Tenant>;
247
254
  createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody | undefined) => Promise<ApiKeyWithSecretResponse>;
248
- getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyColectionResponse>;
255
+ getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyCollectionResponse>;
249
256
  deleteApiKeyForTenantById: (tenant_id: string, api_key_id: string) => Promise<Response>;
250
257
  getTenantForApiKeyById: (api_key_id: string) => Promise<Tenant>;
251
258
  getCards: () => Promise<CardsResponse>;
252
259
  createQuestion: (body?: CreateQuestionRequestBody | undefined) => Promise<Question>;
260
+ paginateQuestions: (query?: {
261
+ $select?: string | undefined;
262
+ $top?: number | undefined;
263
+ $skip?: number | undefined;
264
+ $orderBy?: string | undefined;
265
+ $filter?: string | undefined;
266
+ $expand?: string | undefined;
267
+ $search?: string | undefined;
268
+ } | undefined) => Promise<QuestionCollectionResponse>;
253
269
  getQuestionById: (question_id: string) => Promise<Question>;
254
270
  answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
255
271
  createUser: (body: CreateUserRequestBody) => Promise<UserResponse>;
package/dist/ParraAPI.js CHANGED
@@ -1,6 +1,10 @@
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";
@@ -77,6 +81,12 @@ var ParraAPI = /** @class */ (function () {
77
81
  },
78
82
  });
79
83
  };
84
+ this.paginateQuestions = function (query) {
85
+ return _this.http.execute(_this.options.baseUrl + "/v1/questions", {
86
+ method: "get",
87
+ query: query,
88
+ });
89
+ };
80
90
  this.getQuestionById = function (question_id) {
81
91
  return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
82
92
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.8",
3
+ "version": "0.2.12",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,12 +18,11 @@
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
  },
25
24
  "dependencies": {
26
- "@parra/http-client": "0.0.4",
25
+ "@parra/http-client": "0.0.5",
27
26
  "isomorphic-fetch": "^3.0.0"
28
27
  }
29
28
  }