@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
256 lines (255 loc) • 8.59 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc unknown
// source: zitadel/user/v2beta/phone.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "zitadel.user.v2beta";
function createBaseSetHumanPhone() {
return { phone: "", sendCode: undefined, returnCode: undefined, isVerified: undefined };
}
export const SetHumanPhone = {
encode(message, writer = new BinaryWriter()) {
if (message.phone !== "") {
writer.uint32(10).string(message.phone);
}
if (message.sendCode !== undefined) {
SendPhoneVerificationCode.encode(message.sendCode, writer.uint32(18).fork()).join();
}
if (message.returnCode !== undefined) {
ReturnPhoneVerificationCode.encode(message.returnCode, writer.uint32(26).fork()).join();
}
if (message.isVerified !== undefined) {
writer.uint32(32).bool(message.isVerified);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSetHumanPhone();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.phone = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.sendCode = SendPhoneVerificationCode.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.returnCode = ReturnPhoneVerificationCode.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.isVerified = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
phone: isSet(object.phone) ? globalThis.String(object.phone) : "",
sendCode: isSet(object.sendCode) ? SendPhoneVerificationCode.fromJSON(object.sendCode) : undefined,
returnCode: isSet(object.returnCode) ? ReturnPhoneVerificationCode.fromJSON(object.returnCode) : undefined,
isVerified: isSet(object.isVerified) ? globalThis.Boolean(object.isVerified) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.phone !== "") {
obj.phone = message.phone;
}
if (message.sendCode !== undefined) {
obj.sendCode = SendPhoneVerificationCode.toJSON(message.sendCode);
}
if (message.returnCode !== undefined) {
obj.returnCode = ReturnPhoneVerificationCode.toJSON(message.returnCode);
}
if (message.isVerified !== undefined) {
obj.isVerified = message.isVerified;
}
return obj;
},
create(base) {
return SetHumanPhone.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSetHumanPhone();
message.phone = object.phone ?? "";
message.sendCode = (object.sendCode !== undefined && object.sendCode !== null)
? SendPhoneVerificationCode.fromPartial(object.sendCode)
: undefined;
message.returnCode = (object.returnCode !== undefined && object.returnCode !== null)
? ReturnPhoneVerificationCode.fromPartial(object.returnCode)
: undefined;
message.isVerified = object.isVerified ?? undefined;
return message;
},
};
function createBaseHumanPhone() {
return { phone: "", isVerified: false };
}
export const HumanPhone = {
encode(message, writer = new BinaryWriter()) {
if (message.phone !== "") {
writer.uint32(10).string(message.phone);
}
if (message.isVerified !== false) {
writer.uint32(16).bool(message.isVerified);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseHumanPhone();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.phone = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.isVerified = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
phone: isSet(object.phone) ? globalThis.String(object.phone) : "",
isVerified: isSet(object.isVerified) ? globalThis.Boolean(object.isVerified) : false,
};
},
toJSON(message) {
const obj = {};
if (message.phone !== "") {
obj.phone = message.phone;
}
if (message.isVerified !== false) {
obj.isVerified = message.isVerified;
}
return obj;
},
create(base) {
return HumanPhone.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseHumanPhone();
message.phone = object.phone ?? "";
message.isVerified = object.isVerified ?? false;
return message;
},
};
function createBaseSendPhoneVerificationCode() {
return {};
}
export const SendPhoneVerificationCode = {
encode(_, writer = new BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSendPhoneVerificationCode();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return SendPhoneVerificationCode.fromPartial(base ?? {});
},
fromPartial(_) {
const message = createBaseSendPhoneVerificationCode();
return message;
},
};
function createBaseReturnPhoneVerificationCode() {
return {};
}
export const ReturnPhoneVerificationCode = {
encode(_, writer = new BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseReturnPhoneVerificationCode();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return ReturnPhoneVerificationCode.fromPartial(base ?? {});
},
fromPartial(_) {
const message = createBaseReturnPhoneVerificationCode();
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}