Files
npm-core-sdk/billing.ts
2025-03-20 10:05:56 +00:00

209 lines
10 KiB
TypeScript

// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "billing.proto" (package "api", 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";
// =====================
// ===== Requests ======
// =====================
/**
* @generated from protobuf message api.GenerateRequest
*/
export interface GenerateRequest {
/**
* @generated from protobuf field: string OrganisationID = 1 [json_name = "OrganisationID"];
*/
organisationID: string;
/**
* @generated from protobuf field: string Comment = 2 [json_name = "Comment"];
*/
comment: string;
/**
* UTC date/time in <a href='https://en.wikipedia.org/wiki/ISO_8601'>ISO 8601</a> format
*
* @generated from protobuf field: string FromDate = 3 [json_name = "FromDate"];
*/
fromDate: string;
/**
* UTC date/time in <a href='https://en.wikipedia.org/wiki/ISO_8601'>ISO 8601</a> format
*
* @generated from protobuf field: string ToDate = 4 [json_name = "ToDate"];
*/
toDate: string;
/**
* @generated from protobuf field: api.GenerateBillingFormat OutputFormat = 5 [json_name = "OutputFormat"];
*/
outputFormat: GenerateBillingFormat;
}
// =====================
// ===== Responses =====
// =====================
/**
* @generated from protobuf message api.GenerateResult
*/
export interface GenerateResult {
/**
* @generated from protobuf field: string Output = 1 [json_name = "Output"];
*/
output: string;
}
/**
* @generated from protobuf enum api.GenerateBillingFormat
*/
export enum GenerateBillingFormat {
/**
* @generated from protobuf enum value: BILLING_FORMAT_PDF = 0;
*/
BILLING_FORMAT_PDF = 0,
/**
* @generated from protobuf enum value: BILLING_FORMAT_CSV = 1;
*/
BILLING_FORMAT_CSV = 1,
/**
* @generated from protobuf enum value: BILLING_FORMAT_JSON = 2;
*/
BILLING_FORMAT_JSON = 2
}
// @generated message type with reflection information, may provide speed optimized methods
class GenerateRequest$Type extends MessageType<GenerateRequest> {
constructor() {
super("api.GenerateRequest", [
{ no: 1, name: "OrganisationID", kind: "scalar", jsonName: "OrganisationID", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
{ no: 2, name: "Comment", kind: "scalar", jsonName: "Comment", T: 9 /*ScalarType.STRING*/ },
{ no: 3, name: "FromDate", kind: "scalar", jsonName: "FromDate", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { dateIso8601: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "UTC date/time in <a href='https://en.wikipedia.org/wiki/ISO_8601'>ISO 8601</a> format" } } },
{ no: 4, name: "ToDate", kind: "scalar", jsonName: "ToDate", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { dateIso8601: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "UTC date/time in <a href='https://en.wikipedia.org/wiki/ISO_8601'>ISO 8601</a> format" } } },
{ no: 5, name: "OutputFormat", kind: "enum", jsonName: "OutputFormat", T: () => ["api.GenerateBillingFormat", GenerateBillingFormat], options: { "validate.rules": { enum: { definedOnly: true } } } }
], { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema": { jsonSchema: { required: ["OrganisationID", "FromDate", "ToDate"] } } });
}
create(value?: PartialMessage<GenerateRequest>): GenerateRequest {
const message = globalThis.Object.create((this.messagePrototype!));
message.organisationID = "";
message.comment = "";
message.fromDate = "";
message.toDate = "";
message.outputFormat = 0;
if (value !== undefined)
reflectionMergePartial<GenerateRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GenerateRequest): GenerateRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string OrganisationID = 1 [json_name = "OrganisationID"];*/ 1:
message.organisationID = reader.string();
break;
case /* string Comment = 2 [json_name = "Comment"];*/ 2:
message.comment = reader.string();
break;
case /* string FromDate = 3 [json_name = "FromDate"];*/ 3:
message.fromDate = reader.string();
break;
case /* string ToDate = 4 [json_name = "ToDate"];*/ 4:
message.toDate = reader.string();
break;
case /* api.GenerateBillingFormat OutputFormat = 5 [json_name = "OutputFormat"];*/ 5:
message.outputFormat = reader.int32();
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: GenerateRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* string OrganisationID = 1 [json_name = "OrganisationID"]; */
if (message.organisationID !== "")
writer.tag(1, WireType.LengthDelimited).string(message.organisationID);
/* string Comment = 2 [json_name = "Comment"]; */
if (message.comment !== "")
writer.tag(2, WireType.LengthDelimited).string(message.comment);
/* string FromDate = 3 [json_name = "FromDate"]; */
if (message.fromDate !== "")
writer.tag(3, WireType.LengthDelimited).string(message.fromDate);
/* string ToDate = 4 [json_name = "ToDate"]; */
if (message.toDate !== "")
writer.tag(4, WireType.LengthDelimited).string(message.toDate);
/* api.GenerateBillingFormat OutputFormat = 5 [json_name = "OutputFormat"]; */
if (message.outputFormat !== 0)
writer.tag(5, WireType.Varint).int32(message.outputFormat);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message api.GenerateRequest
*/
export const GenerateRequest = new GenerateRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GenerateResult$Type extends MessageType<GenerateResult> {
constructor() {
super("api.GenerateResult", [
{ no: 1, name: "Output", kind: "scalar", jsonName: "Output", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value?: PartialMessage<GenerateResult>): GenerateResult {
const message = globalThis.Object.create((this.messagePrototype!));
message.output = "";
if (value !== undefined)
reflectionMergePartial<GenerateResult>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GenerateResult): GenerateResult {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string Output = 1 [json_name = "Output"];*/ 1:
message.output = 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: GenerateResult, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* string Output = 1 [json_name = "Output"]; */
if (message.output !== "")
writer.tag(1, WireType.LengthDelimited).string(message.output);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message api.GenerateResult
*/
export const GenerateResult = new GenerateResult$Type();
/**
* @generated ServiceType for protobuf service api.BillingService
*/
export const BillingService = new ServiceType("api.BillingService", [
{ name: "Generate", options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation": { tags: ["Billing"], description: "Generates billing report (pdf & csv) for a given organization during a given period" }, "api.rscType": "Platform", "api.roles": "Platform.Billing", "google.api.method_visibility": { restriction: "INTERNAL" } }, I: GenerateRequest, O: GenerateResult }
], { "api.k8sService": "billing-server" });