diff --git a/Makefile b/Makefile index 0d56371..82a1bc3 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,21 @@ +define HELP_TEXT +Welcome! + +Targets: + help provides help text + deps resolve dependencies + lint lint source for errors or breaking changes + legal prepends license to source code + +endef +export HELP_TEXT + +help: + @echo "$$HELP_TEXT" + +deps: + buf mod update + lint: buf lint addlicense -check -f ./legal/header.txt -skip yaml -skip yml -skip xml . diff --git a/buf.lock b/buf.lock new file mode 100644 index 0000000..4144ecf --- /dev/null +++ b/buf.lock @@ -0,0 +1,8 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: googleapis + repository: googleapis + commit: a86849a25cc04f4dbe9b15ddddfbc488 + digest: shake256:e19143328f8cbfe13fc226aeee5e63773ca494693a72740a7560664270039a380d94a1344234b88c7691311460df9a9b1c2982190d0a2612eae80368718e1943 diff --git a/buf.yaml b/buf.yaml index 5fc4486..732d25a 100644 --- a/buf.yaml +++ b/buf.yaml @@ -1,4 +1,6 @@ version: v1 +deps: + - buf.build/googleapis/googleapis lint: use: - DEFAULT diff --git a/contributors/v1/service.proto b/contributors/v1/service.proto index bc87f01..6ab72f1 100644 --- a/contributors/v1/service.proto +++ b/contributors/v1/service.proto @@ -12,6 +12,44 @@ syntax = "proto3"; package contributors.v1; -service ContributorService { +import "google/api/annotations.proto"; +message ListRequest {} +message ListResponse {} + +message CreateRequest {} +message CreateResponse {} + +message UpdateRequest {} +message UpdateResponse {} + +message DeleteRequest {} +message DeleteResponse {} + +service ContributorService { + rpc List(ListRequest) returns (ListResponse) { + option (google.api.http) = { + get: "/v1/products/{product_id}/contributors" + }; + }; + + rpc Create(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/v1/products/{product_id}/contributors" + body: "*" + }; + }; + + rpc Update(UpdateRequest) returns (UpdateResponse) { + option (google.api.http) = { + post: "/v1/products/{product_id}/contributors/{contributor_id}" + body: "*" + }; + }; + + rpc Delete(DeleteRequest) returns (DeleteResponse) { + option (google.api.http) = { + delete: "/v1/products/{product_id}/contributors/{contributor_id}" + }; + }; } diff --git a/licenses/v1/service.proto b/licenses/v1/service.proto index b411526..73d807b 100644 --- a/licenses/v1/service.proto +++ b/licenses/v1/service.proto @@ -12,6 +12,35 @@ syntax = "proto3"; package licenses.v1; -service LicenseService { +import "google/api/annotations.proto"; +message ListRequest {} +message ListResponse {} + +message PurchaseRequest {} +message PurchaseResponse {} + +message CancelRequest {} +message CancelResponse {} + +service LicenseService { + rpc List(ListRequest) returns (ListResponse) { + option (google.api.http) = { + get: "/v1/licenses" + }; + }; + + rpc Purchase(PurchaseRequest) returns (PurchaseResponse) { + option (google.api.http) = { + post: "/v1/licenses" + body: "*" + }; + }; + + rpc Cancel(CancelRequest) returns (CancelResponse) { + option (google.api.http) = { + post: "/v1/licenses/{license_id}" + body: "*" + }; + }; } diff --git a/packages/v1/service.proto b/packages/v1/service.proto index c294708..adfd7e0 100644 --- a/packages/v1/service.proto +++ b/packages/v1/service.proto @@ -12,6 +12,53 @@ syntax = "proto3"; package packages.v1; -service PackageService { +import "google/api/annotations.proto"; +message ListRequest {} +message ListResponse {} + +message CreateRequest {} +message CreateResponse {} + +message ReadRequest {} +message ReadResponse {} + +message UpdateRequest {} +message UpdateResponse {} + +message DeleteRequest {} +message DeleteResponse {} + +service PackageService { + rpc List(ListRequest) returns (ListResponse) { + option (google.api.http) = { + get: "/v1/products/{product_id}/packages" + }; + }; + + rpc Create(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/v1/products/{product_id}/packages" + body: "*" + }; + }; + + rpc Read(ReadRequest) returns (ReadResponse) { + option (google.api.http) = { + get: "/v1/products/{product_id}/packages/{package_name}" + }; + }; + + rpc Update(UpdateRequest) returns (UpdateResponse) { + option (google.api.http) = { + post: "/v1/products/{product_id}/packages/{package_name}" + body: "*" + }; + }; + + rpc Delete(DeleteRequest) returns (DeleteResponse) { + option (google.api.http) = { + delete: "/v1/products/{product_id}/packages/{package_name}" + }; + }; } diff --git a/products/v1/service.proto b/products/v1/service.proto index 061f1b9..a1fdd4c 100644 --- a/products/v1/service.proto +++ b/products/v1/service.proto @@ -12,6 +12,53 @@ syntax = "proto3"; package products.v1; -service ProductService { +import "google/api/annotations.proto"; +message ListRequest {} +message ListResponse {} + +message CreateRequest {} +message CreateResponse {} + +message ReadRequest {} +message ReadResponse {} + +message UpdateRequest {} +message UpdateResponse {} + +message DeleteRequest {} +message DeleteResponse {} + +service ProductService { + rpc List(ListRequest) returns (ListResponse) { + option (google.api.http) = { + get: "/v1/products" + }; + }; + + rpc Create(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/v1/products" + body: "*" + }; + }; + + rpc Read(ReadRequest) returns (ReadResponse) { + option (google.api.http) = { + get: "/v1/products/{product_id}" + }; + }; + + rpc Update(UpdateRequest) returns (UpdateResponse) { + option (google.api.http) = { + post: "/v1/products/{product_id}" + body: "*" + }; + }; + + rpc Delete(DeleteRequest) returns (DeleteResponse) { + option (google.api.http) = { + delete: "/v1/products/{product_id}" + }; + }; } diff --git a/tokens/v1/service.proto b/tokens/v1/service.proto new file mode 100644 index 0000000..39b5ad3 --- /dev/null +++ b/tokens/v1/service.proto @@ -0,0 +1,55 @@ +// Copyright (C) 2023 The Licensing Authors +// SPDX-License-Identifier: MIT + +// +// This file attempts to follow common styles and design patterns described by +// Google Cloud based on their extensive use of protocol buffers. +// +// - See here for more: https://cloud.google.com/apis/design/design_patterns +// + +syntax = "proto3"; + +package tokens.v1; + +import "google/api/annotations.proto"; + +message AuthenticateRequest {} +message AuthenticateResponse {} + +message ListRequest {} +message ListResponse {} + +message CreateRequest {} +message CreateResponse {} + +message DeleteRequest {} +message DeleteResponse {} + +service TokenService { + rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) { + option (google.api.http) = { + post: "/v1/token" + body: "*" + }; + }; + + rpc List(ListRequest) returns (ListResponse) { + option (google.api.http) = { + get: "/v1/tokens" + }; + }; + + rpc Create(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/v1/tokens" + body: "*" + }; + }; + + rpc Delete(DeleteRequest) returns (DeleteResponse) { + option (google.api.http) = { + delete: "/v1/tokens/{token_id}" + }; + }; +} diff --git a/users/v1/service.proto b/users/v1/service.proto index 7be756a..cbe0f19 100644 --- a/users/v1/service.proto +++ b/users/v1/service.proto @@ -12,6 +12,8 @@ syntax = "proto3"; package users.v1; +import "google/api/annotations.proto"; + message SignupRequest {} message SignupResponse {} @@ -19,6 +21,16 @@ message CurrentRequest {} message CurrentResponse {} service UserService { - rpc Signup(SignupRequest) returns (SignupResponse); - rpc Current(CurrentRequest) returns (CurrentResponse); + rpc Signup(SignupRequest) returns (SignupResponse) { + option (google.api.http) = { + post: "/v1/users" + body: "*" + }; + }; + + rpc Current(CurrentRequest) returns (CurrentResponse) { + option (google.api.http) = { + get: "/v1/users/current" + }; + }; }