@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
320 lines (319 loc) • 11.4 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc unknown
// source: zitadel/analytics/v2beta/telemetry_service.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InstanceInformation, ResourceCount } from "./telemetry.js";
export const protobufPackage = "zitadel.analytics.v2beta";
function createBaseReportBaseInformationRequest() {
return { systemId: "", version: "", instances: [] };
}
export const ReportBaseInformationRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.systemId !== "") {
writer.uint32(10).string(message.systemId);
}
if (message.version !== "") {
writer.uint32(18).string(message.version);
}
for (const v of message.instances) {
InstanceInformation.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 = createBaseReportBaseInformationRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.systemId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.version = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.instances.push(InstanceInformation.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
systemId: isSet(object.systemId) ? globalThis.String(object.systemId) : "",
version: isSet(object.version) ? globalThis.String(object.version) : "",
instances: globalThis.Array.isArray(object?.instances)
? object.instances.map((e) => InstanceInformation.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.systemId !== "") {
obj.systemId = message.systemId;
}
if (message.version !== "") {
obj.version = message.version;
}
if (message.instances?.length) {
obj.instances = message.instances.map((e) => InstanceInformation.toJSON(e));
}
return obj;
},
create(base) {
return ReportBaseInformationRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseReportBaseInformationRequest();
message.systemId = object.systemId ?? "";
message.version = object.version ?? "";
message.instances = object.instances?.map((e) => InstanceInformation.fromPartial(e)) || [];
return message;
},
};
function createBaseReportBaseInformationResponse() {
return { reportId: "" };
}
export const ReportBaseInformationResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.reportId !== "") {
writer.uint32(10).string(message.reportId);
}
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 = createBaseReportBaseInformationResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.reportId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { reportId: isSet(object.reportId) ? globalThis.String(object.reportId) : "" };
},
toJSON(message) {
const obj = {};
if (message.reportId !== "") {
obj.reportId = message.reportId;
}
return obj;
},
create(base) {
return ReportBaseInformationResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseReportBaseInformationResponse();
message.reportId = object.reportId ?? "";
return message;
},
};
function createBaseReportResourceCountsRequest() {
return { systemId: "", reportId: undefined, resourceCounts: [] };
}
export const ReportResourceCountsRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.systemId !== "") {
writer.uint32(10).string(message.systemId);
}
if (message.reportId !== undefined) {
writer.uint32(18).string(message.reportId);
}
for (const v of message.resourceCounts) {
ResourceCount.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 = createBaseReportResourceCountsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.systemId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.reportId = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.resourceCounts.push(ResourceCount.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
systemId: isSet(object.systemId) ? globalThis.String(object.systemId) : "",
reportId: isSet(object.reportId) ? globalThis.String(object.reportId) : undefined,
resourceCounts: globalThis.Array.isArray(object?.resourceCounts)
? object.resourceCounts.map((e) => ResourceCount.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.systemId !== "") {
obj.systemId = message.systemId;
}
if (message.reportId !== undefined) {
obj.reportId = message.reportId;
}
if (message.resourceCounts?.length) {
obj.resourceCounts = message.resourceCounts.map((e) => ResourceCount.toJSON(e));
}
return obj;
},
create(base) {
return ReportResourceCountsRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseReportResourceCountsRequest();
message.systemId = object.systemId ?? "";
message.reportId = object.reportId ?? undefined;
message.resourceCounts = object.resourceCounts?.map((e) => ResourceCount.fromPartial(e)) || [];
return message;
},
};
function createBaseReportResourceCountsResponse() {
return { reportId: "" };
}
export const ReportResourceCountsResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.reportId !== "") {
writer.uint32(10).string(message.reportId);
}
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 = createBaseReportResourceCountsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.reportId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { reportId: isSet(object.reportId) ? globalThis.String(object.reportId) : "" };
},
toJSON(message) {
const obj = {};
if (message.reportId !== "") {
obj.reportId = message.reportId;
}
return obj;
},
create(base) {
return ReportResourceCountsResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseReportResourceCountsResponse();
message.reportId = object.reportId ?? "";
return message;
},
};
export const TelemetryServiceDefinition = {
name: "TelemetryService",
fullName: "zitadel.analytics.v2beta.TelemetryService",
methods: {
/**
* ReportBaseInformation is used to report the base information of the ZITADEL system,
* including the version, instances, their creation date and domains.
* The response contains a report ID to link it to the resource counts or other reports.
* The report ID is only valid for the same system ID.
*/
reportBaseInformation: {
name: "ReportBaseInformation",
requestType: ReportBaseInformationRequest,
requestStream: false,
responseType: ReportBaseInformationResponse,
responseStream: false,
options: {},
},
/**
* ReportResourceCounts is used to report the resource counts such as amount of organizations
* or users per organization and much more.
* Since the resource counts can be reported in multiple batches,
* the response contains a report ID to continue reporting.
* The report ID is only valid for the same system ID.
*/
reportResourceCounts: {
name: "ReportResourceCounts",
requestType: ReportResourceCountsRequest,
requestStream: false,
responseType: ReportResourceCountsResponse,
responseStream: false,
options: {},
},
},
};
function isSet(value) {
return value !== null && value !== undefined;
}