Skip to content

Commit 23419be

Browse files
easyCZroboquat
authored andcommitted
[usage] Remove BillingService.SetBilledSession proto
1 parent b1032c3 commit 23419be

File tree

6 files changed

+81
-669
lines changed

6 files changed

+81
-669
lines changed

components/usage-api/go/v1/billing.pb.go

Lines changed: 81 additions & 291 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/usage-api/go/v1/billing_grpc.pb.go

Lines changed: 0 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/usage-api/typescript/src/usage/v1/billing.pb.ts

Lines changed: 0 additions & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,9 @@
88
import * as Long from "long";
99
import { CallContext, CallOptions } from "nice-grpc-common";
1010
import * as _m0 from "protobufjs/minimal";
11-
import { Timestamp } from "../../google/protobuf/timestamp.pb";
1211

1312
export const protobufPackage = "usage.v1";
1413

15-
export enum System {
16-
SYSTEM_UNKNOWN = "SYSTEM_UNKNOWN",
17-
SYSTEM_CHARGEBEE = "SYSTEM_CHARGEBEE",
18-
SYSTEM_STRIPE = "SYSTEM_STRIPE",
19-
UNRECOGNIZED = "UNRECOGNIZED",
20-
}
21-
22-
export function systemFromJSON(object: any): System {
23-
switch (object) {
24-
case 0:
25-
case "SYSTEM_UNKNOWN":
26-
return System.SYSTEM_UNKNOWN;
27-
case 1:
28-
case "SYSTEM_CHARGEBEE":
29-
return System.SYSTEM_CHARGEBEE;
30-
case 2:
31-
case "SYSTEM_STRIPE":
32-
return System.SYSTEM_STRIPE;
33-
case -1:
34-
case "UNRECOGNIZED":
35-
default:
36-
return System.UNRECOGNIZED;
37-
}
38-
}
39-
40-
export function systemToJSON(object: System): string {
41-
switch (object) {
42-
case System.SYSTEM_UNKNOWN:
43-
return "SYSTEM_UNKNOWN";
44-
case System.SYSTEM_CHARGEBEE:
45-
return "SYSTEM_CHARGEBEE";
46-
case System.SYSTEM_STRIPE:
47-
return "SYSTEM_STRIPE";
48-
case System.UNRECOGNIZED:
49-
default:
50-
return "UNRECOGNIZED";
51-
}
52-
}
53-
54-
export function systemToNumber(object: System): number {
55-
switch (object) {
56-
case System.SYSTEM_UNKNOWN:
57-
return 0;
58-
case System.SYSTEM_CHARGEBEE:
59-
return 1;
60-
case System.SYSTEM_STRIPE:
61-
return 2;
62-
case System.UNRECOGNIZED:
63-
default:
64-
return -1;
65-
}
66-
}
67-
6814
export interface ReconcileInvoicesRequest {
6915
}
7016

@@ -97,19 +43,6 @@ export interface CancelSubscriptionRequest {
9743
export interface CancelSubscriptionResponse {
9844
}
9945

100-
/**
101-
* If there are two billable sessions for this instance ID,
102-
* the second one's "from" will be the first one's "to"
103-
*/
104-
export interface SetBilledSessionRequest {
105-
instanceId: string;
106-
from: Date | undefined;
107-
system: System;
108-
}
109-
110-
export interface SetBilledSessionResponse {
111-
}
112-
11346
function createBaseReconcileInvoicesRequest(): ReconcileInvoicesRequest {
11447
return {};
11548
}
@@ -494,112 +427,6 @@ export const CancelSubscriptionResponse = {
494427
},
495428
};
496429

