@parra/parra-js-sdk 0.2.23 → 0.2.28

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
66
  }
67
+ export interface BulkAnswerQuestionBody {
68
+ question_id: string;
69
+ data: AnswerData;
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"
@@ -104,21 +109,34 @@ export interface CreateChoiceQuestionBody {
104
109
  }
105
110
  export declare type CreateQuestionData = CreateChoiceQuestionBody;
106
111
  export declare type QuestionData = ChoiceQuestionBody;
112
+ export interface UpdateQuestionRequestBody {
113
+ title: string;
114
+ subtitle?: string | null;
115
+ data: CreateQuestionData;
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
123
  data: CreateQuestionData;
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;
@@ -126,9 +144,10 @@ export interface Question {
126
144
  kind: QuestionKind;
127
145
  data: QuestionData;
128
146
  active?: boolean;
129
- expires_at?: string | null;
130
147
  answer_quota?: number | null;
131
148
  answer_count?: number;
149
+ expires_at?: string | null;
150
+ closed_at?: string | null;
132
151
  answer?: Answer;
133
152
  metrics?: QuestionMetrics;
134
153
  }
@@ -293,9 +312,12 @@ declare class ParraAPI {
293
312
  $search?: string | undefined;
294
313
  } | undefined) => Promise<QuestionCollectionResponse>;
295
314
  getQuestionById: (question_id: string) => Promise<Question>;
315
+ updateQuestionById: (question_id: string, body?: UpdateQuestionRequestBody | undefined) => Promise<Question>;
296
316
  deleteQuestionById: (question_id: string) => Promise<Response>;
317
+ closeQuestionById: (question_id: string) => Promise<Response>;
297
318
  createMetricsForQuestionById: (question_id: string) => Promise<QuestionMetrics>;
298
319
  answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
320
+ bulkAnswerQuestions: (body?: BulkAnswerQuestionsBody | undefined) => Promise<Response>;
299
321
  createUser: (body: CreateUserRequestBody) => Promise<UserResponse>;
300
322
  listUsers: (query?: {
301
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,11 +99,25 @@ 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",
100
114
  });
101
115
  };
116
+ this.closeQuestionById = function (question_id) {
117
+ return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id + "/close", {
118
+ method: "post",
119
+ });
120
+ };
102
121
  this.createMetricsForQuestionById = function (question_id) {
103
122
  return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id + "/metrics", {
104
123
  method: "post",
@@ -113,6 +132,15 @@ var ParraAPI = /** @class */ (function () {
113
132
  },
114
133
  });
115
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
+ };
116
144
  this.createUser = function (body) {
117
145
  return _this.http.execute(_this.options.baseUrl + "/v1/users", {
118
146
  method: "post",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.23",
3
+ "version": "0.2.28",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",