Source

  1. acme
  2. billing
  3. v1

invoice.proto

proto3 · package acme.billing.v1

1syntax = "proto3";
2
3package acme.billing.v1;
4
5import "acme/security/options.proto";
6import "acme/user/v1/user.proto";
7import "buf/validate/validate.proto";
8import "google/api/annotations.proto";
9import "google/api/field_behavior.proto";
10import "google/protobuf/timestamp.proto";
12option go_package = "acme.example/billing/v1;billingv1";
13option (acme.security.owner) = "billing";
15enum InvoiceState {
16 INVOICE_STATE_UNSPECIFIED = 0;
17 INVOICE_STATE_DRAFT = 1;
18 INVOICE_STATE_OPEN = 2;
19 INVOICE_STATE_PAID = 3;
20 INVOICE_STATE_VOID = 4;
23message Money {
24 string currency_code = 1 [(buf.validate.field).string = { min_len: 3, max_len: 3 }];
25 int64 units = 2;
26 int32 nanos = 3 [(buf.validate.field).int32 = { gte: -999999999, lte: 999999999 }];
29message LineItem {
30 string description = 1;
31 int32 quantity = 2 [(buf.validate.field).int32.gte = 1];
32 Money unit_amount = 3;
35// An invoice issued to a customer.
36message Invoice {
37 string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
38 string customer_id = 2 [(google.api.field_behavior) = REQUIRED];
39 acme.user.v1.User customer = 3;
40 InvoiceState state = 4;
41 repeated LineItem lines = 5 [(buf.validate.field).repeated.min_items = 1];
42 Money total = 6;
43 google.protobuf.Timestamp issued_at = 7;
44 string memo = 8;
47message GetInvoiceRequest {
48 string id = 1 [(google.api.field_behavior) = REQUIRED];
51message GetInvoiceResponse {
52 Invoice invoice = 1;
55message ListInvoicesRequest {
56 string customer_id = 1;
57 int32 page_size = 2;
58 string page_token = 3;
61message ListInvoicesResponse {
62 repeated Invoice invoices = 1;
63 string next_page_token = 2;
66// Billing RPCs for invoices and collections.
67service BillingService {
68 rpc GetInvoice(GetInvoiceRequest) returns (GetInvoiceResponse) {
69 option (google.api.http) = { get: "/v1/invoices/{id}" };
70 option idempotency_level = NO_SIDE_EFFECTS;
71 }
73 rpc ListInvoices(ListInvoicesRequest) returns (ListInvoicesResponse) {
74 option (google.api.http) = { get: "/v1/invoices" };
75 }