497-
function createBaseSetBilledSessionRequest(): SetBilledSessionRequest {
498-
return { instanceId: "", from: undefined, system: System.SYSTEM_UNKNOWN };
499-
}
500-
501-
export const SetBilledSessionRequest = {
502-
encode(message: SetBilledSessionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
503-
if (message.instanceId !== "") {
504-
writer.uint32(10).string(message.instanceId);
505-
}
506-
if (message.from !== undefined) {
507-
Timestamp.encode(toTimestamp(message.from), writer.uint32(18).fork()).ldelim();
508-
}
509-
if (message.system !== System.SYSTEM_UNKNOWN) {
510-
writer.uint32(24).int32(systemToNumber(message.system));
511-
}
512-
return writer;
513-
},
514-
515-
decode(input: _m0.Reader | Uint8Array, length?: number): SetBilledSessionRequest {
516-
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
517-
let end = length === undefined ? reader.len : reader.pos + length;
518-
const message = createBaseSetBilledSessionRequest();
519-
while (reader.pos < end) {
520-
const tag = reader.uint32();
521-
switch (tag >>> 3) {
522-
case 1:
523-
message.instanceId = reader.string();
524-
break;
525-
case 2:
526-
message.from = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
527-
break;
528-
case 3:
529-
message.system = systemFromJSON(reader.int32());
530-
break;
531-
default:
532-
reader.skipType(tag & 7);
533-
break;
534-
}
535-
}
536-
return message;
537-
},
538-
539-
fromJSON(object: any): SetBilledSessionRequest {
540-
return {
541-
instanceId: isSet(object.instanceId) ? String(object.instanceId) : "",
542-
from: isSet(object.from) ? fromJsonTimestamp(object.from) : undefined,
543-
system: isSet(object.system) ? systemFromJSON(object.system) : System.SYSTEM_UNKNOWN,
544-
};
545-
},
546-
547-
toJSON(message: SetBilledSessionRequest): unknown {
548-
const obj: any = {};
549-
message.instanceId !== undefined && (obj.instanceId = message.instanceId);
550-
message.from !== undefined && (obj.from = message.from.toISOString());
551-
message.system !== undefined && (obj.system = systemToJSON(message.system));
552-
return obj;
553-
},
554-
555-
fromPartial(object: DeepPartial<SetBilledSessionRequest>): SetBilledSessionRequest {
556-
const message = createBaseSetBilledSessionRequest();
557-
message.instanceId = object.instanceId ?? "";
558-
message.from = object.from ?? undefined;
559-
message.system = object.system ?? System.SYSTEM_UNKNOWN;
560-
return message;
561-
},
562-
};
563-
564-
function createBaseSetBilledSessionResponse(): SetBilledSessionResponse {
565-
return {};
566-
}
567-
568-
export const SetBilledSessionResponse = {
569-
encode(_: SetBilledSessionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
570-
return writer;
571-
},
572-
573-
decode(input: _m0.Reader | Uint8Array, length?: number): SetBilledSessionResponse {
574-
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
575-
let end = length === undefined ? reader.len : reader.pos + length;
576-
const message = createBaseSetBilledSessionResponse();
577-
while (reader.pos < end) {
578-
const tag = reader.uint32();
579-
switch (tag >>> 3) {
580-
default:
581-
reader.skipType(tag & 7);
582-
break;
583-
}
584-
}
585-
return message;
586-
},
587-
588-
fromJSON(_: any): SetBilledSessionResponse {
589-
return {};
590-
},
591-
592-
toJSON(_: SetBilledSessionResponse): unknown {
593-
const obj: any = {};
594-
return obj;
595-
},
596-
597-
fromPartial(_: DeepPartial<SetBilledSessionResponse>): SetBilledSessionResponse {
598-
const message = createBaseSetBilledSessionResponse();
599-
return message;
600-
},
601-
};
602-
603430
export type BillingServiceDefinition = typeof BillingServiceDefinition;
604431
export const BillingServiceDefinition = {
605432
name: "BillingService",
@@ -650,15 +477,6 @@ export const BillingServiceDefinition = {
650477
responseStream: false,
651478
options: {},
652479
},
653-
/** SetBilledSession marks an instance as billed with a billing system */
654-
setBilledSession: {
655-
name: "SetBilledSession",
656-
requestType: SetBilledSessionRequest,
657-
requestStream: false,
658-
responseType: SetBilledSessionResponse,
659-
responseStream: false,
660-
options: {},
661-
},
662480
},
663481
} as const;
664482

