UNPKG

@zitadel/node

Version:

Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.

1,274 lines 522 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.7.5 // protoc unknown // source: zitadel/user/v2/user_service.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import Long from "long"; import { Struct } from "../../../google/protobuf/struct.js"; import { Timestamp } from "../../../google/protobuf/timestamp.js"; import { PaginationRequest, PaginationResponse } from "../../filter/v2/filter.js"; import { Details, ListDetails, ListQuery, Organization } from "../../object/v2/object.js"; import { passkeyAuthenticatorFromJSON, passkeyAuthenticatorToJSON, PasskeyRegistrationCode, ReturnPasskeyRegistrationCode, SendPasskeyRegistrationLink, } from "./auth.js"; import { ReturnEmailVerificationCode, SendEmailVerificationCode, SetHumanEmail } from "./email.js"; import { IDPInformation, IDPIntent, IDPLink, LDAPCredentials, RedirectURLs } from "./idp.js"; import { Key, keyFieldNameFromJSON, keyFieldNameToJSON, KeysSearchFilter } from "./key.js"; import { HashedPassword, Password, ReturnPasswordResetCode, SendPasswordResetLink, SetPassword } from "./password.js"; import { PersonalAccessToken, personalAccessTokenFieldNameFromJSON, personalAccessTokenFieldNameToJSON, PersonalAccessTokensSearchFilter, } from "./pat.js"; import { ReturnPhoneVerificationCode, SendPhoneVerificationCode, SetHumanPhone } from "./phone.js"; import { SearchQuery, userFieldNameFromJSON, userFieldNameToJSON } from "./query.js"; import { AuthFactor, authFactorStateFromJSON, authFactorStateToJSON, genderFromJSON, genderToJSON, Passkey, ReturnInviteCode, SendInviteCode, SetHumanProfile, SetMetadataEntry, User, } from "./user.js"; export const protobufPackage = "zitadel.user.v2"; export var AuthenticationMethodType; (function (AuthenticationMethodType) { AuthenticationMethodType[AuthenticationMethodType["AUTHENTICATION_METHOD_TYPE_UNSPECIFIED"] = 0] = "AUTHENTICATION_METHOD_TYPE_UNSPECIFIED"; AuthenticationMethodType[AuthenticationMethodType["AUTHENTICATION_METHOD_TYPE_PASSWORD"] = 1] = "AUTHENTICATION_METHOD_TYPE_PASSWORD"; AuthenticationMethodType[AuthenticationMethodType["AUTHENTICATION_METHOD_TYPE_PASSKEY"] = 2] = "AUTHENTICATION_METHOD_TYPE_PASSKEY"; AuthenticationMethodType[AuthenticationMethodType["AUTHENTICATION_METHOD_TYPE_IDP"] = 3] = "AUTHENTICATION_METHOD_TYPE_IDP"; AuthenticationMethodType[AuthenticationMethodType["AUTHENTICATION_METHOD_TYPE_TOTP"] = 4] = "AUTHENTICATION_METHOD_TYPE_TOTP"; AuthenticationMethodType[AuthenticationMethodType["AUTHENTICATION_METHOD_TYPE_U2F"] = 5] = "AUTHENTICATION_METHOD_TYPE_U2F"; AuthenticationMethodType[AuthenticationMethodType["AUTHENTICATION_METHOD_TYPE_OTP_SMS"] = 6] = "AUTHENTICATION_METHOD_TYPE_OTP_SMS"; AuthenticationMethodType[AuthenticationMethodType["AUTHENTICATION_METHOD_TYPE_OTP_EMAIL"] = 7] = "AUTHENTICATION_METHOD_TYPE_OTP_EMAIL"; AuthenticationMethodType[AuthenticationMethodType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(AuthenticationMethodType || (AuthenticationMethodType = {})); export function authenticationMethodTypeFromJSON(object) { switch (object) { case 0: case "AUTHENTICATION_METHOD_TYPE_UNSPECIFIED": return AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_UNSPECIFIED; case 1: case "AUTHENTICATION_METHOD_TYPE_PASSWORD": return AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_PASSWORD; case 2: case "AUTHENTICATION_METHOD_TYPE_PASSKEY": return AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_PASSKEY; case 3: case "AUTHENTICATION_METHOD_TYPE_IDP": return AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_IDP; case 4: case "AUTHENTICATION_METHOD_TYPE_TOTP": return AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_TOTP; case 5: case "AUTHENTICATION_METHOD_TYPE_U2F": return AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_U2F; case 6: case "AUTHENTICATION_METHOD_TYPE_OTP_SMS": return AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_OTP_SMS; case 7: case "AUTHENTICATION_METHOD_TYPE_OTP_EMAIL": return AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_OTP_EMAIL; case -1: case "UNRECOGNIZED": default: return AuthenticationMethodType.UNRECOGNIZED; } } export function authenticationMethodTypeToJSON(object) { switch (object) { case AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_UNSPECIFIED: return "AUTHENTICATION_METHOD_TYPE_UNSPECIFIED"; case AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_PASSWORD: return "AUTHENTICATION_METHOD_TYPE_PASSWORD"; case AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_PASSKEY: return "AUTHENTICATION_METHOD_TYPE_PASSKEY"; case AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_IDP: return "AUTHENTICATION_METHOD_TYPE_IDP"; case AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_TOTP: return "AUTHENTICATION_METHOD_TYPE_TOTP"; case AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_U2F: return "AUTHENTICATION_METHOD_TYPE_U2F"; case AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_OTP_SMS: return "AUTHENTICATION_METHOD_TYPE_OTP_SMS"; case AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_OTP_EMAIL: return "AUTHENTICATION_METHOD_TYPE_OTP_EMAIL"; case AuthenticationMethodType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export var AuthFactors; (function (AuthFactors) { AuthFactors[AuthFactors["OTP"] = 0] = "OTP"; AuthFactors[AuthFactors["OTP_SMS"] = 1] = "OTP_SMS"; AuthFactors[AuthFactors["OTP_EMAIL"] = 2] = "OTP_EMAIL"; AuthFactors[AuthFactors["U2F"] = 3] = "U2F"; AuthFactors[AuthFactors["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(AuthFactors || (AuthFactors = {})); export function authFactorsFromJSON(object) { switch (object) { case 0: case "OTP": return AuthFactors.OTP; case 1: case "OTP_SMS": return AuthFactors.OTP_SMS; case 2: case "OTP_EMAIL": return AuthFactors.OTP_EMAIL; case 3: case "U2F": return AuthFactors.U2F; case -1: case "UNRECOGNIZED": default: return AuthFactors.UNRECOGNIZED; } } export function authFactorsToJSON(object) { switch (object) { case AuthFactors.OTP: return "OTP"; case AuthFactors.OTP_SMS: return "OTP_SMS"; case AuthFactors.OTP_EMAIL: return "OTP_EMAIL"; case AuthFactors.U2F: return "U2F"; case AuthFactors.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } function createBaseAddHumanUserRequest() { return { userId: undefined, username: undefined, organization: undefined, profile: undefined, email: undefined, phone: undefined, metadata: [], password: undefined, hashedPassword: undefined, idpLinks: [], totpSecret: undefined, }; } export const AddHumanUserRequest = { encode(message, writer = new BinaryWriter()) { if (message.userId !== undefined) { writer.uint32(10).string(message.userId); } if (message.username !== undefined) { writer.uint32(18).string(message.username); } if (message.organization !== undefined) { Organization.encode(message.organization, writer.uint32(90).fork()).join(); } if (message.profile !== undefined) { SetHumanProfile.encode(message.profile, writer.uint32(34).fork()).join(); } if (message.email !== undefined) { SetHumanEmail.encode(message.email, writer.uint32(42).fork()).join(); } if (message.phone !== undefined) { SetHumanPhone.encode(message.phone, writer.uint32(82).fork()).join(); } for (const v of message.metadata) { SetMetadataEntry.encode(v, writer.uint32(50).fork()).join(); } if (message.password !== undefined) { Password.encode(message.password, writer.uint32(58).fork()).join(); } if (message.hashedPassword !== undefined) { HashedPassword.encode(message.hashedPassword, writer.uint32(66).fork()).join(); } for (const v of message.idpLinks) { IDPLink.encode(v, writer.uint32(74).fork()).join(); } if (message.totpSecret !== undefined) { writer.uint32(98).string(message.totpSecret); } 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 = createBaseAddHumanUserRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.userId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.username = reader.string(); continue; } case 11: { if (tag !== 90) { break; } message.organization = Organization.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 34) { break; } message.profile = SetHumanProfile.decode(reader, reader.uint32()); continue; } case 5: { if (tag !== 42) { break; } message.email = SetHumanEmail.decode(reader, reader.uint32()); continue; } case 10: { if (tag !== 82) { break; } message.phone = SetHumanPhone.decode(reader, reader.uint32()); continue; } case 6: { if (tag !== 50) { break; } message.metadata.push(SetMetadataEntry.decode(reader, reader.uint32())); continue; } case 7: { if (tag !== 58) { break; } message.password = Password.decode(reader, reader.uint32()); continue; } case 8: { if (tag !== 66) { break; } message.hashedPassword = HashedPassword.decode(reader, reader.uint32()); continue; } case 9: { if (tag !== 74) { break; } message.idpLinks.push(IDPLink.decode(reader, reader.uint32())); continue; } case 12: { if (tag !== 98) { break; } message.totpSecret = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { userId: isSet(object.userId) ? globalThis.String(object.userId) : undefined, username: isSet(object.username) ? globalThis.String(object.username) : undefined, organization: isSet(object.organization) ? Organization.fromJSON(object.organization) : undefined, profile: isSet(object.profile) ? SetHumanProfile.fromJSON(object.profile) : undefined, email: isSet(object.email) ? SetHumanEmail.fromJSON(object.email) : undefined, phone: isSet(object.phone) ? SetHumanPhone.fromJSON(object.phone) : undefined, metadata: globalThis.Array.isArray(object?.metadata) ? object.metadata.map((e) => SetMetadataEntry.fromJSON(e)) : [], password: isSet(object.password) ? Password.fromJSON(object.password) : undefined, hashedPassword: isSet(object.hashedPassword) ? HashedPassword.fromJSON(object.hashedPassword) : undefined, idpLinks: globalThis.Array.isArray(object?.idpLinks) ? object.idpLinks.map((e) => IDPLink.fromJSON(e)) : [], totpSecret: isSet(object.totpSecret) ? globalThis.String(object.totpSecret) : undefined, }; }, toJSON(message) { const obj = {}; if (message.userId !== undefined) { obj.userId = message.userId; } if (message.username !== undefined) { obj.username = message.username; } if (message.organization !== undefined) { obj.organization = Organization.toJSON(message.organization); } if (message.profile !== undefined) { obj.profile = SetHumanProfile.toJSON(message.profile); } if (message.email !== undefined) { obj.email = SetHumanEmail.toJSON(message.email); } if (message.phone !== undefined) { obj.phone = SetHumanPhone.toJSON(message.phone); } if (message.metadata?.length) { obj.metadata = message.metadata.map((e) => SetMetadataEntry.toJSON(e)); } if (message.password !== undefined) { obj.password = Password.toJSON(message.password); } if (message.hashedPassword !== undefined) { obj.hashedPassword = HashedPassword.toJSON(message.hashedPassword); } if (message.idpLinks?.length) { obj.idpLinks = message.idpLinks.map((e) => IDPLink.toJSON(e)); } if (message.totpSecret !== undefined) { obj.totpSecret = message.totpSecret; } return obj; }, create(base) { return AddHumanUserRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseAddHumanUserRequest(); message.userId = object.userId ?? undefined; message.username = object.username ?? undefined; message.organization = (object.organization !== undefined && object.organization !== null) ? Organization.fromPartial(object.organization) : undefined; message.profile = (object.profile !== undefined && object.profile !== null) ? SetHumanProfile.fromPartial(object.profile) : undefined; message.email = (object.email !== undefined && object.email !== null) ? SetHumanEmail.fromPartial(object.email) : undefined; message.phone = (object.phone !== undefined && object.phone !== null) ? SetHumanPhone.fromPartial(object.phone) : undefined; message.metadata = object.metadata?.map((e) => SetMetadataEntry.fromPartial(e)) || []; message.password = (object.password !== undefined && object.password !== null) ? Password.fromPartial(object.password) : undefined; message.hashedPassword = (object.hashedPassword !== undefined && object.hashedPassword !== null) ? HashedPassword.fromPartial(object.hashedPassword) : undefined; message.idpLinks = object.idpLinks?.map((e) => IDPLink.fromPartial(e)) || []; message.totpSecret = object.totpSecret ?? undefined; return message; }, }; function createBaseAddHumanUserResponse() { return { userId: "", details: undefined, emailCode: undefined, phoneCode: undefined }; } export const AddHumanUserResponse = { encode(message, writer = new BinaryWriter()) { if (message.userId !== "") { writer.uint32(10).string(message.userId); } if (message.details !== undefined) { Details.encode(message.details, writer.uint32(18).fork()).join(); } if (message.emailCode !== undefined) { writer.uint32(26).string(message.emailCode); } if (message.phoneCode !== undefined) { writer.uint32(34).string(message.phoneCode); } 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 = createBaseAddHumanUserResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.userId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.details = Details.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.emailCode = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.phoneCode = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { userId: isSet(object.userId) ? globalThis.String(object.userId) : "", details: isSet(object.details) ? Details.fromJSON(object.details) : undefined, emailCode: isSet(object.emailCode) ? globalThis.String(object.emailCode) : undefined, phoneCode: isSet(object.phoneCode) ? globalThis.String(object.phoneCode) : undefined, }; }, toJSON(message) { const obj = {}; if (message.userId !== "") { obj.userId = message.userId; } if (message.details !== undefined) { obj.details = Details.toJSON(message.details); } if (message.emailCode !== undefined) { obj.emailCode = message.emailCode; } if (message.phoneCode !== undefined) { obj.phoneCode = message.phoneCode; } return obj; }, create(base) { return AddHumanUserResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseAddHumanUserResponse(); message.userId = object.userId ?? ""; message.details = (object.details !== undefined && object.details !== null) ? Details.fromPartial(object.details) : undefined; message.emailCode = object.emailCode ?? undefined; message.phoneCode = object.phoneCode ?? undefined; return message; }, }; function createBaseCreateUserRequest() { return { organizationId: "", userId: undefined, username: undefined, human: undefined, machine: undefined }; } export const CreateUserRequest = { encode(message, writer = new BinaryWriter()) { if (message.organizationId !== "") { writer.uint32(10).string(message.organizationId); } if (message.userId !== undefined) { writer.uint32(18).string(message.userId); } if (message.username !== undefined) { writer.uint32(26).string(message.username); } if (message.human !== undefined) { CreateUserRequest_Human.encode(message.human, writer.uint32(34).fork()).join(); } if (message.machine !== undefined) { CreateUserRequest_Machine.encode(message.machine, writer.uint32(42).fork()).join(); } 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 = createBaseCreateUserRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.organizationId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.userId = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.username = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.human = CreateUserRequest_Human.decode(reader, reader.uint32()); continue; } case 5: { if (tag !== 42) { break; } message.machine = CreateUserRequest_Machine.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { organizationId: isSet(object.organizationId) ? globalThis.String(object.organizationId) : "", userId: isSet(object.userId) ? globalThis.String(object.userId) : undefined, username: isSet(object.username) ? globalThis.String(object.username) : undefined, human: isSet(object.human) ? CreateUserRequest_Human.fromJSON(object.human) : undefined, machine: isSet(object.machine) ? CreateUserRequest_Machine.fromJSON(object.machine) : undefined, }; }, toJSON(message) { const obj = {}; if (message.organizationId !== "") { obj.organizationId = message.organizationId; } if (message.userId !== undefined) { obj.userId = message.userId; } if (message.username !== undefined) { obj.username = message.username; } if (message.human !== undefined) { obj.human = CreateUserRequest_Human.toJSON(message.human); } if (message.machine !== undefined) { obj.machine = CreateUserRequest_Machine.toJSON(message.machine); } return obj; }, create(base) { return CreateUserRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseCreateUserRequest(); message.organizationId = object.organizationId ?? ""; message.userId = object.userId ?? undefined; message.username = object.username ?? undefined; message.human = (object.human !== undefined && object.human !== null) ? CreateUserRequest_Human.fromPartial(object.human) : undefined; message.machine = (object.machine !== undefined && object.machine !== null) ? CreateUserRequest_Machine.fromPartial(object.machine) : undefined; return message; }, }; function createBaseCreateUserRequest_Human() { return { profile: undefined, email: undefined, phone: undefined, password: undefined, hashedPassword: undefined, idpLinks: [], totpSecret: undefined, }; } export const CreateUserRequest_Human = { encode(message, writer = new BinaryWriter()) { if (message.profile !== undefined) { SetHumanProfile.encode(message.profile, writer.uint32(10).fork()).join(); } if (message.email !== undefined) { SetHumanEmail.encode(message.email, writer.uint32(18).fork()).join(); } if (message.phone !== undefined) { SetHumanPhone.encode(message.phone, writer.uint32(26).fork()).join(); } if (message.password !== undefined) { Password.encode(message.password, writer.uint32(34).fork()).join(); } if (message.hashedPassword !== undefined) { HashedPassword.encode(message.hashedPassword, writer.uint32(42).fork()).join(); } for (const v of message.idpLinks) { IDPLink.encode(v, writer.uint32(58).fork()).join(); } if (message.totpSecret !== undefined) { writer.uint32(66).string(message.totpSecret); } 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 = createBaseCreateUserRequest_Human(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.profile = SetHumanProfile.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.email = SetHumanEmail.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.phone = SetHumanPhone.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 34) { break; } message.password = Password.decode(reader, reader.uint32()); continue; } case 5: { if (tag !== 42) { break; } message.hashedPassword = HashedPassword.decode(reader, reader.uint32()); continue; } case 7: { if (tag !== 58) { break; } message.idpLinks.push(IDPLink.decode(reader, reader.uint32())); continue; } case 8: { if (tag !== 66) { break; } message.totpSecret = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { profile: isSet(object.profile) ? SetHumanProfile.fromJSON(object.profile) : undefined, email: isSet(object.email) ? SetHumanEmail.fromJSON(object.email) : undefined, phone: isSet(object.phone) ? SetHumanPhone.fromJSON(object.phone) : undefined, password: isSet(object.password) ? Password.fromJSON(object.password) : undefined, hashedPassword: isSet(object.hashedPassword) ? HashedPassword.fromJSON(object.hashedPassword) : undefined, idpLinks: globalThis.Array.isArray(object?.idpLinks) ? object.idpLinks.map((e) => IDPLink.fromJSON(e)) : [], totpSecret: isSet(object.totpSecret) ? globalThis.String(object.totpSecret) : undefined, }; }, toJSON(message) { const obj = {}; if (message.profile !== undefined) { obj.profile = SetHumanProfile.toJSON(message.profile); } if (message.email !== undefined) { obj.email = SetHumanEmail.toJSON(message.email); } if (message.phone !== undefined) { obj.phone = SetHumanPhone.toJSON(message.phone); } if (message.password !== undefined) { obj.password = Password.toJSON(message.password); } if (message.hashedPassword !== undefined) { obj.hashedPassword = HashedPassword.toJSON(message.hashedPassword); } if (message.idpLinks?.length) { obj.idpLinks = message.idpLinks.map((e) => IDPLink.toJSON(e)); } if (message.totpSecret !== undefined) { obj.totpSecret = message.totpSecret; } return obj; }, create(base) { return CreateUserRequest_Human.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseCreateUserRequest_Human(); message.profile = (object.profile !== undefined && object.profile !== null) ? SetHumanProfile.fromPartial(object.profile) : undefined; message.email = (object.email !== undefined && object.email !== null) ? SetHumanEmail.fromPartial(object.email) : undefined; message.phone = (object.phone !== undefined && object.phone !== null) ? SetHumanPhone.fromPartial(object.phone) : undefined; message.password = (object.password !== undefined && object.password !== null) ? Password.fromPartial(object.password) : undefined; message.hashedPassword = (object.hashedPassword !== undefined && object.hashedPassword !== null) ? HashedPassword.fromPartial(object.hashedPassword) : undefined; message.idpLinks = object.idpLinks?.map((e) => IDPLink.fromPartial(e)) || []; message.totpSecret = object.totpSecret ?? undefined; return message; }, }; function createBaseCreateUserRequest_Machine() { return { name: "", description: undefined }; } export const CreateUserRequest_Machine = { encode(message, writer = new BinaryWriter()) { if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.description !== undefined) { writer.uint32(18).string(message.description); } 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 = createBaseCreateUserRequest_Machine(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.name = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.description = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { name: isSet(object.name) ? globalThis.String(object.name) : "", description: isSet(object.description) ? globalThis.String(object.description) : undefined, }; }, toJSON(message) { const obj = {}; if (message.name !== "") { obj.name = message.name; } if (message.description !== undefined) { obj.description = message.description; } return obj; }, create(base) { return CreateUserRequest_Machine.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseCreateUserRequest_Machine(); message.name = object.name ?? ""; message.description = object.description ?? undefined; return message; }, }; function createBaseCreateUserResponse() { return { id: "", creationDate: undefined, emailCode: undefined, phoneCode: undefined }; } export const CreateUserResponse = { encode(message, writer = new BinaryWriter()) { if (message.id !== "") { writer.uint32(10).string(message.id); } if (message.creationDate !== undefined) { Timestamp.encode(toTimestamp(message.creationDate), writer.uint32(18).fork()).join(); } if (message.emailCode !== undefined) { writer.uint32(26).string(message.emailCode); } if (message.phoneCode !== undefined) { writer.uint32(34).string(message.phoneCode); } 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 = createBaseCreateUserResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.id = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.creationDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); continue; } case 3: { if (tag !== 26) { break; } message.emailCode = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.phoneCode = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { id: isSet(object.id) ? globalThis.String(object.id) : "", creationDate: isSet(object.creationDate) ? fromJsonTimestamp(object.creationDate) : undefined, emailCode: isSet(object.emailCode) ? globalThis.String(object.emailCode) : undefined, phoneCode: isSet(object.phoneCode) ? globalThis.String(object.phoneCode) : undefined, }; }, toJSON(message) { const obj = {}; if (message.id !== "") { obj.id = message.id; } if (message.creationDate !== undefined) { obj.creationDate = message.creationDate.toISOString(); } if (message.emailCode !== undefined) { obj.emailCode = message.emailCode; } if (message.phoneCode !== undefined) { obj.phoneCode = message.phoneCode; } return obj; }, create(base) { return CreateUserResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseCreateUserResponse(); message.id = object.id ?? ""; message.creationDate = object.creationDate ?? undefined; message.emailCode = object.emailCode ?? undefined; message.phoneCode = object.phoneCode ?? undefined; return message; }, }; function createBaseGetUserByIDRequest() { return { userId: "" }; } export const GetUserByIDRequest = { encode(message, writer = new BinaryWriter()) { if (message.userId !== "") { writer.uint32(10).string(message.userId); } 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 = createBaseGetUserByIDRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.userId = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { userId: isSet(object.userId) ? globalThis.String(object.userId) : "" }; }, toJSON(message) { const obj = {}; if (message.userId !== "") { obj.userId = message.userId; } return obj; }, create(base) { return GetUserByIDRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseGetUserByIDRequest(); message.userId = object.userId ?? ""; return message; }, }; function createBaseGetUserByIDResponse() { return { details: undefined, user: undefined }; } export const GetUserByIDResponse = { encode(message, writer = new BinaryWriter()) { if (message.details !== undefined) { Details.encode(message.details, writer.uint32(10).fork()).join(); } if (message.user !== undefined) { User.encode(message.user, writer.uint32(18).fork()).join(); } 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 = createBaseGetUserByIDResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.details = Details.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.user = User.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { details: isSet(object.details) ? Details.fromJSON(object.details) : undefined, user: isSet(object.user) ? User.fromJSON(object.user) : undefined, }; }, toJSON(message) { const obj = {}; if (message.details !== undefined) { obj.details = Details.toJSON(message.details); } if (message.user !== undefined) { obj.user = User.toJSON(message.user); } return obj; }, create(base) { return GetUserByIDResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseGetUserByIDResponse(); message.details = (object.details !== undefined && object.details !== null) ? Details.fromPartial(object.details) : undefined; message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; return message; }, }; function createBaseListUsersRequest() { return { query: undefined, sortingColumn: 0, queries: [] }; } export const ListUsersRequest = { encode(message, writer = new BinaryWriter()) { if (message.query !== undefined) { ListQuery.encode(message.query, writer.uint32(10).fork()).join(); } if (message.sortingColumn !== 0) { writer.uint32(16).int32(message.sortingColumn); } for (const v of message.queries) { SearchQuery.encode(v, writer.uint32(26).fork()).join(); } 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 = createBaseListUsersRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.query = ListQuery.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 16) { break; } message.sortingColumn = reader.int32(); continue; } case 3: { if (tag !== 26) { break; } message.queries.push(SearchQuery.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { query: isSet(object.query) ? ListQuery.fromJSON(object.query) : undefined, sortingColumn: isSet(object.sortingColumn) ? userFieldNameFromJSON(object.sortingColumn) : 0, queries: globalThis.Array.isArray(object?.queries) ? object.queries.map((e) => SearchQuery.fromJSON(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.query !== undefined) { obj.query = ListQuery.toJSON(message.query); } if (message.sortingColumn !== 0) { obj.sortingColumn = userFieldNameToJSON(message.sortingColumn); } if (message.queries?.length) { obj.queries = message.queries.map((e) => SearchQuery.toJSON(e)); } return obj; }, create(base) { return ListUsersRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseListUsersRequest(); message.query = (object.query !== undefined && object.query !== null) ? ListQuery.fromPartial(object.query) : undefined; message.sortingColumn = object.sortingColumn ?? 0; message.queries = object.queries?.map((e) => SearchQuery.fromPartial(e)) || []; return message; }, }; function createBaseListUsersResponse() { return { details: undefined, sortingColumn: 0, result: [] }; } export const ListUsersResponse = { encode(message, writer = new BinaryWriter()) { if (message.details !== undefined) { ListDetails.encode(message.details, writer.uint32(10).fork()).join(); } if (message.sortingColumn !== 0) { writer.uint32(16).int32(message.sortingColumn); } for (const v of message.result) { User.encode(v, writer.uint32(26).fork()).join(); } 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 = createBaseListUsersResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.details = ListDetails.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 16) { break; } message.sortingColumn = reader.int32(); continue; } case 3: { if (tag !== 26) { break; } message.result.push(User.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { details: isSet(object.details) ? ListDetails.fromJSON(object.details) : undefined, sortingColumn: isSet(object.sortingColumn) ? userFieldNameFromJSON(object.sortingColumn) : 0, result: globalThis.Array.isArray(object?.result) ? object.result.map((e) => User.fromJSON(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.details !== undefined) { obj.details = ListDetails.toJSON(message.details); } if (message.sortingColumn !== 0) { obj.sortingColumn = userFieldNameToJSON(message.sortingColumn); } if (message.result?.length) { obj.result = message.result.map((e) => User.toJSON(e)); } return obj; }, create(base) { return ListUsersResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseListUsersResponse(); message.details = (object.details !== undefined && object.details !== null) ? ListDetails.fromPartial(object.details) : undefined; message.sortingColumn = object.sortingColumn ?? 0; message.result = object.result?.map((e) => User.fromPartial(e)) || []; return message; }, }; function createBaseSetEmailRequest() { return { userId: "", email: "", sendCode: undefined, returnCode: undefined, isVerified: undefined }; } export const SetEmailRequest = { encode(message, writer = new BinaryWriter()) { if (message.userId !== "") { writer.uint32(10).string(message.userId); } if (message.email !== "") { writer.uint32(18).string(message.email); } if (message.sendCode !== undefined) { SendEmailVerificationCode.encode(message.sendCode, writer.uint32(26).fork()).join(); } if (message.returnCode !== undefined) { ReturnEmailVerificationCode.encode(message.returnCode, writer.uint32(34).fork()).join(); } if (message.isVerified !== undefined) { writer.uint32(40).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 = createBaseSetEmailRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.userId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.email = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.sendCode = SendEmailVerificationCode.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 34) { break; } message.returnCode = ReturnEmailVerificationCode.decode(reader, reader.uint32()); continue; } case 5: { if (tag !== 40) { break; } message.isVerified = reader.bool(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { userId: isSet(object.userId) ? globalThis.String(object.userId) : "", email: isSet(object.email) ? globalThis.String(object.email) : "", sendCode: isSet(object.sendCode) ? SendEmailVerificationCode.fromJSON(object.sendCode) : undefined, returnCode: isSet(object.returnCode) ? ReturnEmailVerificationC