Skip to content

Instantly share code, notes, and snippets.

@c-bata
Last active September 11, 2023 22:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c-bata/876c088e1c00a2237ee1352f02da192a to your computer and use it in GitHub Desktop.
Save c-bata/876c088e1c00a2237ee1352f02da192a to your computer and use it in GitHub Desktop.
Try to deserialize protobuf binary using decodeIO/protobuf.js

How to reproduce

Use from proto.

import protobuf from "protobufjs";

// omit

export const ProfileActionCreators = {
    fetchProfile(){
        fetch("http://example.com/profile/").then((response) => {
            return response.arrayBuffer()
        }).then((b) => {
            const bytes = new Uint8Array(b);
            console.log(bytes);
            protobuf.load("awesome.proto", function(err, root) {
              let Message = root.lookupType("instagram.ConfirmProfileResponse");
              console.log(Message.decode(bytes));
            }
        }).catch((error) => {
            console.log(error);
        });
    },
};

Use from json.

$ pbjs -t json ./proto/profile.proto > bundle.json
import protobuf from "protobufjs";

// omit

export const ProfileActionCreators = {
    fetchProfile(){
        fetch("http://example.com/profile/").then((response) => {
            return response.arrayBuffer()
        }).then((b) => {
            const bytes = new Uint8Array(b);
            console.log(bytes);
            const root = protobuf.Root.fromJSON(require("../bundle.json"));
            let Message = root.lookupType("instagram.ConfirmProfileResponse");
            console.log(Message.decode(bytes));
        }).catch((error) => {
            console.log(error);
        });
    },
};

Use from es6 static module.

$ pbjs --es6 -t static-module ./proto/profile.proto > bundle.js
import * as proto from '../bundle';

// omit

export const ProfileActionCreators = {
    fetchProfile(){
        fetch("http://example.com/profile/").then((response) => {
            return response.arrayBuffer()
        }).then((b) => {
            const bytes = new Uint8Array(b);
            console.log(bytes);
            console.log(proto.instagram.ConfirmProfileResponse.decode(bytes));
        }).catch((error) => {
            console.log(error);
        });
    },
};
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/
import * as $protobuf from "protobufjs";
// Common aliases
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
export const instagram = $root.instagram = (() => {
/**
* Namespace instagram.
* @exports instagram
* @namespace
*/
const instagram = {};
instagram.ConfirmProfileResponse = (function() {
/**
* Properties of a ConfirmProfileResponse.
* @typedef instagram.ConfirmProfileResponse$Properties
* @type {Object}
* @property {boolean} [hasProfile] ConfirmProfileResponse hasProfile.
* @property {instagram.ProfileResponse$Properties} [profile] ConfirmProfileResponse profile.
*/
/**
* Constructs a new ConfirmProfileResponse.
* @exports instagram.ConfirmProfileResponse
* @constructor
* @param {instagram.ConfirmProfileResponse$Properties=} [properties] Properties to set
*/
function ConfirmProfileResponse(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ConfirmProfileResponse hasProfile.
* @type {boolean}
*/
ConfirmProfileResponse.prototype.hasProfile = false;
/**
* ConfirmProfileResponse profile.
* @type {(instagram.ProfileResponse$Properties|null)}
*/
ConfirmProfileResponse.prototype.profile = null;
/**
* Creates a new ConfirmProfileResponse instance using the specified properties.
* @param {instagram.ConfirmProfileResponse$Properties=} [properties] Properties to set
* @returns {instagram.ConfirmProfileResponse} ConfirmProfileResponse instance
*/
ConfirmProfileResponse.create = function create(properties) {
return new ConfirmProfileResponse(properties);
};
/**
* Encodes the specified ConfirmProfileResponse message. Does not implicitly {@link instagram.ConfirmProfileResponse.verify|verify} messages.
* @param {instagram.ConfirmProfileResponse$Properties} message ConfirmProfileResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ConfirmProfileResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.hasProfile != null && message.hasOwnProperty("hasProfile"))
writer.uint32(/* id 1, wireType 0 =*/8).bool(message.hasProfile);
if (message.profile != null && message.hasOwnProperty("profile"))
$root.instagram.ProfileResponse.encode(message.profile, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
return writer;
};
/**
* Encodes the specified ConfirmProfileResponse message, length delimited. Does not implicitly {@link instagram.ConfirmProfileResponse.verify|verify} messages.
* @param {instagram.ConfirmProfileResponse$Properties} message ConfirmProfileResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ConfirmProfileResponse.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ConfirmProfileResponse message from the specified reader or buffer.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {instagram.ConfirmProfileResponse} ConfirmProfileResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ConfirmProfileResponse.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.instagram.ConfirmProfileResponse();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.hasProfile = reader.bool();
break;
case 2:
message.profile = $root.instagram.ProfileResponse.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ConfirmProfileResponse message from the specified reader or buffer, length delimited.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {instagram.ConfirmProfileResponse} ConfirmProfileResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ConfirmProfileResponse.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ConfirmProfileResponse message.
* @param {Object.<string,*>} message Plain object to verify
* @returns {?string} `null` if valid, otherwise the reason why it is not
*/
ConfirmProfileResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.hasProfile != null && message.hasOwnProperty("hasProfile"))
if (typeof message.hasProfile !== "boolean")
return "hasProfile: boolean expected";
if (message.profile != null && message.hasOwnProperty("profile")) {
let error = $root.instagram.ProfileResponse.verify(message.profile);
if (error)
return "profile." + error;
}
return null;
};
/**
* Creates a ConfirmProfileResponse message from a plain object. Also converts values to their respective internal types.
* @param {Object.<string,*>} object Plain object
* @returns {instagram.ConfirmProfileResponse} ConfirmProfileResponse
*/
ConfirmProfileResponse.fromObject = function fromObject(object) {
if (object instanceof $root.instagram.ConfirmProfileResponse)
return object;
let message = new $root.instagram.ConfirmProfileResponse();
if (object.hasProfile != null)
message.hasProfile = Boolean(object.hasProfile);
if (object.profile != null) {
if (typeof object.profile !== "object")
throw TypeError(".instagram.ConfirmProfileResponse.profile: object expected");
message.profile = $root.instagram.ProfileResponse.fromObject(object.profile);
}
return message;
};
/**
* Creates a ConfirmProfileResponse message from a plain object. Also converts values to their respective internal types.
* This is an alias of {@link instagram.ConfirmProfileResponse.fromObject}.
* @function
* @param {Object.<string,*>} object Plain object
* @returns {instagram.ConfirmProfileResponse} ConfirmProfileResponse
*/
ConfirmProfileResponse.from = ConfirmProfileResponse.fromObject;
/**
* Creates a plain object from a ConfirmProfileResponse message. Also converts values to other types if specified.
* @param {instagram.ConfirmProfileResponse} message ConfirmProfileResponse
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ConfirmProfileResponse.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults) {
object.hasProfile = false;
object.profile = null;
}
if (message.hasProfile != null && message.hasOwnProperty("hasProfile"))
object.hasProfile = message.hasProfile;
if (message.profile != null && message.hasOwnProperty("profile"))
object.profile = $root.instagram.ProfileResponse.toObject(message.profile, options);
return object;
};
/**
* Creates a plain object from this ConfirmProfileResponse message. Also converts values to other types if specified.
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ConfirmProfileResponse.prototype.toObject = function toObject(options) {
return this.constructor.toObject(this, options);
};
/**
* Converts this ConfirmProfileResponse to JSON.
* @returns {Object.<string,*>} JSON object
*/
ConfirmProfileResponse.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return ConfirmProfileResponse;
})();
instagram.ConfirmUsernameResponse = (function() {
/**
* Properties of a ConfirmUsernameResponse.
* @typedef instagram.ConfirmUsernameResponse$Properties
* @type {Object}
* @property {boolean} [hasUsername] ConfirmUsernameResponse hasUsername.
*/
/**
* Constructs a new ConfirmUsernameResponse.
* @exports instagram.ConfirmUsernameResponse
* @constructor
* @param {instagram.ConfirmUsernameResponse$Properties=} [properties] Properties to set
*/
function ConfirmUsernameResponse(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ConfirmUsernameResponse hasUsername.
* @type {boolean}
*/
ConfirmUsernameResponse.prototype.hasUsername = false;
/**
* Creates a new ConfirmUsernameResponse instance using the specified properties.
* @param {instagram.ConfirmUsernameResponse$Properties=} [properties] Properties to set
* @returns {instagram.ConfirmUsernameResponse} ConfirmUsernameResponse instance
*/
ConfirmUsernameResponse.create = function create(properties) {
return new ConfirmUsernameResponse(properties);
};
/**
* Encodes the specified ConfirmUsernameResponse message. Does not implicitly {@link instagram.ConfirmUsernameResponse.verify|verify} messages.
* @param {instagram.ConfirmUsernameResponse$Properties} message ConfirmUsernameResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ConfirmUsernameResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.hasUsername != null && message.hasOwnProperty("hasUsername"))
writer.uint32(/* id 1, wireType 0 =*/8).bool(message.hasUsername);
return writer;
};
/**
* Encodes the specified ConfirmUsernameResponse message, length delimited. Does not implicitly {@link instagram.ConfirmUsernameResponse.verify|verify} messages.
* @param {instagram.ConfirmUsernameResponse$Properties} message ConfirmUsernameResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ConfirmUsernameResponse.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ConfirmUsernameResponse message from the specified reader or buffer.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {instagram.ConfirmUsernameResponse} ConfirmUsernameResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ConfirmUsernameResponse.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.instagram.ConfirmUsernameResponse();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.hasUsername = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ConfirmUsernameResponse message from the specified reader or buffer, length delimited.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {instagram.ConfirmUsernameResponse} ConfirmUsernameResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ConfirmUsernameResponse.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ConfirmUsernameResponse message.
* @param {Object.<string,*>} message Plain object to verify
* @returns {?string} `null` if valid, otherwise the reason why it is not
*/
ConfirmUsernameResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.hasUsername != null && message.hasOwnProperty("hasUsername"))
if (typeof message.hasUsername !== "boolean")
return "hasUsername: boolean expected";
return null;
};
/**
* Creates a ConfirmUsernameResponse message from a plain object. Also converts values to their respective internal types.
* @param {Object.<string,*>} object Plain object
* @returns {instagram.ConfirmUsernameResponse} ConfirmUsernameResponse
*/
ConfirmUsernameResponse.fromObject = function fromObject(object) {
if (object instanceof $root.instagram.ConfirmUsernameResponse)
return object;
let message = new $root.instagram.ConfirmUsernameResponse();
if (object.hasUsername != null)
message.hasUsername = Boolean(object.hasUsername);
return message;
};
/**
* Creates a ConfirmUsernameResponse message from a plain object. Also converts values to their respective internal types.
* This is an alias of {@link instagram.ConfirmUsernameResponse.fromObject}.
* @function
* @param {Object.<string,*>} object Plain object
* @returns {instagram.ConfirmUsernameResponse} ConfirmUsernameResponse
*/
ConfirmUsernameResponse.from = ConfirmUsernameResponse.fromObject;
/**
* Creates a plain object from a ConfirmUsernameResponse message. Also converts values to other types if specified.
* @param {instagram.ConfirmUsernameResponse} message ConfirmUsernameResponse
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ConfirmUsernameResponse.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults)
object.hasUsername = false;
if (message.hasUsername != null && message.hasOwnProperty("hasUsername"))
object.hasUsername = message.hasUsername;
return object;
};
/**
* Creates a plain object from this ConfirmUsernameResponse message. Also converts values to other types if specified.
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ConfirmUsernameResponse.prototype.toObject = function toObject(options) {
return this.constructor.toObject(this, options);
};
/**
* Converts this ConfirmUsernameResponse to JSON.
* @returns {Object.<string,*>} JSON object
*/
ConfirmUsernameResponse.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return ConfirmUsernameResponse;
})();
instagram.CreateOrEditProfileRequest = (function() {
/**
* Properties of a CreateOrEditProfileRequest.
* @typedef instagram.CreateOrEditProfileRequest$Properties
* @type {Object}
* @property {string} [username] CreateOrEditProfileRequest username.
* @property {string} [websiteUrl] CreateOrEditProfileRequest websiteUrl.
* @property {string} [description] CreateOrEditProfileRequest description.
* @property {Uint8Array} [iconImage] CreateOrEditProfileRequest iconImage.
* @property {string} [iconExt] CreateOrEditProfileRequest iconExt.
*/
/**
* Constructs a new CreateOrEditProfileRequest.
* @exports instagram.CreateOrEditProfileRequest
* @constructor
* @param {instagram.CreateOrEditProfileRequest$Properties=} [properties] Properties to set
*/
function CreateOrEditProfileRequest(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CreateOrEditProfileRequest username.
* @type {string}
*/
CreateOrEditProfileRequest.prototype.username = "";
/**
* CreateOrEditProfileRequest websiteUrl.
* @type {string}
*/
CreateOrEditProfileRequest.prototype.websiteUrl = "";
/**
* CreateOrEditProfileRequest description.
* @type {string}
*/
CreateOrEditProfileRequest.prototype.description = "";
/**
* CreateOrEditProfileRequest iconImage.
* @type {Uint8Array}
*/
CreateOrEditProfileRequest.prototype.iconImage = $util.newBuffer([]);
/**
* CreateOrEditProfileRequest iconExt.
* @type {string}
*/
CreateOrEditProfileRequest.prototype.iconExt = "";
/**
* Creates a new CreateOrEditProfileRequest instance using the specified properties.
* @param {instagram.CreateOrEditProfileRequest$Properties=} [properties] Properties to set
* @returns {instagram.CreateOrEditProfileRequest} CreateOrEditProfileRequest instance
*/
CreateOrEditProfileRequest.create = function create(properties) {
return new CreateOrEditProfileRequest(properties);
};
/**
* Encodes the specified CreateOrEditProfileRequest message. Does not implicitly {@link instagram.CreateOrEditProfileRequest.verify|verify} messages.
* @param {instagram.CreateOrEditProfileRequest$Properties} message CreateOrEditProfileRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CreateOrEditProfileRequest.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.username != null && message.hasOwnProperty("username"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.username);
if (message.websiteUrl != null && message.hasOwnProperty("websiteUrl"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.websiteUrl);
if (message.description != null && message.hasOwnProperty("description"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.description);
if (message.iconImage != null && message.hasOwnProperty("iconImage"))
writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.iconImage);
if (message.iconExt != null && message.hasOwnProperty("iconExt"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.iconExt);
return writer;
};
/**
* Encodes the specified CreateOrEditProfileRequest message, length delimited. Does not implicitly {@link instagram.CreateOrEditProfileRequest.verify|verify} messages.
* @param {instagram.CreateOrEditProfileRequest$Properties} message CreateOrEditProfileRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CreateOrEditProfileRequest.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CreateOrEditProfileRequest message from the specified reader or buffer.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {instagram.CreateOrEditProfileRequest} CreateOrEditProfileRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CreateOrEditProfileRequest.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.instagram.CreateOrEditProfileRequest();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.username = reader.string();
break;
case 2:
message.websiteUrl = reader.string();
break;
case 3:
message.description = reader.string();
break;
case 4:
message.iconImage = reader.bytes();
break;
case 5:
message.iconExt = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CreateOrEditProfileRequest message from the specified reader or buffer, length delimited.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {instagram.CreateOrEditProfileRequest} CreateOrEditProfileRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CreateOrEditProfileRequest.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CreateOrEditProfileRequest message.
* @param {Object.<string,*>} message Plain object to verify
* @returns {?string} `null` if valid, otherwise the reason why it is not
*/
CreateOrEditProfileRequest.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.username != null && message.hasOwnProperty("username"))
if (!$util.isString(message.username))
return "username: string expected";
if (message.websiteUrl != null && message.hasOwnProperty("websiteUrl"))
if (!$util.isString(message.websiteUrl))
return "websiteUrl: string expected";
if (message.description != null && message.hasOwnProperty("description"))
if (!$util.isString(message.description))
return "description: string expected";
if (message.iconImage != null && message.hasOwnProperty("iconImage"))
if (!(message.iconImage && typeof message.iconImage.length === "number" || $util.isString(message.iconImage)))
return "iconImage: buffer expected";
if (message.iconExt != null && message.hasOwnProperty("iconExt"))
if (!$util.isString(message.iconExt))
return "iconExt: string expected";
return null;
};
/**
* Creates a CreateOrEditProfileRequest message from a plain object. Also converts values to their respective internal types.
* @param {Object.<string,*>} object Plain object
* @returns {instagram.CreateOrEditProfileRequest} CreateOrEditProfileRequest
*/
CreateOrEditProfileRequest.fromObject = function fromObject(object) {
if (object instanceof $root.instagram.CreateOrEditProfileRequest)
return object;
let message = new $root.instagram.CreateOrEditProfileRequest();
if (object.username != null)
message.username = String(object.username);
if (object.websiteUrl != null)
message.websiteUrl = String(object.websiteUrl);
if (object.description != null)
message.description = String(object.description);
if (object.iconImage != null)
if (typeof object.iconImage === "string")
$util.base64.decode(object.iconImage, message.iconImage = $util.newBuffer($util.base64.length(object.iconImage)), 0);
else if (object.iconImage.length)
message.iconImage = object.iconImage;
if (object.iconExt != null)
message.iconExt = String(object.iconExt);
return message;
};
/**
* Creates a CreateOrEditProfileRequest message from a plain object. Also converts values to their respective internal types.
* This is an alias of {@link instagram.CreateOrEditProfileRequest.fromObject}.
* @function
* @param {Object.<string,*>} object Plain object
* @returns {instagram.CreateOrEditProfileRequest} CreateOrEditProfileRequest
*/
CreateOrEditProfileRequest.from = CreateOrEditProfileRequest.fromObject;
/**
* Creates a plain object from a CreateOrEditProfileRequest message. Also converts values to other types if specified.
* @param {instagram.CreateOrEditProfileRequest} message CreateOrEditProfileRequest
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CreateOrEditProfileRequest.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults) {
object.username = "";
object.websiteUrl = "";
object.description = "";
object.iconImage = options.bytes === String ? "" : [];
object.iconExt = "";
}
if (message.username != null && message.hasOwnProperty("username"))
object.username = message.username;
if (message.websiteUrl != null && message.hasOwnProperty("websiteUrl"))
object.websiteUrl = message.websiteUrl;
if (message.description != null && message.hasOwnProperty("description"))
object.description = message.description;
if (message.iconImage != null && message.hasOwnProperty("iconImage"))
object.iconImage = options.bytes === String ? $util.base64.encode(message.iconImage, 0, message.iconImage.length) : options.bytes === Array ? Array.prototype.slice.call(message.iconImage) : message.iconImage;
if (message.iconExt != null && message.hasOwnProperty("iconExt"))
object.iconExt = message.iconExt;
return object;
};
/**
* Creates a plain object from this CreateOrEditProfileRequest message. Also converts values to other types if specified.
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CreateOrEditProfileRequest.prototype.toObject = function toObject(options) {
return this.constructor.toObject(this, options);
};
/**
* Converts this CreateOrEditProfileRequest to JSON.
* @returns {Object.<string,*>} JSON object
*/
CreateOrEditProfileRequest.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return CreateOrEditProfileRequest;
})();
instagram.ProfileResponse = (function() {
/**
* Properties of a ProfileResponse.
* @typedef instagram.ProfileResponse$Properties
* @type {Object}
* @property {string} [uid] ProfileResponse uid.
* @property {string} [username] ProfileResponse username.
* @property {string} [iconUrl] ProfileResponse iconUrl.
* @property {string} [websiteUrl] ProfileResponse websiteUrl.
* @property {number|Long} [createdAt] ProfileResponse createdAt.
* @property {number|Long} [updatedAt] ProfileResponse updatedAt.
*/
/**
* Constructs a new ProfileResponse.
* @exports instagram.ProfileResponse
* @constructor
* @param {instagram.ProfileResponse$Properties=} [properties] Properties to set
*/
function ProfileResponse(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ProfileResponse uid.
* @type {string}
*/
ProfileResponse.prototype.uid = "";
/**
* ProfileResponse username.
* @type {string}
*/
ProfileResponse.prototype.username = "";
/**
* ProfileResponse iconUrl.
* @type {string}
*/
ProfileResponse.prototype.iconUrl = "";
/**
* ProfileResponse websiteUrl.
* @type {string}
*/
ProfileResponse.prototype.websiteUrl = "";
/**
* ProfileResponse createdAt.
* @type {number|Long}
*/
ProfileResponse.prototype.createdAt = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* ProfileResponse updatedAt.
* @type {number|Long}
*/
ProfileResponse.prototype.updatedAt = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* Creates a new ProfileResponse instance using the specified properties.
* @param {instagram.ProfileResponse$Properties=} [properties] Properties to set
* @returns {instagram.ProfileResponse} ProfileResponse instance
*/
ProfileResponse.create = function create(properties) {
return new ProfileResponse(properties);
};
/**
* Encodes the specified ProfileResponse message. Does not implicitly {@link instagram.ProfileResponse.verify|verify} messages.
* @param {instagram.ProfileResponse$Properties} message ProfileResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ProfileResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.uid != null && message.hasOwnProperty("uid"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.uid);
if (message.username != null && message.hasOwnProperty("username"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.username);
if (message.iconUrl != null && message.hasOwnProperty("iconUrl"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.iconUrl);
if (message.websiteUrl != null && message.hasOwnProperty("websiteUrl"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.websiteUrl);
if (message.createdAt != null && message.hasOwnProperty("createdAt"))
writer.uint32(/* id 5, wireType 0 =*/40).int64(message.createdAt);
if (message.updatedAt != null && message.hasOwnProperty("updatedAt"))
writer.uint32(/* id 6, wireType 0 =*/48).int64(message.updatedAt);
return writer;
};
/**
* Encodes the specified ProfileResponse message, length delimited. Does not implicitly {@link instagram.ProfileResponse.verify|verify} messages.
* @param {instagram.ProfileResponse$Properties} message ProfileResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ProfileResponse.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ProfileResponse message from the specified reader or buffer.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {instagram.ProfileResponse} ProfileResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ProfileResponse.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.instagram.ProfileResponse();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.uid = reader.string();
break;
case 2:
message.username = reader.string();
break;
case 3:
message.iconUrl = reader.string();
break;
case 4:
message.websiteUrl = reader.string();
break;
case 5:
message.createdAt = reader.int64();
break;
case 6:
message.updatedAt = reader.int64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ProfileResponse message from the specified reader or buffer, length delimited.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {instagram.ProfileResponse} ProfileResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ProfileResponse.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ProfileResponse message.
* @param {Object.<string,*>} message Plain object to verify
* @returns {?string} `null` if valid, otherwise the reason why it is not
*/
ProfileResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.uid != null && message.hasOwnProperty("uid"))
if (!$util.isString(message.uid))
return "uid: string expected";
if (message.username != null && message.hasOwnProperty("username"))
if (!$util.isString(message.username))
return "username: string expected";
if (message.iconUrl != null && message.hasOwnProperty("iconUrl"))
if (!$util.isString(message.iconUrl))
return "iconUrl: string expected";
if (message.websiteUrl != null && message.hasOwnProperty("websiteUrl"))
if (!$util.isString(message.websiteUrl))
return "websiteUrl: string expected";
if (message.createdAt != null && message.hasOwnProperty("createdAt"))
if (!$util.isInteger(message.createdAt) && !(message.createdAt && $util.isInteger(message.createdAt.low) && $util.isInteger(message.createdAt.high)))
return "createdAt: integer|Long expected";
if (message.updatedAt != null && message.hasOwnProperty("updatedAt"))
if (!$util.isInteger(message.updatedAt) && !(message.updatedAt && $util.isInteger(message.updatedAt.low) && $util.isInteger(message.updatedAt.high)))
return "updatedAt: integer|Long expected";
return null;
};
/**
* Creates a ProfileResponse message from a plain object. Also converts values to their respective internal types.
* @param {Object.<string,*>} object Plain object
* @returns {instagram.ProfileResponse} ProfileResponse
*/
ProfileResponse.fromObject = function fromObject(object) {
if (object instanceof $root.instagram.ProfileResponse)
return object;
let message = new $root.instagram.ProfileResponse();
if (object.uid != null)
message.uid = String(object.uid);
if (object.username != null)
message.username = String(object.username);
if (object.iconUrl != null)
message.iconUrl = String(object.iconUrl);
if (object.websiteUrl != null)
message.websiteUrl = String(object.websiteUrl);
if (object.createdAt != null)
if ($util.Long)
(message.createdAt = $util.Long.fromValue(object.createdAt)).unsigned = false;
else if (typeof object.createdAt === "string")
message.createdAt = parseInt(object.createdAt, 10);
else if (typeof object.createdAt === "number")
message.createdAt = object.createdAt;
else if (typeof object.createdAt === "object")
message.createdAt = new $util.LongBits(object.createdAt.low >>> 0, object.createdAt.high >>> 0).toNumber();
if (object.updatedAt != null)
if ($util.Long)
(message.updatedAt = $util.Long.fromValue(object.updatedAt)).unsigned = false;
else if (typeof object.updatedAt === "string")
message.updatedAt = parseInt(object.updatedAt, 10);
else if (typeof object.updatedAt === "number")
message.updatedAt = object.updatedAt;
else if (typeof object.updatedAt === "object")
message.updatedAt = new $util.LongBits(object.updatedAt.low >>> 0, object.updatedAt.high >>> 0).toNumber();
return message;
};
/**
* Creates a ProfileResponse message from a plain object. Also converts values to their respective internal types.
* This is an alias of {@link instagram.ProfileResponse.fromObject}.
* @function
* @param {Object.<string,*>} object Plain object
* @returns {instagram.ProfileResponse} ProfileResponse
*/
ProfileResponse.from = ProfileResponse.fromObject;
/**
* Creates a plain object from a ProfileResponse message. Also converts values to other types if specified.
* @param {instagram.ProfileResponse} message ProfileResponse
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ProfileResponse.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults) {
object.uid = "";
object.username = "";
object.iconUrl = "";
object.websiteUrl = "";
if ($util.Long) {
let long = new $util.Long(0, 0, false);
object.createdAt = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.createdAt = options.longs === String ? "0" : 0;
if ($util.Long) {
let long = new $util.Long(0, 0, false);
object.updatedAt = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.updatedAt = options.longs === String ? "0" : 0;
}
if (message.uid != null && message.hasOwnProperty("uid"))
object.uid = message.uid;
if (message.username != null && message.hasOwnProperty("username"))
object.username = message.username;
if (message.iconUrl != null && message.hasOwnProperty("iconUrl"))
object.iconUrl = message.iconUrl;
if (message.websiteUrl != null && message.hasOwnProperty("websiteUrl"))
object.websiteUrl = message.websiteUrl;
if (message.createdAt != null && message.hasOwnProperty("createdAt"))
if (typeof message.createdAt === "number")
object.createdAt = options.longs === String ? String(message.createdAt) : message.createdAt;
else
object.createdAt = options.longs === String ? $util.Long.prototype.toString.call(message.createdAt) : options.longs === Number ? new $util.LongBits(message.createdAt.low >>> 0, message.createdAt.high >>> 0).toNumber() : message.createdAt;
if (message.updatedAt != null && message.hasOwnProperty("updatedAt"))
if (typeof message.updatedAt === "number")
object.updatedAt = options.longs === String ? String(message.updatedAt) : message.updatedAt;
else
object.updatedAt = options.longs === String ? $util.Long.prototype.toString.call(message.updatedAt) : options.longs === Number ? new $util.LongBits(message.updatedAt.low >>> 0, message.updatedAt.high >>> 0).toNumber() : message.updatedAt;
return object;
};
/**
* Creates a plain object from this ProfileResponse message. Also converts values to other types if specified.
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ProfileResponse.prototype.toObject = function toObject(options) {
return this.constructor.toObject(this, options);
};
/**
* Converts this ProfileResponse to JSON.
* @returns {Object.<string,*>} JSON object
*/
ProfileResponse.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return ProfileResponse;
})();
instagram.MyProfileDetailResponse = (function() {
/**
* Properties of a MyProfileDetailResponse.
* @typedef instagram.MyProfileDetailResponse$Properties
* @type {Object}
* @property {instagram.ProfileResponse$Properties} [profile] MyProfileDetailResponse profile.
* @property {Array.<instagram.ProfileResponse$Properties>} [followers] MyProfileDetailResponse followers.
* @property {Array.<instagram.ProfileResponse$Properties>} [followingUsers] MyProfileDetailResponse followingUsers.
* @property {Array.<instagram.ProfilePostResponse$Properties>} [posts] MyProfileDetailResponse posts.
*/
/**
* Constructs a new MyProfileDetailResponse.
* @exports instagram.MyProfileDetailResponse
* @constructor
* @param {instagram.MyProfileDetailResponse$Properties=} [properties] Properties to set
*/
function MyProfileDetailResponse(properties) {
this.followers = [];
this.followingUsers = [];
this.posts = [];
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* MyProfileDetailResponse profile.
* @type {(instagram.ProfileResponse$Properties|null)}
*/
MyProfileDetailResponse.prototype.profile = null;
/**
* MyProfileDetailResponse followers.
* @type {Array.<instagram.ProfileResponse$Properties>}
*/
MyProfileDetailResponse.prototype.followers = $util.emptyArray;
/**
* MyProfileDetailResponse followingUsers.
* @type {Array.<instagram.ProfileResponse$Properties>}
*/
MyProfileDetailResponse.prototype.followingUsers = $util.emptyArray;
/**
* MyProfileDetailResponse posts.
* @type {Array.<instagram.ProfilePostResponse$Properties>}
*/
MyProfileDetailResponse.prototype.posts = $util.emptyArray;
/**
* Creates a new MyProfileDetailResponse instance using the specified properties.
* @param {instagram.MyProfileDetailResponse$Properties=} [properties] Properties to set
* @returns {instagram.MyProfileDetailResponse} MyProfileDetailResponse instance
*/
MyProfileDetailResponse.create = function create(properties) {
return new MyProfileDetailResponse(properties);
};
/**
* Encodes the specified MyProfileDetailResponse message. Does not implicitly {@link instagram.MyProfileDetailResponse.verify|verify} messages.
* @param {instagram.MyProfileDetailResponse$Properties} message MyProfileDetailResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
MyProfileDetailResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.profile != null && message.hasOwnProperty("profile"))
$root.instagram.ProfileResponse.encode(message.profile, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.followers != null && message.followers.length)
for (let i = 0; i < message.followers.length; ++i)
$root.instagram.ProfileResponse.encode(message.followers[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.followingUsers != null && message.followingUsers.length)
for (let i = 0; i < message.followingUsers.length; ++i)
$root.instagram.ProfileResponse.encode(message.followingUsers[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
if (message.posts != null && message.posts.length)
for (let i = 0; i < message.posts.length; ++i)
$root.instagram.ProfilePostResponse.encode(message.posts[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
return writer;
};
/**
* Encodes the specified MyProfileDetailResponse message, length delimited. Does not implicitly {@link instagram.MyProfileDetailResponse.verify|verify} messages.
* @param {instagram.MyProfileDetailResponse$Properties} message MyProfileDetailResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
MyProfileDetailResponse.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a MyProfileDetailResponse message from the specified reader or buffer.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {instagram.MyProfileDetailResponse} MyProfileDetailResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
MyProfileDetailResponse.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.instagram.MyProfileDetailResponse();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.profile = $root.instagram.ProfileResponse.decode(reader, reader.uint32());
break;
case 2:
if (!(message.followers && message.followers.length))
message.followers = [];
message.followers.push($root.instagram.ProfileResponse.decode(reader, reader.uint32()));
break;
case 3:
if (!(message.followingUsers && message.followingUsers.length))
message.followingUsers = [];
message.followingUsers.push($root.instagram.ProfileResponse.decode(reader, reader.uint32()));
break;
case 4:
if (!(message.posts && message.posts.length))
message.posts = [];
message.posts.push($root.instagram.ProfilePostResponse.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a MyProfileDetailResponse message from the specified reader or buffer, length delimited.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {instagram.MyProfileDetailResponse} MyProfileDetailResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
MyProfileDetailResponse.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a MyProfileDetailResponse message.
* @param {Object.<string,*>} message Plain object to verify
* @returns {?string} `null` if valid, otherwise the reason why it is not
*/
MyProfileDetailResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.profile != null && message.hasOwnProperty("profile")) {
let error = $root.instagram.ProfileResponse.verify(message.profile);
if (error)
return "profile." + error;
}
if (message.followers != null && message.hasOwnProperty("followers")) {
if (!Array.isArray(message.followers))
return "followers: array expected";
for (let i = 0; i < message.followers.length; ++i) {
let error = $root.instagram.ProfileResponse.verify(message.followers[i]);
if (error)
return "followers." + error;
}
}
if (message.followingUsers != null && message.hasOwnProperty("followingUsers")) {
if (!Array.isArray(message.followingUsers))
return "followingUsers: array expected";
for (let i = 0; i < message.followingUsers.length; ++i) {
let error = $root.instagram.ProfileResponse.verify(message.followingUsers[i]);
if (error)
return "followingUsers." + error;
}
}
if (message.posts != null && message.hasOwnProperty("posts")) {
if (!Array.isArray(message.posts))
return "posts: array expected";
for (let i = 0; i < message.posts.length; ++i) {
let error = $root.instagram.ProfilePostResponse.verify(message.posts[i]);
if (error)
return "posts." + error;
}
}
return null;
};
/**
* Creates a MyProfileDetailResponse message from a plain object. Also converts values to their respective internal types.
* @param {Object.<string,*>} object Plain object
* @returns {instagram.MyProfileDetailResponse} MyProfileDetailResponse
*/
MyProfileDetailResponse.fromObject = function fromObject(object) {
if (object instanceof $root.instagram.MyProfileDetailResponse)
return object;
let message = new $root.instagram.MyProfileDetailResponse();
if (object.profile != null) {
if (typeof object.profile !== "object")
throw TypeError(".instagram.MyProfileDetailResponse.profile: object expected");
message.profile = $root.instagram.ProfileResponse.fromObject(object.profile);
}
if (object.followers) {
if (!Array.isArray(object.followers))
throw TypeError(".instagram.MyProfileDetailResponse.followers: array expected");
message.followers = [];
for (let i = 0; i < object.followers.length; ++i) {
if (typeof object.followers[i] !== "object")
throw TypeError(".instagram.MyProfileDetailResponse.followers: object expected");
message.followers[i] = $root.instagram.ProfileResponse.fromObject(object.followers[i]);
}
}
if (object.followingUsers) {
if (!Array.isArray(object.followingUsers))
throw TypeError(".instagram.MyProfileDetailResponse.followingUsers: array expected");
message.followingUsers = [];
for (let i = 0; i < object.followingUsers.length; ++i) {
if (typeof object.followingUsers[i] !== "object")
throw TypeError(".instagram.MyProfileDetailResponse.followingUsers: object expected");
message.followingUsers[i] = $root.instagram.ProfileResponse.fromObject(object.followingUsers[i]);
}
}
if (object.posts) {
if (!Array.isArray(object.posts))
throw TypeError(".instagram.MyProfileDetailResponse.posts: array expected");
message.posts = [];
for (let i = 0; i < object.posts.length; ++i) {
if (typeof object.posts[i] !== "object")
throw TypeError(".instagram.MyProfileDetailResponse.posts: object expected");
message.posts[i] = $root.instagram.ProfilePostResponse.fromObject(object.posts[i]);
}
}
return message;
};
/**
* Creates a MyProfileDetailResponse message from a plain object. Also converts values to their respective internal types.
* This is an alias of {@link instagram.MyProfileDetailResponse.fromObject}.
* @function
* @param {Object.<string,*>} object Plain object
* @returns {instagram.MyProfileDetailResponse} MyProfileDetailResponse
*/
MyProfileDetailResponse.from = MyProfileDetailResponse.fromObject;
/**
* Creates a plain object from a MyProfileDetailResponse message. Also converts values to other types if specified.
* @param {instagram.MyProfileDetailResponse} message MyProfileDetailResponse
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
MyProfileDetailResponse.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.arrays || options.defaults) {
object.followers = [];
object.followingUsers = [];
object.posts = [];
}
if (options.defaults)
object.profile = null;
if (message.profile != null && message.hasOwnProperty("profile"))
object.profile = $root.instagram.ProfileResponse.toObject(message.profile, options);
if (message.followers && message.followers.length) {
object.followers = [];
for (let j = 0; j < message.followers.length; ++j)
object.followers[j] = $root.instagram.ProfileResponse.toObject(message.followers[j], options);
}
if (message.followingUsers && message.followingUsers.length) {
object.followingUsers = [];
for (let j = 0; j < message.followingUsers.length; ++j)
object.followingUsers[j] = $root.instagram.ProfileResponse.toObject(message.followingUsers[j], options);
}
if (message.posts && message.posts.length) {
object.posts = [];
for (let j = 0; j < message.posts.length; ++j)
object.posts[j] = $root.instagram.ProfilePostResponse.toObject(message.posts[j], options);
}
return object;
};
/**
* Creates a plain object from this MyProfileDetailResponse message. Also converts values to other types if specified.
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
MyProfileDetailResponse.prototype.toObject = function toObject(options) {
return this.constructor.toObject(this, options);
};
/**
* Converts this MyProfileDetailResponse to JSON.
* @returns {Object.<string,*>} JSON object
*/
MyProfileDetailResponse.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return MyProfileDetailResponse;
})();
instagram.OthersProfileDetailResponse = (function() {
/**
* Properties of an OthersProfileDetailResponse.
* @typedef instagram.OthersProfileDetailResponse$Properties
* @type {Object}
* @property {instagram.ProfileResponse$Properties} [profile] OthersProfileDetailResponse profile.
* @property {Array.<instagram.ProfileResponse$Properties>} [followers] OthersProfileDetailResponse followers.
* @property {Array.<instagram.ProfileResponse$Properties>} [followingUsers] OthersProfileDetailResponse followingUsers.
* @property {Array.<instagram.ProfilePostResponse$Properties>} [posts] OthersProfileDetailResponse posts.
* @property {boolean} [isFollower] OthersProfileDetailResponse isFollower.
*/
/**
* Constructs a new OthersProfileDetailResponse.
* @exports instagram.OthersProfileDetailResponse
* @constructor
* @param {instagram.OthersProfileDetailResponse$Properties=} [properties] Properties to set
*/
function OthersProfileDetailResponse(properties) {
this.followers = [];
this.followingUsers = [];
this.posts = [];
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* OthersProfileDetailResponse profile.
* @type {(instagram.ProfileResponse$Properties|null)}
*/
OthersProfileDetailResponse.prototype.profile = null;
/**
* OthersProfileDetailResponse followers.
* @type {Array.<instagram.ProfileResponse$Properties>}
*/
OthersProfileDetailResponse.prototype.followers = $util.emptyArray;
/**
* OthersProfileDetailResponse followingUsers.
* @type {Array.<instagram.ProfileResponse$Properties>}
*/
OthersProfileDetailResponse.prototype.followingUsers = $util.emptyArray;
/**
* OthersProfileDetailResponse posts.
* @type {Array.<instagram.ProfilePostResponse$Properties>}
*/
OthersProfileDetailResponse.prototype.posts = $util.emptyArray;
/**
* OthersProfileDetailResponse isFollower.
* @type {boolean}
*/
OthersProfileDetailResponse.prototype.isFollower = false;
/**
* Creates a new OthersProfileDetailResponse instance using the specified properties.
* @param {instagram.OthersProfileDetailResponse$Properties=} [properties] Properties to set
* @returns {instagram.OthersProfileDetailResponse} OthersProfileDetailResponse instance
*/
OthersProfileDetailResponse.create = function create(properties) {
return new OthersProfileDetailResponse(properties);
};
/**
* Encodes the specified OthersProfileDetailResponse message. Does not implicitly {@link instagram.OthersProfileDetailResponse.verify|verify} messages.
* @param {instagram.OthersProfileDetailResponse$Properties} message OthersProfileDetailResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
OthersProfileDetailResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.profile != null && message.hasOwnProperty("profile"))
$root.instagram.ProfileResponse.encode(message.profile, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.followers != null && message.followers.length)
for (let i = 0; i < message.followers.length; ++i)
$root.instagram.ProfileResponse.encode(message.followers[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.followingUsers != null && message.followingUsers.length)
for (let i = 0; i < message.followingUsers.length; ++i)
$root.instagram.ProfileResponse.encode(message.followingUsers[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
if (message.posts != null && message.posts.length)
for (let i = 0; i < message.posts.length; ++i)
$root.instagram.ProfilePostResponse.encode(message.posts[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
if (message.isFollower != null && message.hasOwnProperty("isFollower"))
writer.uint32(/* id 5, wireType 0 =*/40).bool(message.isFollower);
return writer;
};
/**
* Encodes the specified OthersProfileDetailResponse message, length delimited. Does not implicitly {@link instagram.OthersProfileDetailResponse.verify|verify} messages.
* @param {instagram.OthersProfileDetailResponse$Properties} message OthersProfileDetailResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
OthersProfileDetailResponse.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an OthersProfileDetailResponse message from the specified reader or buffer.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {instagram.OthersProfileDetailResponse} OthersProfileDetailResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
OthersProfileDetailResponse.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.instagram.OthersProfileDetailResponse();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.profile = $root.instagram.ProfileResponse.decode(reader, reader.uint32());
break;
case 2:
if (!(message.followers && message.followers.length))
message.followers = [];
message.followers.push($root.instagram.ProfileResponse.decode(reader, reader.uint32()));
break;
case 3:
if (!(message.followingUsers && message.followingUsers.length))
message.followingUsers = [];
message.followingUsers.push($root.instagram.ProfileResponse.decode(reader, reader.uint32()));
break;
case 4:
if (!(message.posts && message.posts.length))
message.posts = [];
message.posts.push($root.instagram.ProfilePostResponse.decode(reader, reader.uint32()));
break;
case 5:
message.isFollower = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an OthersProfileDetailResponse message from the specified reader or buffer, length delimited.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {instagram.OthersProfileDetailResponse} OthersProfileDetailResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
OthersProfileDetailResponse.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an OthersProfileDetailResponse message.
* @param {Object.<string,*>} message Plain object to verify
* @returns {?string} `null` if valid, otherwise the reason why it is not
*/
OthersProfileDetailResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.profile != null && message.hasOwnProperty("profile")) {
let error = $root.instagram.ProfileResponse.verify(message.profile);
if (error)
return "profile." + error;
}
if (message.followers != null && message.hasOwnProperty("followers")) {
if (!Array.isArray(message.followers))
return "followers: array expected";
for (let i = 0; i < message.followers.length; ++i) {
let error = $root.instagram.ProfileResponse.verify(message.followers[i]);
if (error)
return "followers." + error;
}
}
if (message.followingUsers != null && message.hasOwnProperty("followingUsers")) {
if (!Array.isArray(message.followingUsers))
return "followingUsers: array expected";
for (let i = 0; i < message.followingUsers.length; ++i) {
let error = $root.instagram.ProfileResponse.verify(message.followingUsers[i]);
if (error)
return "followingUsers." + error;
}
}
if (message.posts != null && message.hasOwnProperty("posts")) {
if (!Array.isArray(message.posts))
return "posts: array expected";
for (let i = 0; i < message.posts.length; ++i) {
let error = $root.instagram.ProfilePostResponse.verify(message.posts[i]);
if (error)
return "posts." + error;
}
}
if (message.isFollower != null && message.hasOwnProperty("isFollower"))
if (typeof message.isFollower !== "boolean")
return "isFollower: boolean expected";
return null;
};
/**
* Creates an OthersProfileDetailResponse message from a plain object. Also converts values to their respective internal types.
* @param {Object.<string,*>} object Plain object
* @returns {instagram.OthersProfileDetailResponse} OthersProfileDetailResponse
*/
OthersProfileDetailResponse.fromObject = function fromObject(object) {
if (object instanceof $root.instagram.OthersProfileDetailResponse)
return object;
let message = new $root.instagram.OthersProfileDetailResponse();
if (object.profile != null) {
if (typeof object.profile !== "object")
throw TypeError(".instagram.OthersProfileDetailResponse.profile: object expected");
message.profile = $root.instagram.ProfileResponse.fromObject(object.profile);
}
if (object.followers) {
if (!Array.isArray(object.followers))
throw TypeError(".instagram.OthersProfileDetailResponse.followers: array expected");
message.followers = [];
for (let i = 0; i < object.followers.length; ++i) {
if (typeof object.followers[i] !== "object")
throw TypeError(".instagram.OthersProfileDetailResponse.followers: object expected");
message.followers[i] = $root.instagram.ProfileResponse.fromObject(object.followers[i]);
}
}
if (object.followingUsers) {
if (!Array.isArray(object.followingUsers))
throw TypeError(".instagram.OthersProfileDetailResponse.followingUsers: array expected");
message.followingUsers = [];
for (let i = 0; i < object.followingUsers.length; ++i) {
if (typeof object.followingUsers[i] !== "object")
throw TypeError(".instagram.OthersProfileDetailResponse.followingUsers: object expected");
message.followingUsers[i] = $root.instagram.ProfileResponse.fromObject(object.followingUsers[i]);
}
}
if (object.posts) {
if (!Array.isArray(object.posts))
throw TypeError(".instagram.OthersProfileDetailResponse.posts: array expected");
message.posts = [];
for (let i = 0; i < object.posts.length; ++i) {
if (typeof object.posts[i] !== "object")
throw TypeError(".instagram.OthersProfileDetailResponse.posts: object expected");
message.posts[i] = $root.instagram.ProfilePostResponse.fromObject(object.posts[i]);
}
}
if (object.isFollower != null)
message.isFollower = Boolean(object.isFollower);
return message;
};
/**
* Creates an OthersProfileDetailResponse message from a plain object. Also converts values to their respective internal types.
* This is an alias of {@link instagram.OthersProfileDetailResponse.fromObject}.
* @function
* @param {Object.<string,*>} object Plain object
* @returns {instagram.OthersProfileDetailResponse} OthersProfileDetailResponse
*/
OthersProfileDetailResponse.from = OthersProfileDetailResponse.fromObject;
/**
* Creates a plain object from an OthersProfileDetailResponse message. Also converts values to other types if specified.
* @param {instagram.OthersProfileDetailResponse} message OthersProfileDetailResponse
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
OthersProfileDetailResponse.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.arrays || options.defaults) {
object.followers = [];
object.followingUsers = [];
object.posts = [];
}
if (options.defaults) {
object.profile = null;
object.isFollower = false;
}
if (message.profile != null && message.hasOwnProperty("profile"))
object.profile = $root.instagram.ProfileResponse.toObject(message.profile, options);
if (message.followers && message.followers.length) {
object.followers = [];
for (let j = 0; j < message.followers.length; ++j)
object.followers[j] = $root.instagram.ProfileResponse.toObject(message.followers[j], options);
}
if (message.followingUsers && message.followingUsers.length) {
object.followingUsers = [];
for (let j = 0; j < message.followingUsers.length; ++j)
object.followingUsers[j] = $root.instagram.ProfileResponse.toObject(message.followingUsers[j], options);
}
if (message.posts && message.posts.length) {
object.posts = [];
for (let j = 0; j < message.posts.length; ++j)
object.posts[j] = $root.instagram.ProfilePostResponse.toObject(message.posts[j], options);
}
if (message.isFollower != null && message.hasOwnProperty("isFollower"))
object.isFollower = message.isFollower;
return object;
};
/**
* Creates a plain object from this OthersProfileDetailResponse message. Also converts values to other types if specified.
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
OthersProfileDetailResponse.prototype.toObject = function toObject(options) {
return this.constructor.toObject(this, options);
};
/**
* Converts this OthersProfileDetailResponse to JSON.
* @returns {Object.<string,*>} JSON object
*/
OthersProfileDetailResponse.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return OthersProfileDetailResponse;
})();
instagram.ProfilePostResponse = (function() {
/**
* Properties of a ProfilePostResponse.
* @typedef instagram.ProfilePostResponse$Properties
* @type {Object}
* @property {number|Long} [id] ProfilePostResponse id.
* @property {string} [fileUrl] ProfilePostResponse fileUrl.
* @property {boolean} [isImage] ProfilePostResponse isImage.
*/
/**
* Constructs a new ProfilePostResponse.
* @exports instagram.ProfilePostResponse
* @constructor
* @param {instagram.ProfilePostResponse$Properties=} [properties] Properties to set
*/
function ProfilePostResponse(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ProfilePostResponse id.
* @type {number|Long}
*/
ProfilePostResponse.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* ProfilePostResponse fileUrl.
* @type {string}
*/
ProfilePostResponse.prototype.fileUrl = "";
/**
* ProfilePostResponse isImage.
* @type {boolean}
*/
ProfilePostResponse.prototype.isImage = false;
/**
* Creates a new ProfilePostResponse instance using the specified properties.
* @param {instagram.ProfilePostResponse$Properties=} [properties] Properties to set
* @returns {instagram.ProfilePostResponse} ProfilePostResponse instance
*/
ProfilePostResponse.create = function create(properties) {
return new ProfilePostResponse(properties);
};
/**
* Encodes the specified ProfilePostResponse message. Does not implicitly {@link instagram.ProfilePostResponse.verify|verify} messages.
* @param {instagram.ProfilePostResponse$Properties} message ProfilePostResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ProfilePostResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.id != null && message.hasOwnProperty("id"))
writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id);
if (message.fileUrl != null && message.hasOwnProperty("fileUrl"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.fileUrl);
if (message.isImage != null && message.hasOwnProperty("isImage"))
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isImage);
return writer;
};
/**
* Encodes the specified ProfilePostResponse message, length delimited. Does not implicitly {@link instagram.ProfilePostResponse.verify|verify} messages.
* @param {instagram.ProfilePostResponse$Properties} message ProfilePostResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ProfilePostResponse.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ProfilePostResponse message from the specified reader or buffer.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {instagram.ProfilePostResponse} ProfilePostResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ProfilePostResponse.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.instagram.ProfilePostResponse();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id = reader.int64();
break;
case 2:
message.fileUrl = reader.string();
break;
case 3:
message.isImage = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ProfilePostResponse message from the specified reader or buffer, length delimited.
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {instagram.ProfilePostResponse} ProfilePostResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ProfilePostResponse.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ProfilePostResponse message.
* @param {Object.<string,*>} message Plain object to verify
* @returns {?string} `null` if valid, otherwise the reason why it is not
*/
ProfilePostResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.id != null && message.hasOwnProperty("id"))
if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
return "id: integer|Long expected";
if (message.fileUrl != null && message.hasOwnProperty("fileUrl"))
if (!$util.isString(message.fileUrl))
return "fileUrl: string expected";
if (message.isImage != null && message.hasOwnProperty("isImage"))
if (typeof message.isImage !== "boolean")
return "isImage: boolean expected";
return null;
};
/**
* Creates a ProfilePostResponse message from a plain object. Also converts values to their respective internal types.
* @param {Object.<string,*>} object Plain object
* @returns {instagram.ProfilePostResponse} ProfilePostResponse
*/
ProfilePostResponse.fromObject = function fromObject(object) {
if (object instanceof $root.instagram.ProfilePostResponse)
return object;
let message = new $root.instagram.ProfilePostResponse();
if (object.id != null)
if ($util.Long)
(message.id = $util.Long.fromValue(object.id)).unsigned = false;
else if (typeof object.id === "string")
message.id = parseInt(object.id, 10);
else if (typeof object.id === "number")
message.id = object.id;
else if (typeof object.id === "object")
message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber();
if (object.fileUrl != null)
message.fileUrl = String(object.fileUrl);
if (object.isImage != null)
message.isImage = Boolean(object.isImage);
return message;
};
/**
* Creates a ProfilePostResponse message from a plain object. Also converts values to their respective internal types.
* This is an alias of {@link instagram.ProfilePostResponse.fromObject}.
* @function
* @param {Object.<string,*>} object Plain object
* @returns {instagram.ProfilePostResponse} ProfilePostResponse
*/
ProfilePostResponse.from = ProfilePostResponse.fromObject;
/**
* Creates a plain object from a ProfilePostResponse message. Also converts values to other types if specified.
* @param {instagram.ProfilePostResponse} message ProfilePostResponse
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ProfilePostResponse.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults) {
if ($util.Long) {
let long = new $util.Long(0, 0, false);
object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.id = options.longs === String ? "0" : 0;
object.fileUrl = "";
object.isImage = false;
}
if (message.id != null && message.hasOwnProperty("id"))
if (typeof message.id === "number")
object.id = options.longs === String ? String(message.id) : message.id;
else
object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id;
if (message.fileUrl != null && message.hasOwnProperty("fileUrl"))
object.fileUrl = message.fileUrl;
if (message.isImage != null && message.hasOwnProperty("isImage"))
object.isImage = message.isImage;
return object;
};
/**
* Creates a plain object from this ProfilePostResponse message. Also converts values to other types if specified.
* @param {$protobuf.ConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ProfilePostResponse.prototype.toObject = function toObject(options) {
return this.constructor.toObject(this, options);
};
/**
* Converts this ProfilePostResponse to JSON.
* @returns {Object.<string,*>} JSON object
*/
ProfilePostResponse.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return ProfilePostResponse;
})();
return instagram;
})();
export { $root as default };
{
"nested": {
"instagram": {
"nested": {
"ConfirmProfileResponse": {
"fields": {
"hasProfile": {
"type": "bool",
"id": 1
},
"profile": {
"type": "ProfileResponse",
"id": 2
}
}
},
"ConfirmUsernameResponse": {
"fields": {
"hasUsername": {
"type": "bool",
"id": 1
}
}
},
"CreateOrEditProfileRequest": {
"fields": {
"username": {
"type": "string",
"id": 1
},
"websiteUrl": {
"type": "string",
"id": 2
},
"description": {
"type": "string",
"id": 3
},
"iconImage": {
"type": "bytes",
"id": 4
},
"iconExt": {
"type": "string",
"id": 5
}
}
},
"ProfileResponse": {
"fields": {
"uid": {
"type": "string",
"id": 1
},
"username": {
"type": "string",
"id": 2
},
"iconUrl": {
"type": "string",
"id": 3
},
"websiteUrl": {
"type": "string",
"id": 4
},
"createdAt": {
"type": "int64",
"id": 5
},
"updatedAt": {
"type": "int64",
"id": 6
}
}
},
"MyProfileDetailResponse": {
"fields": {
"profile": {
"type": "ProfileResponse",
"id": 1
},
"followers": {
"rule": "repeated",
"type": "ProfileResponse",
"id": 2
},
"followingUsers": {
"rule": "repeated",
"type": "ProfileResponse",
"id": 3
},
"posts": {
"rule": "repeated",
"type": "ProfilePostResponse",
"id": 4
}
}
},
"OthersProfileDetailResponse": {
"fields": {
"profile": {
"type": "ProfileResponse",
"id": 1
},
"followers": {
"rule": "repeated",
"type": "ProfileResponse",
"id": 2
},
"followingUsers": {
"rule": "repeated",
"type": "ProfileResponse",
"id": 3
},
"posts": {
"rule": "repeated",
"type": "ProfilePostResponse",
"id": 4
},
"isFollower": {
"type": "bool",
"id": 5
}
}
},
"ProfilePostResponse": {
"fields": {
"id": {
"type": "int64",
"id": 1
},
"fileUrl": {
"type": "string",
"id": 2
},
"isImage": {
"type": "bool",
"id": 3
}
}
}
}
}
}
}
package instagram;
syntax = "proto3";
message ConfirmProfileResponse {
bool has_profile = 1;
ProfileResponse profile = 2;
}
message ConfirmUsernameResponse {
bool has_username = 1;
}
message CreateOrEditProfileRequest {
string username = 1;
string website_url = 2;
string description = 3;
bytes icon_image = 4;
string icon_ext = 5;
}
message ProfileResponse {
string uid = 1;
string username = 2;
string icon_url = 3;
string website_url = 4;
int64 created_at = 5;
int64 updated_at = 6;
}
message MyProfileDetailResponse {
ProfileResponse profile = 1;
repeated ProfileResponse followers = 2;
repeated ProfileResponse following_users = 3;
repeated ProfilePostResponse posts = 4;
}
message OthersProfileDetailResponse {
ProfileResponse profile = 1;
repeated ProfileResponse followers = 2;
repeated ProfileResponse following_users = 3;
repeated ProfilePostResponse posts = 4;
bool is_follower = 5;
}
message ProfilePostResponse {
int64 id = 1;
string file_url = 2;
bool is_image = 3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment