Skip to content

Commit

Permalink
[billing] Add ReconcileInvoices RPC to BillingService protos
Browse files Browse the repository at this point in the history
  • Loading branch information
easyCZ committed Sep 7, 2022
1 parent 2882e7e commit 33d67f5
Show file tree
Hide file tree
Showing 7 changed files with 603 additions and 109 deletions.
332 changes: 223 additions & 109 deletions components/usage-api/go/v1/billing.pb.go

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions components/usage-api/go/v1/billing_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions components/usage-api/typescript/src/usage/v1/billing_grpc_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as usage_v1_usage_pb from "../../usage/v1/usage_pb";

interface IBillingServiceService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
updateInvoices: IBillingServiceService_IUpdateInvoices;
reconcileInvoices: IBillingServiceService_IReconcileInvoices;
getUpcomingInvoice: IBillingServiceService_IGetUpcomingInvoice;
finalizeInvoice: IBillingServiceService_IFinalizeInvoice;
setBilledSession: IBillingServiceService_ISetBilledSession;
Expand All @@ -31,6 +32,15 @@ interface IBillingServiceService_IUpdateInvoices extends grpc.MethodDefinition<u
responseSerialize: grpc.serialize<usage_v1_billing_pb.UpdateInvoicesResponse>;
responseDeserialize: grpc.deserialize<usage_v1_billing_pb.UpdateInvoicesResponse>;
}
interface IBillingServiceService_IReconcileInvoices extends grpc.MethodDefinition<usage_v1_billing_pb.ReconcileInvoicesRequest, usage_v1_billing_pb.ReconcileInvoicesResponse> {
path: "/usage.v1.BillingService/ReconcileInvoices";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<usage_v1_billing_pb.ReconcileInvoicesRequest>;
requestDeserialize: grpc.deserialize<usage_v1_billing_pb.ReconcileInvoicesRequest>;
responseSerialize: grpc.serialize<usage_v1_billing_pb.ReconcileInvoicesResponse>;
responseDeserialize: grpc.deserialize<usage_v1_billing_pb.ReconcileInvoicesResponse>;
}
interface IBillingServiceService_IGetUpcomingInvoice extends grpc.MethodDefinition<usage_v1_billing_pb.GetUpcomingInvoiceRequest, usage_v1_billing_pb.GetUpcomingInvoiceResponse> {
path: "/usage.v1.BillingService/GetUpcomingInvoice";
requestStream: false;
Expand Down Expand Up @@ -63,6 +73,7 @@ export const BillingServiceService: IBillingServiceService;

export interface IBillingServiceServer extends grpc.UntypedServiceImplementation {
updateInvoices: grpc.handleUnaryCall<usage_v1_billing_pb.UpdateInvoicesRequest, usage_v1_billing_pb.UpdateInvoicesResponse>;
reconcileInvoices: grpc.handleUnaryCall<usage_v1_billing_pb.ReconcileInvoicesRequest, usage_v1_billing_pb.ReconcileInvoicesResponse>;
getUpcomingInvoice: grpc.handleUnaryCall<usage_v1_billing_pb.GetUpcomingInvoiceRequest, usage_v1_billing_pb.GetUpcomingInvoiceResponse>;
finalizeInvoice: grpc.handleUnaryCall<usage_v1_billing_pb.FinalizeInvoiceRequest, usage_v1_billing_pb.FinalizeInvoiceResponse>;
setBilledSession: grpc.handleUnaryCall<usage_v1_billing_pb.SetBilledSessionRequest, usage_v1_billing_pb.SetBilledSessionResponse>;
Expand All @@ -72,6 +83,9 @@ export interface IBillingServiceClient {
updateInvoices(request: usage_v1_billing_pb.UpdateInvoicesRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.UpdateInvoicesResponse) => void): grpc.ClientUnaryCall;
updateInvoices(request: usage_v1_billing_pb.UpdateInvoicesRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.UpdateInvoicesResponse) => void): grpc.ClientUnaryCall;
updateInvoices(request: usage_v1_billing_pb.UpdateInvoicesRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.UpdateInvoicesResponse) => void): grpc.ClientUnaryCall;
reconcileInvoices(request: usage_v1_billing_pb.ReconcileInvoicesRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.ReconcileInvoicesResponse) => void): grpc.ClientUnaryCall;
reconcileInvoices(request: usage_v1_billing_pb.ReconcileInvoicesRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.ReconcileInvoicesResponse) => void): grpc.ClientUnaryCall;
reconcileInvoices(request: usage_v1_billing_pb.ReconcileInvoicesRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.ReconcileInvoicesResponse) => void): grpc.ClientUnaryCall;
getUpcomingInvoice(request: usage_v1_billing_pb.GetUpcomingInvoiceRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.GetUpcomingInvoiceResponse) => void): grpc.ClientUnaryCall;
getUpcomingInvoice(request: usage_v1_billing_pb.GetUpcomingInvoiceRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.GetUpcomingInvoiceResponse) => void): grpc.ClientUnaryCall;
getUpcomingInvoice(request: usage_v1_billing_pb.GetUpcomingInvoiceRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.GetUpcomingInvoiceResponse) => void): grpc.ClientUnaryCall;
Expand All @@ -88,6 +102,9 @@ export class BillingServiceClient extends grpc.Client implements IBillingService
public updateInvoices(request: usage_v1_billing_pb.UpdateInvoicesRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.UpdateInvoicesResponse) => void): grpc.ClientUnaryCall;
public updateInvoices(request: usage_v1_billing_pb.UpdateInvoicesRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.UpdateInvoicesResponse) => void): grpc.ClientUnaryCall;
public updateInvoices(request: usage_v1_billing_pb.UpdateInvoicesRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.UpdateInvoicesResponse) => void): grpc.ClientUnaryCall;
public reconcileInvoices(request: usage_v1_billing_pb.ReconcileInvoicesRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.ReconcileInvoicesResponse) => void): grpc.ClientUnaryCall;
public reconcileInvoices(request: usage_v1_billing_pb.ReconcileInvoicesRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.ReconcileInvoicesResponse) => void): grpc.ClientUnaryCall;
public reconcileInvoices(request: usage_v1_billing_pb.ReconcileInvoicesRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.ReconcileInvoicesResponse) => void): grpc.ClientUnaryCall;
public getUpcomingInvoice(request: usage_v1_billing_pb.GetUpcomingInvoiceRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.GetUpcomingInvoiceResponse) => void): grpc.ClientUnaryCall;
public getUpcomingInvoice(request: usage_v1_billing_pb.GetUpcomingInvoiceRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.GetUpcomingInvoiceResponse) => void): grpc.ClientUnaryCall;
public getUpcomingInvoice(request: usage_v1_billing_pb.GetUpcomingInvoiceRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: usage_v1_billing_pb.GetUpcomingInvoiceResponse) => void): grpc.ClientUnaryCall;
Expand Down
35 changes: 35 additions & 0 deletions components/usage-api/typescript/src/usage/v1/billing_grpc_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,28 @@ function deserialize_usage_v1_GetUpcomingInvoiceResponse(buffer_arg) {
return usage_v1_billing_pb.GetUpcomingInvoiceResponse.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_usage_v1_ReconcileInvoicesRequest(arg) {
if (!(arg instanceof usage_v1_billing_pb.ReconcileInvoicesRequest)) {
throw new Error('Expected argument of type usage.v1.ReconcileInvoicesRequest');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_usage_v1_ReconcileInvoicesRequest(buffer_arg) {
return usage_v1_billing_pb.ReconcileInvoicesRequest.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_usage_v1_ReconcileInvoicesResponse(arg) {
if (!(arg instanceof usage_v1_billing_pb.ReconcileInvoicesResponse)) {
throw new Error('Expected argument of type usage.v1.ReconcileInvoicesResponse');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_usage_v1_ReconcileInvoicesResponse(buffer_arg) {
return usage_v1_billing_pb.ReconcileInvoicesResponse.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_usage_v1_SetBilledSessionRequest(arg) {
if (!(arg instanceof usage_v1_billing_pb.SetBilledSessionRequest)) {
throw new Error('Expected argument of type usage.v1.SetBilledSessionRequest');
Expand Down Expand Up @@ -116,6 +138,19 @@ updateInvoices: {
responseSerialize: serialize_usage_v1_UpdateInvoicesResponse,
responseDeserialize: deserialize_usage_v1_UpdateInvoicesResponse,
},
// ReconcileInvoices retrieves current credit balance and reflects it in billing system.
// Internal RPC, not intended for general consumption.
reconcileInvoices: {
path: '/usage.v1.BillingService/ReconcileInvoices',
requestStream: false,
responseStream: false,
requestType: usage_v1_billing_pb.ReconcileInvoicesRequest,
responseType: usage_v1_billing_pb.ReconcileInvoicesResponse,
requestSerialize: serialize_usage_v1_ReconcileInvoicesRequest,
requestDeserialize: deserialize_usage_v1_ReconcileInvoicesRequest,
responseSerialize: serialize_usage_v1_ReconcileInvoicesResponse,
responseDeserialize: deserialize_usage_v1_ReconcileInvoicesResponse,
},
// GetUpcomingInvoice retrieves the latest invoice for a given query.
getUpcomingInvoice: {
path: '/usage.v1.BillingService/GetUpcomingInvoice',
Expand Down
34 changes: 34 additions & 0 deletions components/usage-api/typescript/src/usage/v1/billing_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,40 @@ export namespace UpdateInvoicesResponse {
}
}

export class ReconcileInvoicesRequest extends jspb.Message {

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ReconcileInvoicesRequest.AsObject;
static toObject(includeInstance: boolean, msg: ReconcileInvoicesRequest): ReconcileInvoicesRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ReconcileInvoicesRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ReconcileInvoicesRequest;
static deserializeBinaryFromReader(message: ReconcileInvoicesRequest, reader: jspb.BinaryReader): ReconcileInvoicesRequest;
}

export namespace ReconcileInvoicesRequest {
export type AsObject = {
}
}

export class ReconcileInvoicesResponse extends jspb.Message {

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ReconcileInvoicesResponse.AsObject;
static toObject(includeInstance: boolean, msg: ReconcileInvoicesResponse): ReconcileInvoicesResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ReconcileInvoicesResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ReconcileInvoicesResponse;
static deserializeBinaryFromReader(message: ReconcileInvoicesResponse, reader: jspb.BinaryReader): ReconcileInvoicesResponse;
}

export namespace ReconcileInvoicesResponse {
export type AsObject = {
}
}

export class GetUpcomingInvoiceRequest extends jspb.Message {

hasTeamId(): boolean;
Expand Down
Loading

0 comments on commit 33d67f5

Please sign in to comment.