From 6030827464277c772bd011480c5dd6eefe02e875 Mon Sep 17 00:00:00 2001 From: projectmoon Date: Sat, 9 Jan 2021 20:02:24 +0000 Subject: [PATCH] Remove unused REST semantics from cofd API. --- proto/cofd_api.proto | 49 +- src/frontend/_proto/cofd_api_pb.d.ts | 192 ++-- src/frontend/_proto/cofd_api_pb.js | 1238 +++++++++----------------- src/frontend/scripts/api.ts | 3 +- src/routes/api.rs | 3 +- src/routes/api/cofd.rs | 62 +- 6 files changed, 542 insertions(+), 1005 deletions(-) diff --git a/proto/cofd_api.proto b/proto/cofd_api.proto index 72f9791..a84186f 100644 --- a/proto/cofd_api.proto +++ b/proto/cofd_api.proto @@ -6,7 +6,7 @@ package models.proto.cofd.api; //Update basic information about a Chronicles of Darkness (or //derivative system) character sheet. This is a straight overwrite of //all basic information on the sheet. -message BasicInfo { +message UpdateBasicInfoRequest { string name = 1; string gender = 2; string concept = 3; @@ -14,23 +14,6 @@ message BasicInfo { int32 age = 5; } -//Update all attributes in a Chronicles of Darkness character (or -//derivative system) character sheet. This is a straight overwrite of -//all basic information on the sheet. -message Attributes { - int32 strength = 1; - int32 dexterity = 2; - int32 stamina = 3; - - int32 intelligence = 4; - int32 wits = 5; - int32 resolve = 6; - - int32 presence = 7; - int32 manipulation = 8; - int32 composure = 9; -} - //Generic "did something succeed or not" response. message ApiResult { bool success = 1; @@ -45,18 +28,11 @@ message UpdateAttributeRequest { int32 attribute_value = 4; } -//Update skill entries in a Chronicles of Darkness character sheet. -//This is a straight overwrite of all skills in the sheet. -message Skills { - repeated CofdSheet.Skill physical_skills = 1; - repeated CofdSheet.Skill mental_skills = 2; - repeated CofdSheet.Skill social_skills = 3; -} - //Full update of a single skill -message SkillUpdate { - string name = 1; - CofdSheet.Skill skill = 2; +message UpdateSkillRequest { + string character_username = 1; + int32 character_id = 2; + CofdSheet.Skill skill = 3; } //Partial update of a single skill dot amount. @@ -69,12 +45,21 @@ message UpdateSkillValueRequest { //Partial update of only a skill's specializations. The //specializations will be overwritten with the new values. -message SkillSpecializationsUpdate { +message UpdateSkillSpecializationsRequest { string name = 1; repeated string specializations = 2; } //Add a Condition to a Chronicles of Darkness character sheet. -message Condition { - string name = 1; +message AddConditionRequest { + string character_username = 1; + int32 character_id = 2; + string condition_name = 3; +} + +//Remove a Condition from a Chronicles of Darkness character sheet. +message RemoveConditionRequest { + string character_username = 1; + int32 character_id = 2; + string condition_name = 3; } \ No newline at end of file diff --git a/src/frontend/_proto/cofd_api_pb.d.ts b/src/frontend/_proto/cofd_api_pb.d.ts index a76e7d7..5e5909e 100644 --- a/src/frontend/_proto/cofd_api_pb.d.ts +++ b/src/frontend/_proto/cofd_api_pb.d.ts @@ -4,7 +4,7 @@ import * as jspb from "google-protobuf"; import * as cofd_pb from "./cofd_pb"; -export class BasicInfo extends jspb.Message { +export class UpdateBasicInfoRequest extends jspb.Message { getName(): string; setName(value: string): void; @@ -21,16 +21,16 @@ export class BasicInfo extends jspb.Message { setAge(value: number): void; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): BasicInfo.AsObject; - static toObject(includeInstance: boolean, msg: BasicInfo): BasicInfo.AsObject; + toObject(includeInstance?: boolean): UpdateBasicInfoRequest.AsObject; + static toObject(includeInstance: boolean, msg: UpdateBasicInfoRequest): UpdateBasicInfoRequest.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: BasicInfo, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): BasicInfo; - static deserializeBinaryFromReader(message: BasicInfo, reader: jspb.BinaryReader): BasicInfo; + static serializeBinaryToWriter(message: UpdateBasicInfoRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UpdateBasicInfoRequest; + static deserializeBinaryFromReader(message: UpdateBasicInfoRequest, reader: jspb.BinaryReader): UpdateBasicInfoRequest; } -export namespace BasicInfo { +export namespace UpdateBasicInfoRequest { export type AsObject = { name: string, gender: string, @@ -40,58 +40,6 @@ export namespace BasicInfo { } } -export class Attributes extends jspb.Message { - getStrength(): number; - setStrength(value: number): void; - - getDexterity(): number; - setDexterity(value: number): void; - - getStamina(): number; - setStamina(value: number): void; - - getIntelligence(): number; - setIntelligence(value: number): void; - - getWits(): number; - setWits(value: number): void; - - getResolve(): number; - setResolve(value: number): void; - - getPresence(): number; - setPresence(value: number): void; - - getManipulation(): number; - setManipulation(value: number): void; - - getComposure(): number; - setComposure(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Attributes.AsObject; - static toObject(includeInstance: boolean, msg: Attributes): Attributes.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Attributes, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Attributes; - static deserializeBinaryFromReader(message: Attributes, reader: jspb.BinaryReader): Attributes; -} - -export namespace Attributes { - export type AsObject = { - strength: number, - dexterity: number, - stamina: number, - intelligence: number, - wits: number, - resolve: number, - presence: number, - manipulation: number, - composure: number, - } -} - export class ApiResult extends jspb.Message { getSuccess(): boolean; setSuccess(value: boolean): void; @@ -148,43 +96,12 @@ export namespace UpdateAttributeRequest { } } -export class Skills extends jspb.Message { - clearPhysicalSkillsList(): void; - getPhysicalSkillsList(): Array; - setPhysicalSkillsList(value: Array): void; - addPhysicalSkills(value?: cofd_pb.CofdSheet.Skill, index?: number): cofd_pb.CofdSheet.Skill; +export class UpdateSkillRequest extends jspb.Message { + getCharacterUsername(): string; + setCharacterUsername(value: string): void; - clearMentalSkillsList(): void; - getMentalSkillsList(): Array; - setMentalSkillsList(value: Array): void; - addMentalSkills(value?: cofd_pb.CofdSheet.Skill, index?: number): cofd_pb.CofdSheet.Skill; - - clearSocialSkillsList(): void; - getSocialSkillsList(): Array; - setSocialSkillsList(value: Array): void; - addSocialSkills(value?: cofd_pb.CofdSheet.Skill, index?: number): cofd_pb.CofdSheet.Skill; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Skills.AsObject; - static toObject(includeInstance: boolean, msg: Skills): Skills.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Skills, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Skills; - static deserializeBinaryFromReader(message: Skills, reader: jspb.BinaryReader): Skills; -} - -export namespace Skills { - export type AsObject = { - physicalSkillsList: Array, - mentalSkillsList: Array, - socialSkillsList: Array, - } -} - -export class SkillUpdate extends jspb.Message { - getName(): string; - setName(value: string): void; + getCharacterId(): number; + setCharacterId(value: number): void; hasSkill(): boolean; clearSkill(): void; @@ -192,18 +109,19 @@ export class SkillUpdate extends jspb.Message { setSkill(value?: cofd_pb.CofdSheet.Skill): void; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SkillUpdate.AsObject; - static toObject(includeInstance: boolean, msg: SkillUpdate): SkillUpdate.AsObject; + toObject(includeInstance?: boolean): UpdateSkillRequest.AsObject; + static toObject(includeInstance: boolean, msg: UpdateSkillRequest): UpdateSkillRequest.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SkillUpdate, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SkillUpdate; - static deserializeBinaryFromReader(message: SkillUpdate, reader: jspb.BinaryReader): SkillUpdate; + static serializeBinaryToWriter(message: UpdateSkillRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UpdateSkillRequest; + static deserializeBinaryFromReader(message: UpdateSkillRequest, reader: jspb.BinaryReader): UpdateSkillRequest; } -export namespace SkillUpdate { +export namespace UpdateSkillRequest { export type AsObject = { - name: string, + characterUsername: string, + characterId: number, skill?: cofd_pb.CofdSheet.Skill.AsObject, } } @@ -240,7 +158,7 @@ export namespace UpdateSkillValueRequest { } } -export class SkillSpecializationsUpdate extends jspb.Message { +export class UpdateSkillSpecializationsRequest extends jspb.Message { getName(): string; setName(value: string): void; @@ -250,39 +168,75 @@ export class SkillSpecializationsUpdate extends jspb.Message { addSpecializations(value: string, index?: number): string; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SkillSpecializationsUpdate.AsObject; - static toObject(includeInstance: boolean, msg: SkillSpecializationsUpdate): SkillSpecializationsUpdate.AsObject; + toObject(includeInstance?: boolean): UpdateSkillSpecializationsRequest.AsObject; + static toObject(includeInstance: boolean, msg: UpdateSkillSpecializationsRequest): UpdateSkillSpecializationsRequest.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SkillSpecializationsUpdate, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SkillSpecializationsUpdate; - static deserializeBinaryFromReader(message: SkillSpecializationsUpdate, reader: jspb.BinaryReader): SkillSpecializationsUpdate; + static serializeBinaryToWriter(message: UpdateSkillSpecializationsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UpdateSkillSpecializationsRequest; + static deserializeBinaryFromReader(message: UpdateSkillSpecializationsRequest, reader: jspb.BinaryReader): UpdateSkillSpecializationsRequest; } -export namespace SkillSpecializationsUpdate { +export namespace UpdateSkillSpecializationsRequest { export type AsObject = { name: string, specializationsList: Array, } } -export class Condition extends jspb.Message { - getName(): string; - setName(value: string): void; +export class AddConditionRequest extends jspb.Message { + getCharacterUsername(): string; + setCharacterUsername(value: string): void; + + getCharacterId(): number; + setCharacterId(value: number): void; + + getConditionName(): string; + setConditionName(value: string): void; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Condition.AsObject; - static toObject(includeInstance: boolean, msg: Condition): Condition.AsObject; + toObject(includeInstance?: boolean): AddConditionRequest.AsObject; + static toObject(includeInstance: boolean, msg: AddConditionRequest): AddConditionRequest.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Condition, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Condition; - static deserializeBinaryFromReader(message: Condition, reader: jspb.BinaryReader): Condition; + static serializeBinaryToWriter(message: AddConditionRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AddConditionRequest; + static deserializeBinaryFromReader(message: AddConditionRequest, reader: jspb.BinaryReader): AddConditionRequest; } -export namespace Condition { +export namespace AddConditionRequest { export type AsObject = { - name: string, + characterUsername: string, + characterId: number, + conditionName: string, + } +} + +export class RemoveConditionRequest extends jspb.Message { + getCharacterUsername(): string; + setCharacterUsername(value: string): void; + + getCharacterId(): number; + setCharacterId(value: number): void; + + getConditionName(): string; + setConditionName(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RemoveConditionRequest.AsObject; + static toObject(includeInstance: boolean, msg: RemoveConditionRequest): RemoveConditionRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RemoveConditionRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RemoveConditionRequest; + static deserializeBinaryFromReader(message: RemoveConditionRequest, reader: jspb.BinaryReader): RemoveConditionRequest; +} + +export namespace RemoveConditionRequest { + export type AsObject = { + characterUsername: string, + characterId: number, + conditionName: string, } } diff --git a/src/frontend/_proto/cofd_api_pb.js b/src/frontend/_proto/cofd_api_pb.js index db51682..040db7c 100644 --- a/src/frontend/_proto/cofd_api_pb.js +++ b/src/frontend/_proto/cofd_api_pb.js @@ -16,14 +16,13 @@ var global = Function('return this')(); var cofd_pb = require('./cofd_pb.js'); goog.object.extend(proto, cofd_pb); +goog.exportSymbol('proto.models.proto.cofd.api.AddConditionRequest', null, global); goog.exportSymbol('proto.models.proto.cofd.api.ApiResult', null, global); -goog.exportSymbol('proto.models.proto.cofd.api.Attributes', null, global); -goog.exportSymbol('proto.models.proto.cofd.api.BasicInfo', null, global); -goog.exportSymbol('proto.models.proto.cofd.api.Condition', null, global); -goog.exportSymbol('proto.models.proto.cofd.api.SkillSpecializationsUpdate', null, global); -goog.exportSymbol('proto.models.proto.cofd.api.SkillUpdate', null, global); -goog.exportSymbol('proto.models.proto.cofd.api.Skills', null, global); +goog.exportSymbol('proto.models.proto.cofd.api.RemoveConditionRequest', null, global); goog.exportSymbol('proto.models.proto.cofd.api.UpdateAttributeRequest', null, global); +goog.exportSymbol('proto.models.proto.cofd.api.UpdateBasicInfoRequest', null, global); +goog.exportSymbol('proto.models.proto.cofd.api.UpdateSkillRequest', null, global); +goog.exportSymbol('proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest', null, global); goog.exportSymbol('proto.models.proto.cofd.api.UpdateSkillValueRequest', null, global); /** * Generated by JsPbCodeGenerator. @@ -35,37 +34,16 @@ goog.exportSymbol('proto.models.proto.cofd.api.UpdateSkillValueRequest', null, g * @extends {jspb.Message} * @constructor */ -proto.models.proto.cofd.api.BasicInfo = function(opt_data) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.models.proto.cofd.api.BasicInfo, jspb.Message); +goog.inherits(proto.models.proto.cofd.api.UpdateBasicInfoRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.models.proto.cofd.api.BasicInfo.displayName = 'proto.models.proto.cofd.api.BasicInfo'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.models.proto.cofd.api.Attributes = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.models.proto.cofd.api.Attributes, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.models.proto.cofd.api.Attributes.displayName = 'proto.models.proto.cofd.api.Attributes'; + proto.models.proto.cofd.api.UpdateBasicInfoRequest.displayName = 'proto.models.proto.cofd.api.UpdateBasicInfoRequest'; } /** * Generated by JsPbCodeGenerator. @@ -119,37 +97,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.models.proto.cofd.api.Skills = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.models.proto.cofd.api.Skills.repeatedFields_, null); -}; -goog.inherits(proto.models.proto.cofd.api.Skills, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.models.proto.cofd.api.Skills.displayName = 'proto.models.proto.cofd.api.Skills'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.models.proto.cofd.api.SkillUpdate = function(opt_data) { +proto.models.proto.cofd.api.UpdateSkillRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.models.proto.cofd.api.SkillUpdate, jspb.Message); +goog.inherits(proto.models.proto.cofd.api.UpdateSkillRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.models.proto.cofd.api.SkillUpdate.displayName = 'proto.models.proto.cofd.api.SkillUpdate'; + proto.models.proto.cofd.api.UpdateSkillRequest.displayName = 'proto.models.proto.cofd.api.UpdateSkillRequest'; } /** * Generated by JsPbCodeGenerator. @@ -182,16 +139,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.models.proto.cofd.api.SkillSpecializationsUpdate.repeatedFields_, null); +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.repeatedFields_, null); }; -goog.inherits(proto.models.proto.cofd.api.SkillSpecializationsUpdate, jspb.Message); +goog.inherits(proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.models.proto.cofd.api.SkillSpecializationsUpdate.displayName = 'proto.models.proto.cofd.api.SkillSpecializationsUpdate'; + proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.displayName = 'proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -203,16 +160,37 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.models.proto.cofd.api.Condition = function(opt_data) { +proto.models.proto.cofd.api.AddConditionRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.models.proto.cofd.api.Condition, jspb.Message); +goog.inherits(proto.models.proto.cofd.api.AddConditionRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.models.proto.cofd.api.Condition.displayName = 'proto.models.proto.cofd.api.Condition'; + proto.models.proto.cofd.api.AddConditionRequest.displayName = 'proto.models.proto.cofd.api.AddConditionRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.models.proto.cofd.api.RemoveConditionRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.models.proto.cofd.api.RemoveConditionRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.models.proto.cofd.api.RemoveConditionRequest.displayName = 'proto.models.proto.cofd.api.RemoveConditionRequest'; } @@ -230,8 +208,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.models.proto.cofd.api.BasicInfo.prototype.toObject = function(opt_includeInstance) { - return proto.models.proto.cofd.api.BasicInfo.toObject(opt_includeInstance, this); +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.toObject = function(opt_includeInstance) { + return proto.models.proto.cofd.api.UpdateBasicInfoRequest.toObject(opt_includeInstance, this); }; @@ -240,11 +218,11 @@ proto.models.proto.cofd.api.BasicInfo.prototype.toObject = function(opt_includeI * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.models.proto.cofd.api.BasicInfo} msg The msg instance to transform. + * @param {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.models.proto.cofd.api.BasicInfo.toObject = function(includeInstance, msg) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), gender: jspb.Message.getFieldWithDefault(msg, 2, ""), @@ -264,23 +242,23 @@ proto.models.proto.cofd.api.BasicInfo.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.models.proto.cofd.api.BasicInfo} + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} */ -proto.models.proto.cofd.api.BasicInfo.deserializeBinary = function(bytes) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.models.proto.cofd.api.BasicInfo; - return proto.models.proto.cofd.api.BasicInfo.deserializeBinaryFromReader(msg, reader); + var msg = new proto.models.proto.cofd.api.UpdateBasicInfoRequest; + return proto.models.proto.cofd.api.UpdateBasicInfoRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.models.proto.cofd.api.BasicInfo} msg The message object to deserialize into. + * @param {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.models.proto.cofd.api.BasicInfo} + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} */ -proto.models.proto.cofd.api.BasicInfo.deserializeBinaryFromReader = function(msg, reader) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -320,9 +298,9 @@ proto.models.proto.cofd.api.BasicInfo.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.models.proto.cofd.api.BasicInfo.prototype.serializeBinary = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.models.proto.cofd.api.BasicInfo.serializeBinaryToWriter(this, writer); + proto.models.proto.cofd.api.UpdateBasicInfoRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -330,11 +308,11 @@ proto.models.proto.cofd.api.BasicInfo.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.models.proto.cofd.api.BasicInfo} message + * @param {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.models.proto.cofd.api.BasicInfo.serializeBinaryToWriter = function(message, writer) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getName(); if (f.length > 0) { @@ -378,16 +356,16 @@ proto.models.proto.cofd.api.BasicInfo.serializeBinaryToWriter = function(message * optional string name = 1; * @return {string} */ -proto.models.proto.cofd.api.BasicInfo.prototype.getName = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.models.proto.cofd.api.BasicInfo} returns this + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.BasicInfo.prototype.setName = function(value) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setName = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -396,16 +374,16 @@ proto.models.proto.cofd.api.BasicInfo.prototype.setName = function(value) { * optional string gender = 2; * @return {string} */ -proto.models.proto.cofd.api.BasicInfo.prototype.getGender = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getGender = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value - * @return {!proto.models.proto.cofd.api.BasicInfo} returns this + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.BasicInfo.prototype.setGender = function(value) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setGender = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; @@ -414,16 +392,16 @@ proto.models.proto.cofd.api.BasicInfo.prototype.setGender = function(value) { * optional string concept = 3; * @return {string} */ -proto.models.proto.cofd.api.BasicInfo.prototype.getConcept = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getConcept = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value - * @return {!proto.models.proto.cofd.api.BasicInfo} returns this + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.BasicInfo.prototype.setConcept = function(value) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setConcept = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; @@ -432,16 +410,16 @@ proto.models.proto.cofd.api.BasicInfo.prototype.setConcept = function(value) { * optional string chronicle = 4; * @return {string} */ -proto.models.proto.cofd.api.BasicInfo.prototype.getChronicle = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getChronicle = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value - * @return {!proto.models.proto.cofd.api.BasicInfo} returns this + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.BasicInfo.prototype.setChronicle = function(value) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setChronicle = function(value) { return jspb.Message.setProto3StringField(this, 4, value); }; @@ -450,16 +428,16 @@ proto.models.proto.cofd.api.BasicInfo.prototype.setChronicle = function(value) { * optional int32 age = 5; * @return {number} */ -proto.models.proto.cofd.api.BasicInfo.prototype.getAge = function() { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getAge = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** * @param {number} value - * @return {!proto.models.proto.cofd.api.BasicInfo} returns this + * @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this */ -proto.models.proto.cofd.api.BasicInfo.prototype.setAge = function(value) { +proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setAge = function(value) { return jspb.Message.setProto3IntField(this, 5, value); }; @@ -467,376 +445,6 @@ proto.models.proto.cofd.api.BasicInfo.prototype.setAge = function(value) { -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.models.proto.cofd.api.Attributes.prototype.toObject = function(opt_includeInstance) { - return proto.models.proto.cofd.api.Attributes.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.models.proto.cofd.api.Attributes} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.models.proto.cofd.api.Attributes.toObject = function(includeInstance, msg) { - var f, obj = { - strength: jspb.Message.getFieldWithDefault(msg, 1, 0), - dexterity: jspb.Message.getFieldWithDefault(msg, 2, 0), - stamina: jspb.Message.getFieldWithDefault(msg, 3, 0), - intelligence: jspb.Message.getFieldWithDefault(msg, 4, 0), - wits: jspb.Message.getFieldWithDefault(msg, 5, 0), - resolve: jspb.Message.getFieldWithDefault(msg, 6, 0), - presence: jspb.Message.getFieldWithDefault(msg, 7, 0), - manipulation: jspb.Message.getFieldWithDefault(msg, 8, 0), - composure: jspb.Message.getFieldWithDefault(msg, 9, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.models.proto.cofd.api.Attributes} - */ -proto.models.proto.cofd.api.Attributes.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.models.proto.cofd.api.Attributes; - return proto.models.proto.cofd.api.Attributes.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.models.proto.cofd.api.Attributes} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.models.proto.cofd.api.Attributes} - */ -proto.models.proto.cofd.api.Attributes.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setStrength(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt32()); - msg.setDexterity(value); - break; - case 3: - var value = /** @type {number} */ (reader.readInt32()); - msg.setStamina(value); - break; - case 4: - var value = /** @type {number} */ (reader.readInt32()); - msg.setIntelligence(value); - break; - case 5: - var value = /** @type {number} */ (reader.readInt32()); - msg.setWits(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt32()); - msg.setResolve(value); - break; - case 7: - var value = /** @type {number} */ (reader.readInt32()); - msg.setPresence(value); - break; - case 8: - var value = /** @type {number} */ (reader.readInt32()); - msg.setManipulation(value); - break; - case 9: - var value = /** @type {number} */ (reader.readInt32()); - msg.setComposure(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.models.proto.cofd.api.Attributes.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.models.proto.cofd.api.Attributes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.models.proto.cofd.api.Attributes} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.models.proto.cofd.api.Attributes.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getStrength(); - if (f !== 0) { - writer.writeInt32( - 1, - f - ); - } - f = message.getDexterity(); - if (f !== 0) { - writer.writeInt32( - 2, - f - ); - } - f = message.getStamina(); - if (f !== 0) { - writer.writeInt32( - 3, - f - ); - } - f = message.getIntelligence(); - if (f !== 0) { - writer.writeInt32( - 4, - f - ); - } - f = message.getWits(); - if (f !== 0) { - writer.writeInt32( - 5, - f - ); - } - f = message.getResolve(); - if (f !== 0) { - writer.writeInt32( - 6, - f - ); - } - f = message.getPresence(); - if (f !== 0) { - writer.writeInt32( - 7, - f - ); - } - f = message.getManipulation(); - if (f !== 0) { - writer.writeInt32( - 8, - f - ); - } - f = message.getComposure(); - if (f !== 0) { - writer.writeInt32( - 9, - f - ); - } -}; - - -/** - * optional int32 strength = 1; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getStrength = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setStrength = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional int32 dexterity = 2; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getDexterity = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setDexterity = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional int32 stamina = 3; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getStamina = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setStamina = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional int32 intelligence = 4; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getIntelligence = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setIntelligence = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); -}; - - -/** - * optional int32 wits = 5; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getWits = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setWits = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional int32 resolve = 6; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getResolve = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setResolve = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); -}; - - -/** - * optional int32 presence = 7; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getPresence = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setPresence = function(value) { - return jspb.Message.setProto3IntField(this, 7, value); -}; - - -/** - * optional int32 manipulation = 8; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getManipulation = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setManipulation = function(value) { - return jspb.Message.setProto3IntField(this, 8, value); -}; - - -/** - * optional int32 composure = 9; - * @return {number} - */ -proto.models.proto.cofd.api.Attributes.prototype.getComposure = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.models.proto.cofd.api.Attributes} returns this - */ -proto.models.proto.cofd.api.Attributes.prototype.setComposure = function(value) { - return jspb.Message.setProto3IntField(this, 9, value); -}; - - - - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -1215,13 +823,6 @@ proto.models.proto.cofd.api.UpdateAttributeRequest.prototype.setAttributeValue = -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.models.proto.cofd.api.Skills.repeatedFields_ = [1,2,3]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -1237,8 +838,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.models.proto.cofd.api.Skills.prototype.toObject = function(opt_includeInstance) { - return proto.models.proto.cofd.api.Skills.toObject(opt_includeInstance, this); +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.toObject = function(opt_includeInstance) { + return proto.models.proto.cofd.api.UpdateSkillRequest.toObject(opt_includeInstance, this); }; @@ -1247,272 +848,14 @@ proto.models.proto.cofd.api.Skills.prototype.toObject = function(opt_includeInst * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.models.proto.cofd.api.Skills} msg The msg instance to transform. + * @param {!proto.models.proto.cofd.api.UpdateSkillRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.models.proto.cofd.api.Skills.toObject = function(includeInstance, msg) { +proto.models.proto.cofd.api.UpdateSkillRequest.toObject = function(includeInstance, msg) { var f, obj = { - physicalSkillsList: jspb.Message.toObjectList(msg.getPhysicalSkillsList(), - cofd_pb.CofdSheet.Skill.toObject, includeInstance), - mentalSkillsList: jspb.Message.toObjectList(msg.getMentalSkillsList(), - cofd_pb.CofdSheet.Skill.toObject, includeInstance), - socialSkillsList: jspb.Message.toObjectList(msg.getSocialSkillsList(), - cofd_pb.CofdSheet.Skill.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.models.proto.cofd.api.Skills} - */ -proto.models.proto.cofd.api.Skills.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.models.proto.cofd.api.Skills; - return proto.models.proto.cofd.api.Skills.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.models.proto.cofd.api.Skills} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.models.proto.cofd.api.Skills} - */ -proto.models.proto.cofd.api.Skills.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new cofd_pb.CofdSheet.Skill; - reader.readMessage(value,cofd_pb.CofdSheet.Skill.deserializeBinaryFromReader); - msg.addPhysicalSkills(value); - break; - case 2: - var value = new cofd_pb.CofdSheet.Skill; - reader.readMessage(value,cofd_pb.CofdSheet.Skill.deserializeBinaryFromReader); - msg.addMentalSkills(value); - break; - case 3: - var value = new cofd_pb.CofdSheet.Skill; - reader.readMessage(value,cofd_pb.CofdSheet.Skill.deserializeBinaryFromReader); - msg.addSocialSkills(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.models.proto.cofd.api.Skills.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.models.proto.cofd.api.Skills.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.models.proto.cofd.api.Skills} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.models.proto.cofd.api.Skills.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPhysicalSkillsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - cofd_pb.CofdSheet.Skill.serializeBinaryToWriter - ); - } - f = message.getMentalSkillsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 2, - f, - cofd_pb.CofdSheet.Skill.serializeBinaryToWriter - ); - } - f = message.getSocialSkillsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 3, - f, - cofd_pb.CofdSheet.Skill.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated models.proto.cofd.CofdSheet.Skill physical_skills = 1; - * @return {!Array} - */ -proto.models.proto.cofd.api.Skills.prototype.getPhysicalSkillsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, cofd_pb.CofdSheet.Skill, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.models.proto.cofd.api.Skills} returns this -*/ -proto.models.proto.cofd.api.Skills.prototype.setPhysicalSkillsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.models.proto.cofd.CofdSheet.Skill=} opt_value - * @param {number=} opt_index - * @return {!proto.models.proto.cofd.CofdSheet.Skill} - */ -proto.models.proto.cofd.api.Skills.prototype.addPhysicalSkills = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.models.proto.cofd.CofdSheet.Skill, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.models.proto.cofd.api.Skills} returns this - */ -proto.models.proto.cofd.api.Skills.prototype.clearPhysicalSkillsList = function() { - return this.setPhysicalSkillsList([]); -}; - - -/** - * repeated models.proto.cofd.CofdSheet.Skill mental_skills = 2; - * @return {!Array} - */ -proto.models.proto.cofd.api.Skills.prototype.getMentalSkillsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, cofd_pb.CofdSheet.Skill, 2)); -}; - - -/** - * @param {!Array} value - * @return {!proto.models.proto.cofd.api.Skills} returns this -*/ -proto.models.proto.cofd.api.Skills.prototype.setMentalSkillsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 2, value); -}; - - -/** - * @param {!proto.models.proto.cofd.CofdSheet.Skill=} opt_value - * @param {number=} opt_index - * @return {!proto.models.proto.cofd.CofdSheet.Skill} - */ -proto.models.proto.cofd.api.Skills.prototype.addMentalSkills = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.models.proto.cofd.CofdSheet.Skill, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.models.proto.cofd.api.Skills} returns this - */ -proto.models.proto.cofd.api.Skills.prototype.clearMentalSkillsList = function() { - return this.setMentalSkillsList([]); -}; - - -/** - * repeated models.proto.cofd.CofdSheet.Skill social_skills = 3; - * @return {!Array} - */ -proto.models.proto.cofd.api.Skills.prototype.getSocialSkillsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, cofd_pb.CofdSheet.Skill, 3)); -}; - - -/** - * @param {!Array} value - * @return {!proto.models.proto.cofd.api.Skills} returns this -*/ -proto.models.proto.cofd.api.Skills.prototype.setSocialSkillsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 3, value); -}; - - -/** - * @param {!proto.models.proto.cofd.CofdSheet.Skill=} opt_value - * @param {number=} opt_index - * @return {!proto.models.proto.cofd.CofdSheet.Skill} - */ -proto.models.proto.cofd.api.Skills.prototype.addSocialSkills = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.models.proto.cofd.CofdSheet.Skill, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.models.proto.cofd.api.Skills} returns this - */ -proto.models.proto.cofd.api.Skills.prototype.clearSocialSkillsList = function() { - return this.setSocialSkillsList([]); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.models.proto.cofd.api.SkillUpdate.prototype.toObject = function(opt_includeInstance) { - return proto.models.proto.cofd.api.SkillUpdate.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.models.proto.cofd.api.SkillUpdate} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.models.proto.cofd.api.SkillUpdate.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, ""), + characterUsername: jspb.Message.getFieldWithDefault(msg, 1, ""), + characterId: jspb.Message.getFieldWithDefault(msg, 2, 0), skill: (f = msg.getSkill()) && cofd_pb.CofdSheet.Skill.toObject(includeInstance, f) }; @@ -1527,23 +870,23 @@ proto.models.proto.cofd.api.SkillUpdate.toObject = function(includeInstance, msg /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.models.proto.cofd.api.SkillUpdate} + * @return {!proto.models.proto.cofd.api.UpdateSkillRequest} */ -proto.models.proto.cofd.api.SkillUpdate.deserializeBinary = function(bytes) { +proto.models.proto.cofd.api.UpdateSkillRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.models.proto.cofd.api.SkillUpdate; - return proto.models.proto.cofd.api.SkillUpdate.deserializeBinaryFromReader(msg, reader); + var msg = new proto.models.proto.cofd.api.UpdateSkillRequest; + return proto.models.proto.cofd.api.UpdateSkillRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.models.proto.cofd.api.SkillUpdate} msg The message object to deserialize into. + * @param {!proto.models.proto.cofd.api.UpdateSkillRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.models.proto.cofd.api.SkillUpdate} + * @return {!proto.models.proto.cofd.api.UpdateSkillRequest} */ -proto.models.proto.cofd.api.SkillUpdate.deserializeBinaryFromReader = function(msg, reader) { +proto.models.proto.cofd.api.UpdateSkillRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1552,9 +895,13 @@ proto.models.proto.cofd.api.SkillUpdate.deserializeBinaryFromReader = function(m switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); - msg.setName(value); + msg.setCharacterUsername(value); break; case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCharacterId(value); + break; + case 3: var value = new cofd_pb.CofdSheet.Skill; reader.readMessage(value,cofd_pb.CofdSheet.Skill.deserializeBinaryFromReader); msg.setSkill(value); @@ -1572,9 +919,9 @@ proto.models.proto.cofd.api.SkillUpdate.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.models.proto.cofd.api.SkillUpdate.prototype.serializeBinary = function() { +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.models.proto.cofd.api.SkillUpdate.serializeBinaryToWriter(this, writer); + proto.models.proto.cofd.api.UpdateSkillRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1582,23 +929,30 @@ proto.models.proto.cofd.api.SkillUpdate.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.models.proto.cofd.api.SkillUpdate} message + * @param {!proto.models.proto.cofd.api.UpdateSkillRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.models.proto.cofd.api.SkillUpdate.serializeBinaryToWriter = function(message, writer) { +proto.models.proto.cofd.api.UpdateSkillRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getName(); + f = message.getCharacterUsername(); if (f.length > 0) { writer.writeString( 1, f ); } + f = message.getCharacterId(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } f = message.getSkill(); if (f != null) { writer.writeMessage( - 2, + 3, f, cofd_pb.CofdSheet.Skill.serializeBinaryToWriter ); @@ -1607,47 +961,65 @@ proto.models.proto.cofd.api.SkillUpdate.serializeBinaryToWriter = function(messa /** - * optional string name = 1; + * optional string character_username = 1; * @return {string} */ -proto.models.proto.cofd.api.SkillUpdate.prototype.getName = function() { +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.getCharacterUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.models.proto.cofd.api.SkillUpdate} returns this + * @return {!proto.models.proto.cofd.api.UpdateSkillRequest} returns this */ -proto.models.proto.cofd.api.SkillUpdate.prototype.setName = function(value) { +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.setCharacterUsername = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** - * optional models.proto.cofd.CofdSheet.Skill skill = 2; + * optional int32 character_id = 2; + * @return {number} + */ +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.getCharacterId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.models.proto.cofd.api.UpdateSkillRequest} returns this + */ +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.setCharacterId = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional models.proto.cofd.CofdSheet.Skill skill = 3; * @return {?proto.models.proto.cofd.CofdSheet.Skill} */ -proto.models.proto.cofd.api.SkillUpdate.prototype.getSkill = function() { +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.getSkill = function() { return /** @type{?proto.models.proto.cofd.CofdSheet.Skill} */ ( - jspb.Message.getWrapperField(this, cofd_pb.CofdSheet.Skill, 2)); + jspb.Message.getWrapperField(this, cofd_pb.CofdSheet.Skill, 3)); }; /** * @param {?proto.models.proto.cofd.CofdSheet.Skill|undefined} value - * @return {!proto.models.proto.cofd.api.SkillUpdate} returns this + * @return {!proto.models.proto.cofd.api.UpdateSkillRequest} returns this */ -proto.models.proto.cofd.api.SkillUpdate.prototype.setSkill = function(value) { - return jspb.Message.setWrapperField(this, 2, value); +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.setSkill = function(value) { + return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. - * @return {!proto.models.proto.cofd.api.SkillUpdate} returns this + * @return {!proto.models.proto.cofd.api.UpdateSkillRequest} returns this */ -proto.models.proto.cofd.api.SkillUpdate.prototype.clearSkill = function() { +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.clearSkill = function() { return this.setSkill(undefined); }; @@ -1656,8 +1028,8 @@ proto.models.proto.cofd.api.SkillUpdate.prototype.clearSkill = function() { * Returns whether this field is set. * @return {boolean} */ -proto.models.proto.cofd.api.SkillUpdate.prototype.hasSkill = function() { - return jspb.Message.getField(this, 2) != null; +proto.models.proto.cofd.api.UpdateSkillRequest.prototype.hasSkill = function() { + return jspb.Message.getField(this, 3) != null; }; @@ -1887,7 +1259,7 @@ proto.models.proto.cofd.api.UpdateSkillValueRequest.prototype.setSkillValue = fu * @private {!Array} * @const */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.repeatedFields_ = [2]; +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.repeatedFields_ = [2]; @@ -1904,8 +1276,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.toObject = function(opt_includeInstance) { - return proto.models.proto.cofd.api.SkillSpecializationsUpdate.toObject(opt_includeInstance, this); +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.toObject(opt_includeInstance, this); }; @@ -1914,11 +1286,11 @@ proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.toObject = func * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} msg The msg instance to transform. + * @param {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.toObject = function(includeInstance, msg) { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.toObject = function(includeInstance, msg) { var f, obj = { name: jspb.Message.getFieldWithDefault(msg, 1, ""), specializationsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f @@ -1935,23 +1307,23 @@ proto.models.proto.cofd.api.SkillSpecializationsUpdate.toObject = function(inclu /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} + * @return {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.deserializeBinary = function(bytes) { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.models.proto.cofd.api.SkillSpecializationsUpdate; - return proto.models.proto.cofd.api.SkillSpecializationsUpdate.deserializeBinaryFromReader(msg, reader); + var msg = new proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest; + return proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} msg The message object to deserialize into. + * @param {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} + * @return {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.deserializeBinaryFromReader = function(msg, reader) { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1979,9 +1351,9 @@ proto.models.proto.cofd.api.SkillSpecializationsUpdate.deserializeBinaryFromRead * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.serializeBinary = function() { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.models.proto.cofd.api.SkillSpecializationsUpdate.serializeBinaryToWriter(this, writer); + proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1989,11 +1361,11 @@ proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.serializeBinary /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} message + * @param {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.serializeBinaryToWriter = function(message, writer) { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getName(); if (f.length > 0) { @@ -2016,16 +1388,16 @@ proto.models.proto.cofd.api.SkillSpecializationsUpdate.serializeBinaryToWriter = * optional string name = 1; * @return {string} */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.getName = function() { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} returns this + * @return {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} returns this */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.setName = function(value) { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.prototype.setName = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -2034,16 +1406,16 @@ proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.setName = funct * repeated string specializations = 2; * @return {!Array} */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.getSpecializationsList = function() { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.prototype.getSpecializationsList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** * @param {!Array} value - * @return {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} returns this + * @return {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} returns this */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.setSpecializationsList = function(value) { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.prototype.setSpecializationsList = function(value) { return jspb.Message.setField(this, 2, value || []); }; @@ -2051,18 +1423,18 @@ proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.setSpecializati /** * @param {string} value * @param {number=} opt_index - * @return {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} returns this + * @return {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} returns this */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.addSpecializations = function(value, opt_index) { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.prototype.addSpecializations = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.models.proto.cofd.api.SkillSpecializationsUpdate} returns this + * @return {!proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest} returns this */ -proto.models.proto.cofd.api.SkillSpecializationsUpdate.prototype.clearSpecializationsList = function() { +proto.models.proto.cofd.api.UpdateSkillSpecializationsRequest.prototype.clearSpecializationsList = function() { return this.setSpecializationsList([]); }; @@ -2083,8 +1455,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.models.proto.cofd.api.Condition.prototype.toObject = function(opt_includeInstance) { - return proto.models.proto.cofd.api.Condition.toObject(opt_includeInstance, this); +proto.models.proto.cofd.api.AddConditionRequest.prototype.toObject = function(opt_includeInstance) { + return proto.models.proto.cofd.api.AddConditionRequest.toObject(opt_includeInstance, this); }; @@ -2093,13 +1465,15 @@ proto.models.proto.cofd.api.Condition.prototype.toObject = function(opt_includeI * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.models.proto.cofd.api.Condition} msg The msg instance to transform. + * @param {!proto.models.proto.cofd.api.AddConditionRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.models.proto.cofd.api.Condition.toObject = function(includeInstance, msg) { +proto.models.proto.cofd.api.AddConditionRequest.toObject = function(includeInstance, msg) { var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, "") + characterUsername: jspb.Message.getFieldWithDefault(msg, 1, ""), + characterId: jspb.Message.getFieldWithDefault(msg, 2, 0), + conditionName: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -2113,23 +1487,23 @@ proto.models.proto.cofd.api.Condition.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.models.proto.cofd.api.Condition} + * @return {!proto.models.proto.cofd.api.AddConditionRequest} */ -proto.models.proto.cofd.api.Condition.deserializeBinary = function(bytes) { +proto.models.proto.cofd.api.AddConditionRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.models.proto.cofd.api.Condition; - return proto.models.proto.cofd.api.Condition.deserializeBinaryFromReader(msg, reader); + var msg = new proto.models.proto.cofd.api.AddConditionRequest; + return proto.models.proto.cofd.api.AddConditionRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.models.proto.cofd.api.Condition} msg The message object to deserialize into. + * @param {!proto.models.proto.cofd.api.AddConditionRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.models.proto.cofd.api.Condition} + * @return {!proto.models.proto.cofd.api.AddConditionRequest} */ -proto.models.proto.cofd.api.Condition.deserializeBinaryFromReader = function(msg, reader) { +proto.models.proto.cofd.api.AddConditionRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2138,7 +1512,15 @@ proto.models.proto.cofd.api.Condition.deserializeBinaryFromReader = function(msg switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); - msg.setName(value); + msg.setCharacterUsername(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCharacterId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setConditionName(value); break; default: reader.skipField(); @@ -2153,9 +1535,9 @@ proto.models.proto.cofd.api.Condition.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.models.proto.cofd.api.Condition.prototype.serializeBinary = function() { +proto.models.proto.cofd.api.AddConditionRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.models.proto.cofd.api.Condition.serializeBinaryToWriter(this, writer); + proto.models.proto.cofd.api.AddConditionRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2163,38 +1545,278 @@ proto.models.proto.cofd.api.Condition.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.models.proto.cofd.api.Condition} message + * @param {!proto.models.proto.cofd.api.AddConditionRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.models.proto.cofd.api.Condition.serializeBinaryToWriter = function(message, writer) { +proto.models.proto.cofd.api.AddConditionRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getName(); + f = message.getCharacterUsername(); if (f.length > 0) { writer.writeString( 1, f ); } + f = message.getCharacterId(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getConditionName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } }; /** - * optional string name = 1; + * optional string character_username = 1; * @return {string} */ -proto.models.proto.cofd.api.Condition.prototype.getName = function() { +proto.models.proto.cofd.api.AddConditionRequest.prototype.getCharacterUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.models.proto.cofd.api.Condition} returns this + * @return {!proto.models.proto.cofd.api.AddConditionRequest} returns this */ -proto.models.proto.cofd.api.Condition.prototype.setName = function(value) { +proto.models.proto.cofd.api.AddConditionRequest.prototype.setCharacterUsername = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; +/** + * optional int32 character_id = 2; + * @return {number} + */ +proto.models.proto.cofd.api.AddConditionRequest.prototype.getCharacterId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.models.proto.cofd.api.AddConditionRequest} returns this + */ +proto.models.proto.cofd.api.AddConditionRequest.prototype.setCharacterId = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional string condition_name = 3; + * @return {string} + */ +proto.models.proto.cofd.api.AddConditionRequest.prototype.getConditionName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.models.proto.cofd.api.AddConditionRequest} returns this + */ +proto.models.proto.cofd.api.AddConditionRequest.prototype.setConditionName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.models.proto.cofd.api.RemoveConditionRequest.prototype.toObject = function(opt_includeInstance) { + return proto.models.proto.cofd.api.RemoveConditionRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.models.proto.cofd.api.RemoveConditionRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.models.proto.cofd.api.RemoveConditionRequest.toObject = function(includeInstance, msg) { + var f, obj = { + characterUsername: jspb.Message.getFieldWithDefault(msg, 1, ""), + characterId: jspb.Message.getFieldWithDefault(msg, 2, 0), + conditionName: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.models.proto.cofd.api.RemoveConditionRequest} + */ +proto.models.proto.cofd.api.RemoveConditionRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.models.proto.cofd.api.RemoveConditionRequest; + return proto.models.proto.cofd.api.RemoveConditionRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.models.proto.cofd.api.RemoveConditionRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.models.proto.cofd.api.RemoveConditionRequest} + */ +proto.models.proto.cofd.api.RemoveConditionRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setCharacterUsername(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCharacterId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setConditionName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.models.proto.cofd.api.RemoveConditionRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.models.proto.cofd.api.RemoveConditionRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.models.proto.cofd.api.RemoveConditionRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.models.proto.cofd.api.RemoveConditionRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCharacterUsername(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getCharacterId(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getConditionName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string character_username = 1; + * @return {string} + */ +proto.models.proto.cofd.api.RemoveConditionRequest.prototype.getCharacterUsername = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.models.proto.cofd.api.RemoveConditionRequest} returns this + */ +proto.models.proto.cofd.api.RemoveConditionRequest.prototype.setCharacterUsername = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional int32 character_id = 2; + * @return {number} + */ +proto.models.proto.cofd.api.RemoveConditionRequest.prototype.getCharacterId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.models.proto.cofd.api.RemoveConditionRequest} returns this + */ +proto.models.proto.cofd.api.RemoveConditionRequest.prototype.setCharacterId = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional string condition_name = 3; + * @return {string} + */ +proto.models.proto.cofd.api.RemoveConditionRequest.prototype.getConditionName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.models.proto.cofd.api.RemoveConditionRequest} returns this + */ +proto.models.proto.cofd.api.RemoveConditionRequest.prototype.setConditionName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + goog.object.extend(exports, proto.models.proto.cofd.api); diff --git a/src/frontend/scripts/api.ts b/src/frontend/scripts/api.ts index 2e33fbe..d809210 100644 --- a/src/frontend/scripts/api.ts +++ b/src/frontend/scripts/api.ts @@ -1,6 +1,5 @@ import * as jspb from "google-protobuf"; -import { CofdSheet } from "../_proto/cofd_pb"; -import { Skills, ApiResult, UpdateAttributeRequest, UpdateSkillValueRequest } from "../_proto/cofd_api_pb"; +import { ApiResult, UpdateAttributeRequest, UpdateSkillValueRequest } from "../_proto/cofd_api_pb"; const PROTOBUF_CONTENT_TYPE = { 'Content-Type': 'application/x-protobuf' }; diff --git a/src/routes/api.rs b/src/routes/api.rs index ecf7360..fc74052 100644 --- a/src/routes/api.rs +++ b/src/routes/api.rs @@ -8,9 +8,8 @@ mod cofd; pub(crate) fn routes() -> Vec { routes![ cofd::update_basic_info, - cofd::update_attributes, cofd::update_attribute_value, - cofd::update_skills, + cofd::update_skill, cofd::update_skill_value, cofd::add_condition, cofd::remove_condition diff --git a/src/routes/api/cofd.rs b/src/routes/api/cofd.rs index 1b4398d..5553502 100644 --- a/src/routes/api/cofd.rs +++ b/src/routes/api/cofd.rs @@ -37,21 +37,8 @@ fn find_skill<'a>(sheet: &'a mut CofdSheet, skill_name: &'a str) -> Option<&'a m find_skill_entry(sheet, skill_name).map(|entry| entry.into_mut()) } -#[post("/cofd///basic-info", data = "")] -pub(super) fn update_basic_info<'a>( - owner: String, - character_id: i32, - info: Proto, -) -> &'a str { - "lol" -} - -#[post("/cofd///attributes", data = "")] -pub(super) fn update_attributes<'a>( - owner: String, - character_id: i32, - info: Proto, -) -> &'a str { +#[post("/rpc/cofd/update_basic_info", data = "")] +pub(super) fn update_basic_info<'a>(info: Proto) -> &'a str { "lol" } @@ -92,22 +79,23 @@ pub(super) async fn update_attribute_value( })) } -#[patch( - "/cofd///skills", - data = "", - rank = 1 -)] -pub(super) async fn update_skills<'a>( - owner: String, - character_id: i32, - skill_update: Proto, +#[patch("/rpc/cofd/update_skill", data = "")] +pub(super) async fn update_skill<'a>( + skill_update: Proto, conn: TenebrousDbConn<'_>, logged_in_user: Option<&User>, ) -> Result<&'a str, Error> { - let mut character = load_character(&conn, logged_in_user, &owner, character_id).await?; + let mut character = load_character( + &conn, + logged_in_user, + &skill_update.character_username, + skill_update.character_id, + ) + .await?; + let mut sheet: CofdSheet = character.try_deserialize()?; let updated_skill: &Skill = skill_update.skill.as_ref().ok_or(Error::InvalidInput)?; - let skill_entry = find_skill_entry(&mut sheet, &skill_update.name); + let skill_entry = find_skill_entry(&mut sheet, &updated_skill.name); skill_entry .map(|mut entry| entry.insert(updated_skill.clone())) @@ -115,7 +103,7 @@ pub(super) async fn update_skills<'a>( println!( "updated skill {} with {:?}", - skill_update.name, skill_update.skill + updated_skill.name, skill_update.skill ); character.update_data(&sheet)?; @@ -145,9 +133,7 @@ pub(super) async fn update_skill_value<'a>( s.dots = request.skill_value; } - let updated_skill: Skill = skill.map(|s| s.clone()).ok_or(Error::InvalidInput)?; - - println!("updated skill value",); + println!("updated skill value"); character.update_data(&sheet)?; conn.update_character_sheet(&character).await?; @@ -157,20 +143,12 @@ pub(super) async fn update_skill_value<'a>( })) } -#[put("/cofd///conditions", data = "")] -pub(super) fn add_condition<'a>( - owner: String, - character_id: i32, - info: Proto, -) -> &'a str { +#[put("/rpc/cofd/add_condition", data = "")] +pub(super) fn add_condition<'a>(info: Proto) -> &'a str { "lol" } -#[delete("/cofd///conditions", data = "")] -pub(super) fn remove_condition<'a>( - owner: String, - character_id: i32, - info: Proto, -) -> &'a str { +#[delete("/rpc/cofd/remove_condition", data = "")] +pub(super) fn remove_condition<'a>(info: Proto) -> &'a str { "lol" }