@parra/parra-js-sdk 0.2.11 → 0.2.15

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
  }
@@ -72,19 +76,21 @@ export interface CardsResponse {
72
76
  items: Array<CardItem>;
73
77
  }
74
78
  export declare enum QuestionType {
75
- choice = "choice"
79
+ choice = "choice",
80
+ rating = "rating"
76
81
  }
77
82
  export declare enum QuestionKind {
78
83
  radio = "radio",
79
- checkbox = "checkbox"
84
+ checkbox = "checkbox",
85
+ star = "star"
80
86
  }
81
87
  export interface CreateChoiceQuestionOption {
82
- title?: string;
88
+ title: string;
83
89
  value: string;
84
90
  is_other?: boolean | null;
85
91
  }
86
92
  export interface ChoiceQuestionOption {
87
- title?: string;
93
+ title: string;
88
94
  value: string;
89
95
  is_other?: boolean | null;
90
96
  id: string;
@@ -100,8 +106,8 @@ export declare type QuestionData = ChoiceQuestionBody;
100
106
  export interface CreateQuestionRequestBody {
101
107
  title: string;
102
108
  subtitle?: string | null;
103
- type: string;
104
- kind: string;
109
+ type: QuestionType;
110
+ kind: QuestionKind;
105
111
  data: CreateQuestionData;
106
112
  active?: boolean;
107
113
  expires_at?: string | null;
@@ -112,18 +118,18 @@ export interface Question {
112
118
  created_at: string;
113
119
  updated_at: string;
114
120
  deleted_at?: string | null;
121
+ tenant_id: string;
115
122
  title: string;
116
123
  subtitle?: string | null;
117
- type: string;
118
- kind: string;
119
- data: CreateQuestionData;
124
+ type: QuestionType;
125
+ kind: QuestionKind;
126
+ data: QuestionData;
120
127
  active?: boolean;
121
128
  expires_at?: string | null;
122
129
  answer_quota?: number | null;
123
- tenant_id: string;
124
130
  answer?: Answer;
125
131
  }
126
- export interface QuestionColectionResponse {
132
+ export interface QuestionCollectionResponse {
127
133
  page: number;
128
134
  page_count: number;
129
135
  page_size: number;
@@ -171,7 +177,7 @@ export interface NotificationResponse {
171
177
  viewed_at?: string | null;
172
178
  version?: string;
173
179
  }
174
- export interface NotificationColectionResponse {
180
+ export interface NotificationCollectionResponse {
175
181
  page: number;
176
182
  page_count: number;
177
183
  page_size: number;
@@ -245,15 +251,25 @@ declare class ParraAPI {
245
251
  });
246
252
  getTenantById: (tenant_id: string) => Promise<Tenant>;
247
253
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
248
- getTenantsForUserById: (user_id: string) => Promise<TenantColectionResponse>;
254
+ getTenantsForUserById: (user_id: string) => Promise<TenantCollectionResponse>;
249
255
  getTenantByUserIdAndTenantId: (user_id: string, tenant_id: string) => Promise<Tenant>;
250
256
  createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody | undefined) => Promise<ApiKeyWithSecretResponse>;
251
- getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyColectionResponse>;
257
+ getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyCollectionResponse>;
252
258
  deleteApiKeyForTenantById: (tenant_id: string, api_key_id: string) => Promise<Response>;
253
259
  getTenantForApiKeyById: (api_key_id: string) => Promise<Tenant>;
254
260
  getCards: () => Promise<CardsResponse>;
255
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>;
256
271
  getQuestionById: (question_id: string) => Promise<Question>;
272
+ deleteQuestionById: (question_id: string) => Promise<Response>;
257
273
  answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
258
274
  createUser: (body: CreateUserRequestBody) => Promise<UserResponse>;
259
275
  listUsers: (query?: {
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,11 +83,22 @@ 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",
83
95
  });
84
96
  };
97
+ this.deleteQuestionById = function (question_id) {
98
+ return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
99
+ method: "delete",
100
+ });
101
+ };
85
102
  this.answerQuestionById = function (question_id, body) {
86
103
  return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id + "/answer", {
87
104
  method: "put",
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.15",
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
  },