Files
npm-viz-sdk/counter.ts
2025-08-21 14:45:32 +00:00

218 lines
11 KiB
TypeScript

// @generated by protobuf-ts 2.11.1 with parameter use_proto_field_name
// @generated from protobuf file "counter.proto" (package "vizapi", syntax proto3)
// tslint:disable
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { RequestSiteHeader } from "./core/shared";
import { RequestProjectHeader } from "./core/shared";
/**
* @generated from protobuf message vizapi.NextProjectCounterRequest
*/
export interface NextProjectCounterRequest {
/**
* @generated from protobuf field: api.RequestProjectHeader Header = 1
*/
Header?: RequestProjectHeader;
/**
* @generated from protobuf field: string Key = 2
*/
Key: string;
}
/**
* @generated from protobuf message vizapi.NextCounterResult
*/
export interface NextCounterResult {
/**
* @generated from protobuf field: int64 Value = 1
*/
Value: bigint;
}
/**
* @generated from protobuf message vizapi.NextSiteCounterRequest
*/
export interface NextSiteCounterRequest {
/**
* @generated from protobuf field: api.RequestSiteHeader Header = 1
*/
Header?: RequestSiteHeader;
/**
* @generated from protobuf field: string Key = 2
*/
Key: string;
}
// @generated message type with reflection information, may provide speed optimized methods
class NextProjectCounterRequest$Type extends MessageType<NextProjectCounterRequest> {
constructor() {
super("vizapi.NextProjectCounterRequest", [
{ no: 1, name: "Header", kind: "message", localName: "Header", jsonName: "Header", T: () => RequestProjectHeader, options: { "validate.rules": { message: { required: true } } } },
{ no: 2, name: "Key", kind: "scalar", localName: "Key", jsonName: "Key", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { example: "\"claims\"" }, "validate.rules": { string: { minLen: "1" } } } }
], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header", "Key"] } } });
}
create(value?: PartialMessage<NextProjectCounterRequest>): NextProjectCounterRequest {
const message = globalThis.Object.create((this.messagePrototype!));
message.Key = "";
if (value !== undefined)
reflectionMergePartial<NextProjectCounterRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: NextProjectCounterRequest): NextProjectCounterRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* api.RequestProjectHeader Header */ 1:
message.Header = RequestProjectHeader.internalBinaryRead(reader, reader.uint32(), options, message.Header);
break;
case /* string Key */ 2:
message.Key = reader.string();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: NextProjectCounterRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* api.RequestProjectHeader Header = 1; */
if (message.Header)
RequestProjectHeader.internalBinaryWrite(message.Header, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* string Key = 2; */
if (message.Key !== "")
writer.tag(2, WireType.LengthDelimited).string(message.Key);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message vizapi.NextProjectCounterRequest
*/
export const NextProjectCounterRequest = new NextProjectCounterRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class NextCounterResult$Type extends MessageType<NextCounterResult> {
constructor() {
super("vizapi.NextCounterResult", [
{ no: 1, name: "Value", kind: "scalar", localName: "Value", jsonName: "Value", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<NextCounterResult>): NextCounterResult {
const message = globalThis.Object.create((this.messagePrototype!));
message.Value = 0n;
if (value !== undefined)
reflectionMergePartial<NextCounterResult>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: NextCounterResult): NextCounterResult {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* int64 Value */ 1:
message.Value = reader.int64().toBigInt();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: NextCounterResult, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int64 Value = 1; */
if (message.Value !== 0n)
writer.tag(1, WireType.Varint).int64(message.Value);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message vizapi.NextCounterResult
*/
export const NextCounterResult = new NextCounterResult$Type();
// @generated message type with reflection information, may provide speed optimized methods
class NextSiteCounterRequest$Type extends MessageType<NextSiteCounterRequest> {
constructor() {
super("vizapi.NextSiteCounterRequest", [
{ no: 1, name: "Header", kind: "message", localName: "Header", jsonName: "Header", T: () => RequestSiteHeader, options: { "validate.rules": { message: { required: true } } } },
{ no: 2, name: "Key", kind: "scalar", localName: "Key", jsonName: "Key", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { example: "\"appointment\"" }, "validate.rules": { string: { minLen: "1" } } } }
], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["Header", "Key"] } } });
}
create(value?: PartialMessage<NextSiteCounterRequest>): NextSiteCounterRequest {
const message = globalThis.Object.create((this.messagePrototype!));
message.Key = "";
if (value !== undefined)
reflectionMergePartial<NextSiteCounterRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: NextSiteCounterRequest): NextSiteCounterRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* api.RequestSiteHeader Header */ 1:
message.Header = RequestSiteHeader.internalBinaryRead(reader, reader.uint32(), options, message.Header);
break;
case /* string Key */ 2:
message.Key = reader.string();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: NextSiteCounterRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* api.RequestSiteHeader Header = 1; */
if (message.Header)
RequestSiteHeader.internalBinaryWrite(message.Header, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* string Key = 2; */
if (message.Key !== "")
writer.tag(2, WireType.LengthDelimited).string(message.Key);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message vizapi.NextSiteCounterRequest
*/
export const NextSiteCounterRequest = new NextSiteCounterRequest$Type();
/**
* @generated ServiceType for protobuf service vizapi.ProjectCountersService
*/
export const ProjectCountersService = new ServiceType("vizapi.ProjectCountersService", [
{ name: "Next", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Project Counters"], summary: "Get the next value for a project key", description: "Get the next value for a project key" }, "api.rscType": "Project", "api.roles": "", "google.api.method_visibility": { restriction: "PUBLIC" } }, I: NextProjectCounterRequest, O: NextCounterResult }
], { "api.k8sService": "settings-server" });
/**
* @generated ServiceType for protobuf service vizapi.SiteCountersService
*/
export const SiteCountersService = new ServiceType("vizapi.SiteCountersService", [
{ name: "Next", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Site Counters"], summary: "Get the next value for a Site key", description: "Get the next value for a Site key" }, "api.rscType": "Site", "api.roles": "", "google.api.method_visibility": { restriction: "SLOTBOOKING_PUBLIC" } }, I: NextSiteCounterRequest, O: NextCounterResult }
], { "api.k8sService": "settings-server" });