@parra/parra-js-sdk 0.2.11 → 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;
@@ -41,7 +41,7 @@ export interface ApiKeyWithSecretResponse {
41
41
  tenant_id: string;
42
42
  secret: string;
43
43
  }
44
- export interface ApiKeyColectionResponse {
44
+ export interface ApiKeyCollectionResponse {
45
45
  page: number;
46
46
  page_count: number;
47
47
  page_size: number;
@@ -61,10 +61,14 @@ export interface Answer {
61
61
  data: AnswerData;
62
62
  }
63
63
  export interface AnswerQuestionBody {
64
+ data?: AnswerData;
64
65
  }
65
66
  export declare type CardItemData = Question;
67
+ export declare enum CardItemType {
68
+ question = "question"
69
+ }
66
70
  export interface CardItem {
67
- type: string;
71
+ type: CardItemType;
68
72
  version: string;
69
73
  data: CardItemData;
70
74
  }
@@ -100,8 +104,8 @@ export declare type QuestionData = ChoiceQuestionBody;
100
104
  export interface CreateQuestionRequestBody {
101
105
  title: string;
102
106
  subtitle?: string | null;
103
- type: string;
104
- kind: string;
107
+ type: QuestionType;
108
+ kind: QuestionKind;
105
109
  data: CreateQuestionData;
106
110
  active?: boolean;
107
111
  expires_at?: string | null;
@@ -112,18 +116,18 @@ export interface Question {
112
116
  created_at: string;
113
117
  updated_at: string;
114
118
  deleted_at?: string | null;
119
+ tenant_id: string;
115
120
  title: string;
116
121
  subtitle?: string | null;
117
- type: string;
118
- kind: string;
119
- data: CreateQuestionData;
122
+ type: QuestionType;
123
+ kind: QuestionKind;
124
+ data: QuestionData;
120
125
  active?: boolean;
121
126
  expires_at?: string | null;
122
127
  answer_quota?: number | null;
123
- tenant_id: string;
124
128
  answer?: Answer;
125
129
  }
126
- export interface QuestionColectionResponse {
130
+ export interface QuestionCollectionResponse {
127
131
  page: number;
128
132
  page_count: number;
129
133
  page_size: number;
@@ -171,7 +175,7 @@ export interface NotificationResponse {
171
175
  viewed_at?: string | null;
172
176
  version?: string;
173
177
  }
174
- export interface NotificationColectionResponse {
178
+ export interface NotificationCollectionResponse {
175
179
  page: number;
176
180
  page_count: number;
177
181
  page_size: number;
@@ -245,14 +249,23 @@ declare class ParraAPI {
245
249
  });
246
250
  getTenantById: (tenant_id: string) => Promise<Tenant>;
247
251
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
248
- getTenantsForUserById: (user_id: string) => Promise<TenantColectionResponse>;
252
+ getTenantsForUserById: (user_id: string) => Promise<TenantCollectionResponse>;
249
253
  getTenantByUserIdAndTenantId: (user_id: string, tenant_id: string) => Promise<Tenant>;
250
254
  createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody | undefined) => Promise<ApiKeyWithSecretResponse>;
251
- getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyColectionResponse>;
255
+ getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyCollectionResponse>;
252
256
  deleteApiKeyForTenantById: (tenant_id: string, api_key_id: string) => Promise<Response>;
253
257
  getTenantForApiKeyById: (api_key_id: string) => Promise<Tenant>;
254
258
  getCards: () => Promise<CardsResponse>;
255
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>;
256
269
  getQuestionById: (question_id: string) => Promise<Question>;
257
270
  answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
258
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.11",
3
+ "version": "0.2.12",
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
  },