UNPKG

@ondewo/survey-client-angular

Version:

ONDEWO Survey client library for angular

1,305 lines (1,302 loc) 171 kB
import * as i0 from '@angular/core'; import { InjectionToken, Injectable, Optional, Inject } from '@angular/core'; import { GrpcCallType, GrpcMetadata } from '@ngx-grpc/common'; import * as i1 from '@ngx-grpc/core'; import { throwStatusErrors, takeMessages, GRPC_CLIENT_FACTORY } from '@ngx-grpc/core'; import { BinaryReader, BinaryWriter } from 'google-protobuf'; import * as googleProtobuf006 from '@ngx-grpc/well-known-types'; /** * Message implementation for ondewo.survey.CreateFHIRSurveyRequest */ class CreateFHIRSurveyRequest { static { this.id = 'ondewo.survey.CreateFHIRSurveyRequest'; } /** * Deserialize binary data to message * @param instance message instance */ static deserializeBinary(bytes) { const instance = new CreateFHIRSurveyRequest(); CreateFHIRSurveyRequest.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); return instance; } /** * Check all the properties and set default protobuf values if necessary * @param _instance message instance */ static refineValues(_instance) { _instance.fhirQuestionnaire = _instance.fhirQuestionnaire || undefined; } /** * Deserializes / reads binary message into message instance using provided binary reader * @param _instance message instance * @param _reader binary reader instance */ static deserializeBinaryFromReader(_instance, _reader) { while (_reader.nextField()) { if (_reader.isEndGroup()) break; switch (_reader.getFieldNumber()) { case 1: _instance.fhirQuestionnaire = new googleProtobuf006.Struct(); _reader.readMessage(_instance.fhirQuestionnaire, googleProtobuf006.Struct.deserializeBinaryFromReader); break; default: _reader.skipField(); } } CreateFHIRSurveyRequest.refineValues(_instance); } /** * Serializes a message to binary format using provided binary reader * @param _instance message instance * @param _writer binary writer instance */ static serializeBinaryToWriter(_instance, _writer) { if (_instance.fhirQuestionnaire) { _writer.writeMessage(1, _instance.fhirQuestionnaire, googleProtobuf006.Struct.serializeBinaryToWriter); } } /** * Message constructor. Initializes the properties and applies default Protobuf values if necessary * @param _value initial values object or instance of CreateFHIRSurveyRequest to deeply clone from */ constructor(_value) { _value = _value || {}; this.fhirQuestionnaire = _value.fhirQuestionnaire ? new googleProtobuf006.Struct(_value.fhirQuestionnaire) : undefined; CreateFHIRSurveyRequest.refineValues(this); } get fhirQuestionnaire() { return this._fhirQuestionnaire; } set fhirQuestionnaire(value) { this._fhirQuestionnaire = value; } /** * Serialize message to binary data * @param instance message instance */ serializeBinary() { const writer = new BinaryWriter(); CreateFHIRSurveyRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } /** * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) */ toObject() { return { fhirQuestionnaire: this.fhirQuestionnaire ? this.fhirQuestionnaire.toObject() : undefined }; } /** * Convenience method to support JSON.stringify(message), replicates the structure of toObject() */ toJSON() { return this.toObject(); } /** * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required */ toProtobufJSON( // @ts-ignore options) { return { fhirQuestionnaire: this.fhirQuestionnaire ? this.fhirQuestionnaire.toProtobufJSON(options) : null }; } } /** * Message implementation for ondewo.survey.SurveyFHIRAnswersResponse */ class SurveyFHIRAnswersResponse { static { this.id = 'ondewo.survey.SurveyFHIRAnswersResponse'; } /** * Deserialize binary data to message * @param instance message instance */ static deserializeBinary(bytes) { const instance = new SurveyFHIRAnswersResponse(); SurveyFHIRAnswersResponse.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); return instance; } /** * Check all the properties and set default protobuf values if necessary * @param _instance message instance */ static refineValues(_instance) { _instance.surveyId = _instance.surveyId || ''; _instance.fhirQuestionnaireResponses = _instance.fhirQuestionnaireResponses || []; } /** * Deserializes / reads binary message into message instance using provided binary reader * @param _instance message instance * @param _reader binary reader instance */ static deserializeBinaryFromReader(_instance, _reader) { while (_reader.nextField()) { if (_reader.isEndGroup()) break; switch (_reader.getFieldNumber()) { case 1: _instance.surveyId = _reader.readString(); break; case 2: const messageInitializer2 = new googleProtobuf006.Struct(); _reader.readMessage(messageInitializer2, googleProtobuf006.Struct.deserializeBinaryFromReader); (_instance.fhirQuestionnaireResponses = _instance.fhirQuestionnaireResponses || []).push(messageInitializer2); break; default: _reader.skipField(); } } SurveyFHIRAnswersResponse.refineValues(_instance); } /** * Serializes a message to binary format using provided binary reader * @param _instance message instance * @param _writer binary writer instance */ static serializeBinaryToWriter(_instance, _writer) { if (_instance.surveyId) { _writer.writeString(1, _instance.surveyId); } if (_instance.fhirQuestionnaireResponses && _instance.fhirQuestionnaireResponses.length) { _writer.writeRepeatedMessage(2, _instance.fhirQuestionnaireResponses, googleProtobuf006.Struct.serializeBinaryToWriter); } } /** * Message constructor. Initializes the properties and applies default Protobuf values if necessary * @param _value initial values object or instance of SurveyFHIRAnswersResponse to deeply clone from */ constructor(_value) { _value = _value || {}; this.surveyId = _value.surveyId; this.fhirQuestionnaireResponses = (_value.fhirQuestionnaireResponses || []).map(m => new googleProtobuf006.Struct(m)); SurveyFHIRAnswersResponse.refineValues(this); } get surveyId() { return this._surveyId; } set surveyId(value) { this._surveyId = value; } get fhirQuestionnaireResponses() { return this._fhirQuestionnaireResponses; } set fhirQuestionnaireResponses(value) { this._fhirQuestionnaireResponses = value; } /** * Serialize message to binary data * @param instance message instance */ serializeBinary() { const writer = new BinaryWriter(); SurveyFHIRAnswersResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } /** * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) */ toObject() { return { surveyId: this.surveyId, fhirQuestionnaireResponses: (this.fhirQuestionnaireResponses || []).map(m => m.toObject()) }; } /** * Convenience method to support JSON.stringify(message), replicates the structure of toObject() */ toJSON() { return this.toObject(); } /** * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required */ toProtobufJSON( // @ts-ignore options) { return { surveyId: this.surveyId, fhirQuestionnaireResponses: (this.fhirQuestionnaireResponses || []).map(m => m.toProtobufJSON(options)) }; } } var SubFlow; (function (SubFlow) { SubFlow[SubFlow["SUBFLOW_UNSPECIFIED"] = 0] = "SUBFLOW_UNSPECIFIED"; SubFlow[SubFlow["BOT"] = 1] = "BOT"; SubFlow[SubFlow["LEGAL_ENTITY"] = 2] = "LEGAL_ENTITY"; SubFlow[SubFlow["POSTAL_ADDRESS"] = 3] = "POSTAL_ADDRESS"; SubFlow[SubFlow["EMAIL_ADDRESS"] = 4] = "EMAIL_ADDRESS"; SubFlow[SubFlow["PHONE_NUMBER"] = 5] = "PHONE_NUMBER"; SubFlow[SubFlow["PHONE_HOURS"] = 6] = "PHONE_HOURS"; SubFlow[SubFlow["EXPECTED_DURATION"] = 7] = "EXPECTED_DURATION"; SubFlow[SubFlow["PURPOSE"] = 8] = "PURPOSE"; })(SubFlow || (SubFlow = {})); /** * Message implementation for ondewo.survey.Survey */ class Survey { static { this.id = 'ondewo.survey.Survey'; } /** * Deserialize binary data to message * @param instance message instance */ static deserializeBinary(bytes) { const instance = new Survey(); Survey.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); return instance; } /** * Check all the properties and set default protobuf values if necessary * @param _instance message instance */ static refineValues(_instance) { _instance.surveyId = _instance.surveyId || ''; _instance.displayName = _instance.displayName || ''; _instance.languageCode = _instance.languageCode || ''; _instance.questions = _instance.questions || []; _instance.surveyInfo = _instance.surveyInfo || undefined; _instance.excludeSubflows = _instance.excludeSubflows || []; _instance.status = _instance.status || 0; } /** * Deserializes / reads binary message into message instance using provided binary reader * @param _instance message instance * @param _reader binary reader instance */ static deserializeBinaryFromReader(_instance, _reader) { while (_reader.nextField()) { if (_reader.isEndGroup()) break; switch (_reader.getFieldNumber()) { case 1: _instance.surveyId = _reader.readString(); break; case 2: _instance.displayName = _reader.readString(); break; case 3: _instance.languageCode = _reader.readString(); break; case 7: const messageInitializer7 = new Question(); _reader.readMessage(messageInitializer7, Question.deserializeBinaryFromReader); (_instance.questions = _instance.questions || []).push(messageInitializer7); break; case 8: _instance.surveyInfo = new SurveyInfo(); _reader.readMessage(_instance.surveyInfo, SurveyInfo.deserializeBinaryFromReader); break; case 9: (_instance.excludeSubflows = _instance.excludeSubflows || []).push(...(_reader.readPackedEnum() || [])); break; case 10: _instance.status = _reader.readEnum(); break; default: _reader.skipField(); } } Survey.refineValues(_instance); } /** * Serializes a message to binary format using provided binary reader * @param _instance message instance * @param _writer binary writer instance */ static serializeBinaryToWriter(_instance, _writer) { if (_instance.surveyId) { _writer.writeString(1, _instance.surveyId); } if (_instance.displayName) { _writer.writeString(2, _instance.displayName); } if (_instance.languageCode) { _writer.writeString(3, _instance.languageCode); } if (_instance.questions && _instance.questions.length) { _writer.writeRepeatedMessage(7, _instance.questions, Question.serializeBinaryToWriter); } if (_instance.surveyInfo) { _writer.writeMessage(8, _instance.surveyInfo, SurveyInfo.serializeBinaryToWriter); } if (_instance.excludeSubflows && _instance.excludeSubflows.length) { _writer.writePackedEnum(9, _instance.excludeSubflows); } if (_instance.status) { _writer.writeEnum(10, _instance.status); } } /** * Message constructor. Initializes the properties and applies default Protobuf values if necessary * @param _value initial values object or instance of Survey to deeply clone from */ constructor(_value) { _value = _value || {}; this.surveyId = _value.surveyId; this.displayName = _value.displayName; this.languageCode = _value.languageCode; this.questions = (_value.questions || []).map(m => new Question(m)); this.surveyInfo = _value.surveyInfo ? new SurveyInfo(_value.surveyInfo) : undefined; this.excludeSubflows = (_value.excludeSubflows || []).slice(); this.status = _value.status; Survey.refineValues(this); } get surveyId() { return this._surveyId; } set surveyId(value) { this._surveyId = value; } get displayName() { return this._displayName; } set displayName(value) { this._displayName = value; } get languageCode() { return this._languageCode; } set languageCode(value) { this._languageCode = value; } get questions() { return this._questions; } set questions(value) { this._questions = value; } get surveyInfo() { return this._surveyInfo; } set surveyInfo(value) { this._surveyInfo = value; } get excludeSubflows() { return this._excludeSubflows; } set excludeSubflows(value) { this._excludeSubflows = value; } get status() { return this._status; } set status(value) { this._status = value; } /** * Serialize message to binary data * @param instance message instance */ serializeBinary() { const writer = new BinaryWriter(); Survey.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } /** * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) */ toObject() { return { surveyId: this.surveyId, displayName: this.displayName, languageCode: this.languageCode, questions: (this.questions || []).map(m => m.toObject()), surveyInfo: this.surveyInfo ? this.surveyInfo.toObject() : undefined, excludeSubflows: (this.excludeSubflows || []).slice(), status: this.status }; } /** * Convenience method to support JSON.stringify(message), replicates the structure of toObject() */ toJSON() { return this.toObject(); } /** * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required */ toProtobufJSON( // @ts-ignore options) { return { surveyId: this.surveyId, displayName: this.displayName, languageCode: this.languageCode, questions: (this.questions || []).map(m => m.toProtobufJSON(options)), surveyInfo: this.surveyInfo ? this.surveyInfo.toProtobufJSON(options) : null, excludeSubflows: (this.excludeSubflows || []).map(v => SubFlow[v]), status: Survey.AgentStatus[this.status === null || this.status === undefined ? 0 : this.status] }; } } (function (Survey) { let AgentStatus; (function (AgentStatus) { AgentStatus[AgentStatus["TO_BE_INITIALIZED"] = 0] = "TO_BE_INITIALIZED"; AgentStatus[AgentStatus["UPDATED"] = 1] = "UPDATED"; AgentStatus[AgentStatus["UPDATING"] = 2] = "UPDATING"; AgentStatus[AgentStatus["OUTDATED"] = 3] = "OUTDATED"; })(AgentStatus = Survey.AgentStatus || (Survey.AgentStatus = {})); })(Survey || (Survey = {})); /** * Message implementation for ondewo.survey.SurveyInfo */ class SurveyInfo { static { this.id = 'ondewo.survey.SurveyInfo'; } /** * Deserialize binary data to message * @param instance message instance */ static deserializeBinary(bytes) { const instance = new SurveyInfo(); SurveyInfo.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); return instance; } /** * Check all the properties and set default protobuf values if necessary * @param _instance message instance */ static refineValues(_instance) { _instance.legalEntity = _instance.legalEntity || ''; _instance.postalAddress = _instance.postalAddress || ''; _instance.emailAddress = _instance.emailAddress || ''; _instance.phoneNumber = _instance.phoneNumber || ''; _instance.phoneHours = _instance.phoneHours || ''; _instance.expectedDuration = _instance.expectedDuration || ''; _instance.purpose = _instance.purpose || ''; _instance.topic = _instance.topic || ''; _instance.legalDisclaimer = _instance.legalDisclaimer || ''; _instance.anonymous = _instance.anonymous || false; } /** * Deserializes / reads binary message into message instance using provided binary reader * @param _instance message instance * @param _reader binary reader instance */ static deserializeBinaryFromReader(_instance, _reader) { while (_reader.nextField()) { if (_reader.isEndGroup()) break; switch (_reader.getFieldNumber()) { case 1: _instance.legalEntity = _reader.readString(); break; case 2: _instance.postalAddress = _reader.readString(); break; case 3: _instance.emailAddress = _reader.readString(); break; case 4: _instance.phoneNumber = _reader.readString(); break; case 5: _instance.phoneHours = _reader.readString(); break; case 6: _instance.expectedDuration = _reader.readString(); break; case 7: _instance.purpose = _reader.readString(); break; case 8: _instance.topic = _reader.readString(); break; case 9: _instance.legalDisclaimer = _reader.readString(); break; case 10: _instance.anonymous = _reader.readBool(); break; default: _reader.skipField(); } } SurveyInfo.refineValues(_instance); } /** * Serializes a message to binary format using provided binary reader * @param _instance message instance * @param _writer binary writer instance */ static serializeBinaryToWriter(_instance, _writer) { if (_instance.legalEntity) { _writer.writeString(1, _instance.legalEntity); } if (_instance.postalAddress) { _writer.writeString(2, _instance.postalAddress); } if (_instance.emailAddress) { _writer.writeString(3, _instance.emailAddress); } if (_instance.phoneNumber) { _writer.writeString(4, _instance.phoneNumber); } if (_instance.phoneHours) { _writer.writeString(5, _instance.phoneHours); } if (_instance.expectedDuration) { _writer.writeString(6, _instance.expectedDuration); } if (_instance.purpose) { _writer.writeString(7, _instance.purpose); } if (_instance.topic) { _writer.writeString(8, _instance.topic); } if (_instance.legalDisclaimer) { _writer.writeString(9, _instance.legalDisclaimer); } if (_instance.anonymous) { _writer.writeBool(10, _instance.anonymous); } } /** * Message constructor. Initializes the properties and applies default Protobuf values if necessary * @param _value initial values object or instance of SurveyInfo to deeply clone from */ constructor(_value) { _value = _value || {}; this.legalEntity = _value.legalEntity; this.postalAddress = _value.postalAddress; this.emailAddress = _value.emailAddress; this.phoneNumber = _value.phoneNumber; this.phoneHours = _value.phoneHours; this.expectedDuration = _value.expectedDuration; this.purpose = _value.purpose; this.topic = _value.topic; this.legalDisclaimer = _value.legalDisclaimer; this.anonymous = _value.anonymous; SurveyInfo.refineValues(this); } get legalEntity() { return this._legalEntity; } set legalEntity(value) { this._legalEntity = value; } get postalAddress() { return this._postalAddress; } set postalAddress(value) { this._postalAddress = value; } get emailAddress() { return this._emailAddress; } set emailAddress(value) { this._emailAddress = value; } get phoneNumber() { return this._phoneNumber; } set phoneNumber(value) { this._phoneNumber = value; } get phoneHours() { return this._phoneHours; } set phoneHours(value) { this._phoneHours = value; } get expectedDuration() { return this._expectedDuration; } set expectedDuration(value) { this._expectedDuration = value; } get purpose() { return this._purpose; } set purpose(value) { this._purpose = value; } get topic() { return this._topic; } set topic(value) { this._topic = value; } get legalDisclaimer() { return this._legalDisclaimer; } set legalDisclaimer(value) { this._legalDisclaimer = value; } get anonymous() { return this._anonymous; } set anonymous(value) { this._anonymous = value; } /** * Serialize message to binary data * @param instance message instance */ serializeBinary() { const writer = new BinaryWriter(); SurveyInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } /** * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) */ toObject() { return { legalEntity: this.legalEntity, postalAddress: this.postalAddress, emailAddress: this.emailAddress, phoneNumber: this.phoneNumber, phoneHours: this.phoneHours, expectedDuration: this.expectedDuration, purpose: this.purpose, topic: this.topic, legalDisclaimer: this.legalDisclaimer, anonymous: this.anonymous }; } /** * Convenience method to support JSON.stringify(message), replicates the structure of toObject() */ toJSON() { return this.toObject(); } /** * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required */ toProtobufJSON( // @ts-ignore options) { return { legalEntity: this.legalEntity, postalAddress: this.postalAddress, emailAddress: this.emailAddress, phoneNumber: this.phoneNumber, phoneHours: this.phoneHours, expectedDuration: this.expectedDuration, purpose: this.purpose, topic: this.topic, legalDisclaimer: this.legalDisclaimer, anonymous: this.anonymous }; } } /** * Message implementation for ondewo.survey.Question */ class Question { static { this.id = 'ondewo.survey.Question'; } /** * Deserialize binary data to message * @param instance message instance */ static deserializeBinary(bytes) { const instance = new Question(); Question.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); return instance; } /** * Check all the properties and set default protobuf values if necessary * @param _instance message instance */ static refineValues(_instance) { } /** * Deserializes / reads binary message into message instance using provided binary reader * @param _instance message instance * @param _reader binary reader instance */ static deserializeBinaryFromReader(_instance, _reader) { while (_reader.nextField()) { if (_reader.isEndGroup()) break; switch (_reader.getFieldNumber()) { case 1: _instance.openQuestion = new OpenQuestion(); _reader.readMessage(_instance.openQuestion, OpenQuestion.deserializeBinaryFromReader); break; case 2: _instance.singleChoiceQuestion = new SingleChoiceQuestion(); _reader.readMessage(_instance.singleChoiceQuestion, SingleChoiceQuestion.deserializeBinaryFromReader); break; case 3: _instance.multipleChoiceQuestion = new MultipleChoiceQuestion(); _reader.readMessage(_instance.multipleChoiceQuestion, MultipleChoiceQuestion.deserializeBinaryFromReader); break; case 4: _instance.scaleQuestion = new ScaleQuestion(); _reader.readMessage(_instance.scaleQuestion, ScaleQuestion.deserializeBinaryFromReader); break; case 5: _instance.singleParameterQuestion = new SingleParameterQuestion(); _reader.readMessage(_instance.singleParameterQuestion, SingleParameterQuestion.deserializeBinaryFromReader); break; case 6: _instance.multipleParameterQuestion = new MultipleParameterQuestion(); _reader.readMessage(_instance.multipleParameterQuestion, MultipleParameterQuestion.deserializeBinaryFromReader); break; default: _reader.skipField(); } } Question.refineValues(_instance); } /** * Serializes a message to binary format using provided binary reader * @param _instance message instance * @param _writer binary writer instance */ static serializeBinaryToWriter(_instance, _writer) { if (_instance.openQuestion) { _writer.writeMessage(1, _instance.openQuestion, OpenQuestion.serializeBinaryToWriter); } if (_instance.singleChoiceQuestion) { _writer.writeMessage(2, _instance.singleChoiceQuestion, SingleChoiceQuestion.serializeBinaryToWriter); } if (_instance.multipleChoiceQuestion) { _writer.writeMessage(3, _instance.multipleChoiceQuestion, MultipleChoiceQuestion.serializeBinaryToWriter); } if (_instance.scaleQuestion) { _writer.writeMessage(4, _instance.scaleQuestion, ScaleQuestion.serializeBinaryToWriter); } if (_instance.singleParameterQuestion) { _writer.writeMessage(5, _instance.singleParameterQuestion, SingleParameterQuestion.serializeBinaryToWriter); } if (_instance.multipleParameterQuestion) { _writer.writeMessage(6, _instance.multipleParameterQuestion, MultipleParameterQuestion.serializeBinaryToWriter); } } /** * Message constructor. Initializes the properties and applies default Protobuf values if necessary * @param _value initial values object or instance of Question to deeply clone from */ constructor(_value) { this._question = Question.QuestionCase.none; _value = _value || {}; this.openQuestion = _value.openQuestion ? new OpenQuestion(_value.openQuestion) : undefined; this.singleChoiceQuestion = _value.singleChoiceQuestion ? new SingleChoiceQuestion(_value.singleChoiceQuestion) : undefined; this.multipleChoiceQuestion = _value.multipleChoiceQuestion ? new MultipleChoiceQuestion(_value.multipleChoiceQuestion) : undefined; this.scaleQuestion = _value.scaleQuestion ? new ScaleQuestion(_value.scaleQuestion) : undefined; this.singleParameterQuestion = _value.singleParameterQuestion ? new SingleParameterQuestion(_value.singleParameterQuestion) : undefined; this.multipleParameterQuestion = _value.multipleParameterQuestion ? new MultipleParameterQuestion(_value.multipleParameterQuestion) : undefined; Question.refineValues(this); } get openQuestion() { return this._openQuestion; } set openQuestion(value) { if (value !== undefined && value !== null) { this._singleChoiceQuestion = this._multipleChoiceQuestion = this._scaleQuestion = this._singleParameterQuestion = this._multipleParameterQuestion = undefined; this._question = Question.QuestionCase.openQuestion; } this._openQuestion = value; } get singleChoiceQuestion() { return this._singleChoiceQuestion; } set singleChoiceQuestion(value) { if (value !== undefined && value !== null) { this._openQuestion = this._multipleChoiceQuestion = this._scaleQuestion = this._singleParameterQuestion = this._multipleParameterQuestion = undefined; this._question = Question.QuestionCase.singleChoiceQuestion; } this._singleChoiceQuestion = value; } get multipleChoiceQuestion() { return this._multipleChoiceQuestion; } set multipleChoiceQuestion(value) { if (value !== undefined && value !== null) { this._openQuestion = this._singleChoiceQuestion = this._scaleQuestion = this._singleParameterQuestion = this._multipleParameterQuestion = undefined; this._question = Question.QuestionCase.multipleChoiceQuestion; } this._multipleChoiceQuestion = value; } get scaleQuestion() { return this._scaleQuestion; } set scaleQuestion(value) { if (value !== undefined && value !== null) { this._openQuestion = this._singleChoiceQuestion = this._multipleChoiceQuestion = this._singleParameterQuestion = this._multipleParameterQuestion = undefined; this._question = Question.QuestionCase.scaleQuestion; } this._scaleQuestion = value; } get singleParameterQuestion() { return this._singleParameterQuestion; } set singleParameterQuestion(value) { if (value !== undefined && value !== null) { this._openQuestion = this._singleChoiceQuestion = this._multipleChoiceQuestion = this._scaleQuestion = this._multipleParameterQuestion = undefined; this._question = Question.QuestionCase.singleParameterQuestion; } this._singleParameterQuestion = value; } get multipleParameterQuestion() { return this._multipleParameterQuestion; } set multipleParameterQuestion(value) { if (value !== undefined && value !== null) { this._openQuestion = this._singleChoiceQuestion = this._multipleChoiceQuestion = this._scaleQuestion = this._singleParameterQuestion = undefined; this._question = Question.QuestionCase.multipleParameterQuestion; } this._multipleParameterQuestion = value; } get question() { return this._question; } /** * Serialize message to binary data * @param instance message instance */ serializeBinary() { const writer = new BinaryWriter(); Question.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } /** * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) */ toObject() { return { openQuestion: this.openQuestion ? this.openQuestion.toObject() : undefined, singleChoiceQuestion: this.singleChoiceQuestion ? this.singleChoiceQuestion.toObject() : undefined, multipleChoiceQuestion: this.multipleChoiceQuestion ? this.multipleChoiceQuestion.toObject() : undefined, scaleQuestion: this.scaleQuestion ? this.scaleQuestion.toObject() : undefined, singleParameterQuestion: this.singleParameterQuestion ? this.singleParameterQuestion.toObject() : undefined, multipleParameterQuestion: this.multipleParameterQuestion ? this.multipleParameterQuestion.toObject() : undefined }; } /** * Convenience method to support JSON.stringify(message), replicates the structure of toObject() */ toJSON() { return this.toObject(); } /** * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required */ toProtobufJSON( // @ts-ignore options) { return { openQuestion: this.openQuestion ? this.openQuestion.toProtobufJSON(options) : null, singleChoiceQuestion: this.singleChoiceQuestion ? this.singleChoiceQuestion.toProtobufJSON(options) : null, multipleChoiceQuestion: this.multipleChoiceQuestion ? this.multipleChoiceQuestion.toProtobufJSON(options) : null, scaleQuestion: this.scaleQuestion ? this.scaleQuestion.toProtobufJSON(options) : null, singleParameterQuestion: this.singleParameterQuestion ? this.singleParameterQuestion.toProtobufJSON(options) : null, multipleParameterQuestion: this.multipleParameterQuestion ? this.multipleParameterQuestion.toProtobufJSON(options) : null }; } } (function (Question) { let QuestionCase; (function (QuestionCase) { QuestionCase[QuestionCase["none"] = 0] = "none"; QuestionCase[QuestionCase["openQuestion"] = 1] = "openQuestion"; QuestionCase[QuestionCase["singleChoiceQuestion"] = 2] = "singleChoiceQuestion"; QuestionCase[QuestionCase["multipleChoiceQuestion"] = 3] = "multipleChoiceQuestion"; QuestionCase[QuestionCase["scaleQuestion"] = 4] = "scaleQuestion"; QuestionCase[QuestionCase["singleParameterQuestion"] = 5] = "singleParameterQuestion"; QuestionCase[QuestionCase["multipleParameterQuestion"] = 6] = "multipleParameterQuestion"; })(QuestionCase = Question.QuestionCase || (Question.QuestionCase = {})); })(Question || (Question = {})); /** * Message implementation for ondewo.survey.OpenQuestion */ class OpenQuestion { static { this.id = 'ondewo.survey.OpenQuestion'; } /** * Deserialize binary data to message * @param instance message instance */ static deserializeBinary(bytes) { const instance = new OpenQuestion(); OpenQuestion.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); return instance; } /** * Check all the properties and set default protobuf values if necessary * @param _instance message instance */ static refineValues(_instance) { _instance.questionText = _instance.questionText || ''; } /** * Deserializes / reads binary message into message instance using provided binary reader * @param _instance message instance * @param _reader binary reader instance */ static deserializeBinaryFromReader(_instance, _reader) { while (_reader.nextField()) { if (_reader.isEndGroup()) break; switch (_reader.getFieldNumber()) { case 1: _instance.questionText = _reader.readString(); break; default: _reader.skipField(); } } OpenQuestion.refineValues(_instance); } /** * Serializes a message to binary format using provided binary reader * @param _instance message instance * @param _writer binary writer instance */ static serializeBinaryToWriter(_instance, _writer) { if (_instance.questionText) { _writer.writeString(1, _instance.questionText); } } /** * Message constructor. Initializes the properties and applies default Protobuf values if necessary * @param _value initial values object or instance of OpenQuestion to deeply clone from */ constructor(_value) { _value = _value || {}; this.questionText = _value.questionText; OpenQuestion.refineValues(this); } get questionText() { return this._questionText; } set questionText(value) { this._questionText = value; } /** * Serialize message to binary data * @param instance message instance */ serializeBinary() { const writer = new BinaryWriter(); OpenQuestion.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } /** * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) */ toObject() { return { questionText: this.questionText }; } /** * Convenience method to support JSON.stringify(message), replicates the structure of toObject() */ toJSON() { return this.toObject(); } /** * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required */ toProtobufJSON( // @ts-ignore options) { return { questionText: this.questionText }; } } /** * Message implementation for ondewo.survey.SingleChoiceQuestion */ class SingleChoiceQuestion { static { this.id = 'ondewo.survey.SingleChoiceQuestion'; } /** * Deserialize binary data to message * @param instance message instance */ static deserializeBinary(bytes) { const instance = new SingleChoiceQuestion(); SingleChoiceQuestion.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); return instance; } /** * Check all the properties and set default protobuf values if necessary * @param _instance message instance */ static refineValues(_instance) { _instance.questionText = _instance.questionText || ''; _instance.choices = _instance.choices || []; } /** * Deserializes / reads binary message into message instance using provided binary reader * @param _instance message instance * @param _reader binary reader instance */ static deserializeBinaryFromReader(_instance, _reader) { while (_reader.nextField()) { if (_reader.isEndGroup()) break; switch (_reader.getFieldNumber()) { case 1: _instance.questionText = _reader.readString(); break; case 2: const messageInitializer2 = new Choice(); _reader.readMessage(messageInitializer2, Choice.deserializeBinaryFromReader); (_instance.choices = _instance.choices || []).push(messageInitializer2); break; default: _reader.skipField(); } } SingleChoiceQuestion.refineValues(_instance); } /** * Serializes a message to binary format using provided binary reader * @param _instance message instance * @param _writer binary writer instance */ static serializeBinaryToWriter(_instance, _writer) { if (_instance.questionText) { _writer.writeString(1, _instance.questionText); } if (_instance.choices && _instance.choices.length) { _writer.writeRepeatedMessage(2, _instance.choices, Choice.serializeBinaryToWriter); } } /** * Message constructor. Initializes the properties and applies default Protobuf values if necessary * @param _value initial values object or instance of SingleChoiceQuestion to deeply clone from */ constructor(_value) { _value = _value || {}; this.questionText = _value.questionText; this.choices = (_value.choices || []).map(m => new Choice(m)); SingleChoiceQuestion.refineValues(this); } get questionText() { return this._questionText; } set questionText(value) { this._questionText = value; } get choices() { return this._choices; } set choices(value) { this._choices = value; } /** * Serialize message to binary data * @param instance message instance */ serializeBinary() { const writer = new BinaryWriter(); SingleChoiceQuestion.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } /** * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) */ toObject() { return { questionText: this.questionText, choices: (this.choices || []).map(m => m.toObject()) }; } /** * Convenience method to support JSON.stringify(message), replicates the structure of toObject() */ toJSON() { return this.toObject(); } /** * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required */ toProtobufJSON( // @ts-ignore options) { return { questionText: this.questionText, choices: (this.choices || []).map(m => m.toProtobufJSON(options)) }; } } /** * Message implementation for ondewo.survey.MultipleChoiceQuestion */ class MultipleChoiceQuestion { static { this.id = 'ondewo.survey.MultipleChoiceQuestion'; } /** * Deserialize binary data to message * @param instance message instance */ static deserializeBinary(bytes) { const instance = new MultipleChoiceQuestion(); MultipleChoiceQuestion.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); return instance; } /** * Check all the properties and set default protobuf values if necessary * @param _instance message instance */ static refineValues(_instance) { _instance.questionText = _instance.questionText || ''; _instance.choices = _instance.choices || []; } /** * Deserializes / reads binary message into message instance using provided binary reader * @param _instance message instance * @param _reader binary reader instance */ static deserializeBinaryFromReader(_instance, _reader) { while (_reader.nextField()) { if (_reader.isEndGroup()) break; switch (_reader.getFieldNumber()) { case 1: _instance.questionText = _reader.readString(); break; case 2: const messageInitializer2 = new Choice(); _reader.readMessage(messageInitializer2, Choice.deserializeBinaryFromReader); (_instance.choices = _instance.choices || []).push(messageInitializer2); break; default: _reader.skipField(); } } MultipleChoiceQuestion.refineValues(_instance); } /** * Serializes a message to binary format using provided binary reader * @param _instance message instance * @param _writer binary writer instance */ static serializeBinaryToWriter(_instance, _writer) { if (_instance.questionText) { _writer.writeString(1, _instance.questionText); } if (_instance.choices && _instance.choices.length) { _writer.writeRepeatedMessage(2, _instance.choices, Choice.serializeBinaryToWriter); } } /** * Message constructor. Initializes the properties and applies default Protobuf values if necessary * @param _value initial values object or instance of MultipleChoiceQuestion to deeply clone from */ constructor(_value) { _value = _value || {}; this.questionText = _value.questionText; this.choices = (_value.choices || []).map(m => new Choice(m)); MultipleChoiceQuestion.refineValues(this); } get questionText() { return this._questionText; } set questionText(value) { this._questionText = value; } get choices() { return this._choices; } set choices(value) { this._choices = value; } /** * Serialize message to binary data * @param instance message instance */ serializeBinary() { const writer = new BinaryWriter(); MultipleChoiceQuestion.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } /** * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) */ toObject() { return { questionText: this.questionText, choices: (this.choices || []).map(m => m.toObject()) }; } /** * Convenience method to support JSON.stringify(message), replicates the structure of toObject() */ toJSON() { return this.toObject(); } /** * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required */ toProtobufJSON( // @ts-ignore options) { return { questionText: this.questionText, choices: (this.choices || []).map(m => m.toProtobufJSON(options)) }; } }