Source
- acme
- billing
- v1
invoice.proto
proto3 · package acme.billing.v1
1
syntax = "proto3";3
package acme.billing.v1;5
import "acme/security/options.proto";6
import "acme/user/v1/user.proto";7
import "buf/validate/validate.proto";8
import "google/api/annotations.proto";9
import "google/api/field_behavior.proto";10
import "google/protobuf/timestamp.proto";12
option go_package = "acme.example/billing/v1;billingv1";13
option (acme.security.owner) = "billing";15
enum 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;21
}23
message 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 }];27
}29
message LineItem {30
string description = 1;31
int32 quantity = 2 [(buf.validate.field).int32.gte = 1];32
Money unit_amount = 3;33
}35
// An invoice issued to a customer.36
message 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;45
}47
message GetInvoiceRequest {48
string id = 1 [(google.api.field_behavior) = REQUIRED];49
}51
message GetInvoiceResponse {52
Invoice invoice = 1;53
}55
message ListInvoicesRequest {56
string customer_id = 1;57
int32 page_size = 2;58
string page_token = 3;59
}61
message ListInvoicesResponse {62
repeated Invoice invoices = 1;63
string next_page_token = 2;64
}66
// Billing RPCs for invoices and collections.67
service 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
}76
}