@@ -692,11 +510,6 @@ export interface BillingServiceServiceImplementation<CallContextExt = {}> {
692510
request: CancelSubscriptionRequest,
693511
context: CallContext & CallContextExt,
694512
): Promise<DeepPartial<CancelSubscriptionResponse>>;
695-
/** SetBilledSession marks an instance as billed with a billing system */
696-
setBilledSession(
697-
request: SetBilledSessionRequest,
698-
context: CallContext & CallContextExt,
699-
): Promise<DeepPartial<SetBilledSessionResponse>>;
700513
}
701514

702515
export interface BillingServiceClient<CallOptionsExt = {}> {
@@ -729,11 +542,6 @@ export interface BillingServiceClient<CallOptionsExt = {}> {
729542
request: DeepPartial<CancelSubscriptionRequest>,
730543
options?: CallOptions & CallOptionsExt,
731544
): Promise<CancelSubscriptionResponse>;
732-
/** SetBilledSession marks an instance as billed with a billing system */
733-
setBilledSession(
734-
request: DeepPartial<SetBilledSessionRequest>,
735-
options?: CallOptions & CallOptionsExt,
736-
): Promise<SetBilledSessionResponse>;
737545
}
738546

739547
export interface DataLoaderOptions {
@@ -771,28 +579,6 @@ export type DeepPartial<T> = T extends Builtin ? T
771579
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
772580
: Partial<T>;
773581

774-
function toTimestamp(date: Date): Timestamp {
775-
const seconds = date.getTime() / 1_000;
776-
const nanos = (date.getTime() % 1_000) * 1_000_000;
777-
return { seconds, nanos };
778-
}
779-
780-
function fromTimestamp(t: Timestamp): Date {
781-
let millis = t.seconds * 1_000;
782-
millis += t.nanos / 1_000_000;
783-
return new Date(millis);
784-
}
785-
786-
function fromJsonTimestamp(o: any): Date {
787-
if (o instanceof Date) {
788-
return o;
789-
} else if (typeof o === "string") {
790-
return new Date(o);
791-
} else {
792-
return fromTimestamp(Timestamp.fromJSON(o));
793-
}
794-
}
795-
796582
function longToNumber(long: Long): number {
797583
if (long.gt(Number.MAX_SAFE_INTEGER)) {
798584
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");

components/usage-api/usage/v1/billing.proto

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ package usage.v1;
44

55
option go_package = "github.com/gitpod-io/gitpod/usage-api/v1";
66

7-
import "google/protobuf/timestamp.proto";
8-
97
service BillingService {
108
// ReconcileInvoices retrieves current credit balance and reflects it in billing system.
119
// Internal RPC, not intended for general consumption.
@@ -21,9 +19,6 @@ service BillingService {
2119
// CancelSubscription cancels a stripe subscription in our system
2220
// Called by a stripe webhook
2321
rpc CancelSubscription(CancelSubscriptionRequest) returns (CancelSubscriptionResponse) {};
24-
25-
// SetBilledSession marks an instance as billed with a billing system
26-
rpc SetBilledSession(SetBilledSessionRequest) returns (SetBilledSessionResponse) {};
2722
}
2823

2924
message ReconcileInvoicesRequest {}
@@ -57,20 +52,3 @@ message CancelSubscriptionRequest {
5752

5853
message CancelSubscriptionResponse {
5954
}
60-
61-
enum System {
62-
SYSTEM_UNKNOWN = 0;
63-
SYSTEM_CHARGEBEE = 1;
64-
SYSTEM_STRIPE = 2;
65-
}
66-
67-
// If there are two billable sessions for this instance ID,
68-
// the second one's "from" will be the first one's "to"
69-
message SetBilledSessionRequest {
70-
string instance_id = 1;
71-
google.protobuf.Timestamp from = 2;
72-
System system = 3;
73-
}
74-
75-
message SetBilledSessionResponse {
76-
}

0 commit comments

Comments
 (0)