@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
203 lines (202 loc) • 6.91 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc unknown
// source: zitadel/protoc_gen_zitadel/v2/options.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "zitadel.protoc_gen_zitadel.v2";
function createBaseOptions() {
return { authOption: undefined, httpResponse: undefined };
}
export const Options = {
encode(message, writer = new BinaryWriter()) {
if (message.authOption !== undefined) {
AuthOption.encode(message.authOption, writer.uint32(10).fork()).join();
}
if (message.httpResponse !== undefined) {
CustomHTTPResponse.encode(message.httpResponse, 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 = createBaseOptions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.authOption = AuthOption.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.httpResponse = CustomHTTPResponse.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
authOption: isSet(object.authOption) ? AuthOption.fromJSON(object.authOption) : undefined,
httpResponse: isSet(object.httpResponse) ? CustomHTTPResponse.fromJSON(object.httpResponse) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.authOption !== undefined) {
obj.authOption = AuthOption.toJSON(message.authOption);
}
if (message.httpResponse !== undefined) {
obj.httpResponse = CustomHTTPResponse.toJSON(message.httpResponse);
}
return obj;
},
create(base) {
return Options.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseOptions();
message.authOption = (object.authOption !== undefined && object.authOption !== null)
? AuthOption.fromPartial(object.authOption)
: undefined;
message.httpResponse = (object.httpResponse !== undefined && object.httpResponse !== null)
? CustomHTTPResponse.fromPartial(object.httpResponse)
: undefined;
return message;
},
};
function createBaseAuthOption() {
return { permission: "", orgField: "" };
}
export const AuthOption = {
encode(message, writer = new BinaryWriter()) {
if (message.permission !== "") {
writer.uint32(10).string(message.permission);
}
if (message.orgField !== "") {
writer.uint32(26).string(message.orgField);
}
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 = createBaseAuthOption();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.permission = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.orgField = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
permission: isSet(object.permission) ? globalThis.String(object.permission) : "",
orgField: isSet(object.orgField) ? globalThis.String(object.orgField) : "",
};
},
toJSON(message) {
const obj = {};
if (message.permission !== "") {
obj.permission = message.permission;
}
if (message.orgField !== "") {
obj.orgField = message.orgField;
}
return obj;
},
create(base) {
return AuthOption.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAuthOption();
message.permission = object.permission ?? "";
message.orgField = object.orgField ?? "";
return message;
},
};
function createBaseCustomHTTPResponse() {
return { successCode: 0 };
}
export const CustomHTTPResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.successCode !== 0) {
writer.uint32(8).int32(message.successCode);
}
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 = createBaseCustomHTTPResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.successCode = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { successCode: isSet(object.successCode) ? globalThis.Number(object.successCode) : 0 };
},
toJSON(message) {
const obj = {};
if (message.successCode !== 0) {
obj.successCode = Math.round(message.successCode);
}
return obj;
},
create(base) {
return CustomHTTPResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCustomHTTPResponse();
message.successCode = object.successCode ?? 0;
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}