Last active
January 16, 2018 15:01
-
-
Save tlyng/a77fc5d560f94a17e9a20e0b52aedf4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
package teamup.libraryservice; | |
import "google/api/annotations.proto"; | |
import "google/protobuf/empty.proto"; | |
service Library { | |
// Shelf management | |
rpc GetShelf(GetShelfRequest) returns (Shelf) { | |
option (google.api.http) = { | |
get: "/pai/v1/{name=shelves/*}" | |
}; | |
}; | |
rpc CreateShelf(CreateShelfRequest) returns (Shelf) { | |
option (google.api.http) = { | |
post: "/api/v1/shelves" | |
body: "shelf" | |
}; | |
}; | |
rpc DeleteShelf(DeleteShelfRequest) returns (google.protobuf.Empty) { | |
option (google.api.http) = { | |
delete: "/api/v1/{name=shelves/*}" | |
}; | |
}; | |
rpc ListShelfs(ListShelfRequest) returns (ListShelfResponse) { | |
option (google.api.http) = { | |
get: "/api/v1/shelves" | |
}; | |
}; | |
// Book management | |
rpc GetBook(GetBookRequest) returns (Book) { | |
option (google.api.http) = { | |
get: "/api/v1/{name=shelves/*/books/*}" | |
}; | |
}; | |
rpc CreateBook(CreateBookRequest) returns (Book) { | |
option (google.api.http) = { | |
post: "/api/v1/{parent=shelves/*}/books" | |
body: "book" | |
}; | |
}; | |
rpc DeleteBook(DeleteBookRequest) returns (google.protobuf.Empty) { | |
option (google.api.http) = { | |
delete; "/api/v1/{name=shelves/*/books/*}" | |
}; | |
}; | |
rpc ListBooks(ListBookRequest) returns (ListBookResponse) { | |
option (google.api.http) = { | |
get: "/api/v1/{parent=shelves/*}/books" | |
}; | |
}; | |
} | |
message Shelf { | |
// Resource name of the shelf. It must have the format of "shelves/*". | |
// For example: "shelves/shelf1" | |
string name = 1; | |
} | |
message Book { | |
// Resource name of the book. It must have the format of "shelves/*/books/*". | |
// For example: "shelves/shelf1/books/book2" | |
string name = 1; | |
string title = 2; | |
string isbn = 3; | |
string author = 4; | |
string summary = 5; | |
} | |
message GetShelfRequest { | |
// Resource name of the shelf. | |
// For example: "shelves/shelf1" | |
string name = 1; | |
} | |
message CreateShelfRequest { | |
// Resource name of the shelf. | |
// For example: "shelves/shelf1" | |
Shelf shelf = 1; | |
} | |
message ListShelfRequest { | |
} | |
message ListShelfResponse { | |
repeated Shelf shelves; | |
} | |
message DeleteShelfRequest { | |
// Resource name of the shelf. | |
// For example: "shelves/shelf1". | |
string name = 1; | |
} | |
message GetBookRequest { | |
// Resource name of the book. | |
// For example: "shelves/shelf1/books/book1" | |
string name = 1; | |
} | |
message CreateBookRequest { | |
// Resource name of the parent resource where to create the book. | |
// For example: "shelves/shelf1". | |
string parent = 1; | |
Book book = 2; | |
} | |
message DeleteBookRequest { | |
// Resource name of the book to be deleted. | |
// For example: "shelves/shelf1/books/book1" | |
string name = 1; | |
} | |
message ListBookRequest { | |
// Resource name of the parent resource. | |
// For example: "shelves/shelf1" | |
string parent = 1; | |
} | |
message ListBookResponse { | |
repeated Book books; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment