@parra/parra-js-sdk 0.2.25 → 0.2.30

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.
@@ -62,8 +62,13 @@ export interface Answer {
62
62
  data: AnswerData;
63
63
  }
64
64
  export interface AnswerQuestionBody {
65
- data?: AnswerData;
65
+ data: AnswerData;
66
+ }
67
+ export interface BulkAnswerQuestionBody {
68
+ question_id: string;
69
+ data: AnswerData;
66
70
  }
71
+ export declare type BulkAnswerQuestionsBody = Array<BulkAnswerQuestionBody>;
67
72
  export declare type CardItemData = Question;
68
73
  export declare enum CardItemType {
69
74
  question = "question"
@@ -85,7 +90,7 @@ export declare enum QuestionKind {
85
90
  checkbox = "checkbox",
86
91
  star = "star"
87
92
  }
88
- export interface CreateChoiceQuestionOption {
93
+ export interface MutableChoiceQuestionOption {
89
94
  title: string;
90
95
  value: string;
91
96
  is_other?: boolean | null;
@@ -99,20 +104,28 @@ export interface ChoiceQuestionOption {
99
104
  export interface ChoiceQuestionBody {
100
105
  options: Array<ChoiceQuestionOption>;
101
106
  }
102
- export interface CreateChoiceQuestionBody {
103
- options: Array<CreateChoiceQuestionOption>;
107
+ export interface MutableChoiceQuestionBody {
108
+ options: Array<MutableChoiceQuestionOption>;
104
109
  }
105
- export declare type CreateQuestionData = CreateChoiceQuestionBody;
110
+ export declare type MutableQuestionData = MutableChoiceQuestionBody;
106
111
  export declare type QuestionData = ChoiceQuestionBody;
112
+ export interface UpdateQuestionRequestBody {
113
+ title: string;
114
+ subtitle?: string | null;
115
+ data: MutableQuestionData;
116
+ active?: boolean;
117
+ expires_at?: string | null;
118
+ answer_quota?: number | null;
119
+ }
107
120
  export interface CreateQuestionRequestBody {
108
121
  title: string;
109
122
  subtitle?: string | null;
110
- type: QuestionType;
111
- kind: QuestionKind;
112
- data: CreateQuestionData;
123
+ data: MutableQuestionData;
113
124
  active?: boolean;
114
125
  expires_at?: string | null;
115
126
  answer_quota?: number | null;
127
+ type: QuestionType;
128
+ kind: QuestionKind;
116
129
  }
117
130
  export declare enum QuestionStatus {
118
131
  open = "open",
@@ -293,22 +306,24 @@ declare class ParraAPI {
293
306
  $select?: string | undefined;
294
307
  $top?: number | undefined;
295
308
  $skip?: number | undefined;
296
- $orderBy?: string | undefined;
309
+ $orderby?: string | undefined;
297
310
  $filter?: string | undefined;
298
311
  $expand?: string | undefined;
299
312
  $search?: string | undefined;
300
313
  } | undefined) => Promise<QuestionCollectionResponse>;
301
314
  getQuestionById: (question_id: string) => Promise<Question>;
315
+ updateQuestionById: (question_id: string, body?: UpdateQuestionRequestBody | undefined) => Promise<Question>;
302
316
  deleteQuestionById: (question_id: string) => Promise<Response>;
303
317
  closeQuestionById: (question_id: string) => Promise<Response>;
304
318
  createMetricsForQuestionById: (question_id: string) => Promise<QuestionMetrics>;
305
319
  answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
320
+ bulkAnswerQuestions: (body?: BulkAnswerQuestionsBody | undefined) => Promise<Response>;
306
321
  createUser: (body: CreateUserRequestBody) => Promise<UserResponse>;
307
322
  listUsers: (query?: {
308
323
  $select?: string | undefined;
309
324
  $top?: number | undefined;
310
325
  $skip?: number | undefined;
311
- $orderBy?: string | undefined;
326
+ $orderby?: string | undefined;
312
327
  $filter?: string | undefined;
313
328
  $expand?: string | undefined;
314
329
  $search?: string | undefined;
package/dist/ParraAPI.js CHANGED
@@ -99,6 +99,15 @@ var ParraAPI = /** @class */ (function () {
99
99
  method: "get",
100
100
  });
101
101
  };
102
+ this.updateQuestionById = function (question_id, body) {
103
+ return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
104
+ method: "put",
105
+ body: JSON.stringify(body),
106
+ headers: {
107
+ "content-type": "application/json",
108
+ },
109
+ });
110
+ };
102
111
  this.deleteQuestionById = function (question_id) {
103
112
  return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
104
113
  method: "delete",
@@ -123,6 +132,15 @@ var ParraAPI = /** @class */ (function () {
123
132
  },
124
133
  });
125
134
  };
135
+ this.bulkAnswerQuestions = function (body) {
136
+ return _this.http.execute(_this.options.baseUrl + "/v1/bulk/questions/answer", {
137
+ method: "post",
138
+ body: JSON.stringify(body),
139
+ headers: {
140
+ "content-type": "application/json",
141
+ },
142
+ });
143
+ };
126
144
  this.createUser = function (body) {
127
145
  return _this.http.execute(_this.options.baseUrl + "/v1/users", {
128
146
  method: "post",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.25",
3
+ "version": "0.2.30",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",