@parra/parra-js-sdk 0.2.24 → 0.2.29

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,26 +104,39 @@ 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;
129
+ }
130
+ export declare enum QuestionStatus {
131
+ open = "open",
132
+ closed = "closed"
116
133
  }
117
134
  export interface Question {
118
135
  id: string;
119
136
  created_at: string;
120
137
  updated_at: string;
121
138
  deleted_at?: string | null;
139
+ status: QuestionStatus;
122
140
  tenant_id: string;
123
141
  title: string;
124
142
  subtitle?: string | null;
@@ -294,10 +312,12 @@ declare class ParraAPI {
294
312
  $search?: string | undefined;
295
313
  } | undefined) => Promise<QuestionCollectionResponse>;
296
314
  getQuestionById: (question_id: string) => Promise<Question>;
315
+ updateQuestionById: (question_id: string, body?: UpdateQuestionRequestBody | undefined) => Promise<Question>;
297
316
  deleteQuestionById: (question_id: string) => Promise<Response>;
298
317
  closeQuestionById: (question_id: string) => Promise<Response>;
299
318
  createMetricsForQuestionById: (question_id: string) => Promise<QuestionMetrics>;
300
319
  answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
320
+ bulkAnswerQuestions: (body?: BulkAnswerQuestionsBody | undefined) => Promise<Response>;
301
321
  createUser: (body: CreateUserRequestBody) => Promise<UserResponse>;
302
322
  listUsers: (query?: {
303
323
  $select?: string | undefined;
package/dist/ParraAPI.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionKind = exports.QuestionType = exports.CardItemType = void 0;
3
+ exports.QuestionStatus = exports.QuestionKind = exports.QuestionType = exports.CardItemType = void 0;
4
4
  var CardItemType;
5
5
  (function (CardItemType) {
6
6
  CardItemType["question"] = "question";
@@ -16,6 +16,11 @@ var QuestionKind;
16
16
  QuestionKind["checkbox"] = "checkbox";
17
17
  QuestionKind["star"] = "star";
18
18
  })(QuestionKind = exports.QuestionKind || (exports.QuestionKind = {}));
19
+ var QuestionStatus;
20
+ (function (QuestionStatus) {
21
+ QuestionStatus["open"] = "open";
22
+ QuestionStatus["closed"] = "closed";
23
+ })(QuestionStatus = exports.QuestionStatus || (exports.QuestionStatus = {}));
19
24
  var ParraAPI = /** @class */ (function () {
20
25
  function ParraAPI(http, options) {
21
26
  var _this = this;
@@ -94,6 +99,15 @@ var ParraAPI = /** @class */ (function () {
94
99
  method: "get",
95
100
  });
96
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
+ };
97
111
  this.deleteQuestionById = function (question_id) {
98
112
  return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
99
113
  method: "delete",
@@ -118,6 +132,15 @@ var ParraAPI = /** @class */ (function () {
118
132
  },
119
133
  });
120
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
+ };
121
144
  this.createUser = function (body) {
122
145
  return _this.http.execute(_this.options.baseUrl + "/v1/users", {
123
146
  method: "post",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.24",
3
+ "version": "0.2.29",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",