diff --git a/.golangci.yml b/.golangci.yml index e853e72..94d6e94 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -65,7 +65,7 @@ issues: # checks from err113 are useful. - "err113: do not define dynamic errors.*" exclude-rules: - - path: internal/examples/.*/.*\.go + - path: examples/.*/.*\.go linters: - forbidigo # log.Fatal, fmt.Printf used in example programs - gosec diff --git a/Makefile b/Makefile index d114b6f..93b470d 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,8 @@ clean: ## Delete intermediate build artifacts .PHONY: test test: build ## Run unit tests $(GO) test -vet=off -race -cover ./... - cd internal/examples/pets && $(GO) test -vet=off -race -cover ./... - cd internal/examples/connect+grpc && $(GO) test -vet=off -race -cover ./... + cd examples/pets && $(GO) test -vet=off -race -cover ./... + cd examples/connect+grpc && $(GO) test -vet=off -race -cover ./... .PHONY: build build: generate ## Build all packages @@ -38,8 +38,7 @@ build: generate ## Build all packages .PHONY: generate generate: $(BIN)/buf $(BIN)/license-header ## Regenerate code and licenses - $(BIN)/buf generate internal/proto - cd internal/examples/pets && ../../../$(BIN)/buf generate internal/proto + $(BIN)/buf generate @# We want to operate on a list of modified and new files, excluding @# deleted and ignored files. git-ls-files can't do this alone. comm -23 takes @# two files and prints the union, dropping lines common to both (-3) and diff --git a/README.md b/README.md index 02d1b0f..2340cce 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ between gRPC, gRPC-Web, Connect, or REST, Vanguard has got you covered. With sup Google's [HTTP transcoding options](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L44), it can effortlessly translate protocols using strongly typed Protobuf definitions. -[See an example in action!](internal/examples/fileserver/main.go) +[See an example in action!](examples/fileserver/main.go) ## Why Vanguard? diff --git a/buf.work.yaml b/buf.work.yaml index dabba77..b206817 100644 --- a/buf.work.yaml +++ b/buf.work.yaml @@ -1,4 +1,5 @@ version: v1 directories: - internal/proto - - internal/examples/pets/internal/proto + - examples/pets/proto + - examples/openlibraryproxy/proto diff --git a/internal/examples/connect+grpc/README.md b/examples/connect+grpc/README.md similarity index 100% rename from internal/examples/connect+grpc/README.md rename to examples/connect+grpc/README.md diff --git a/internal/examples/connect+grpc/cmd/client/main.go b/examples/connect+grpc/cmd/client/main.go similarity index 100% rename from internal/examples/connect+grpc/cmd/client/main.go rename to examples/connect+grpc/cmd/client/main.go diff --git a/internal/examples/connect+grpc/cmd/server/main.go b/examples/connect+grpc/cmd/server/main.go similarity index 100% rename from internal/examples/connect+grpc/cmd/server/main.go rename to examples/connect+grpc/cmd/server/main.go diff --git a/internal/examples/connect+grpc/go.mod b/examples/connect+grpc/go.mod similarity index 89% rename from internal/examples/connect+grpc/go.mod rename to examples/connect+grpc/go.mod index 375c6b2..dc73b30 100644 --- a/internal/examples/connect+grpc/go.mod +++ b/examples/connect+grpc/go.mod @@ -1,9 +1,9 @@ -module connectrpc.com/vanguard/internal/examples/connect+grpc +module connectrpc.com/vanguard/examples/connect+grpc go 1.20 // once the repo is public, we can remove this -replace connectrpc.com/vanguard => ../../../ +replace connectrpc.com/vanguard => ../../ require ( buf.build/gen/go/connectrpc/eliza/connectrpc/go v1.11.1-20230822171018-8b8b971d6fde.1 diff --git a/internal/examples/connect+grpc/go.sum b/examples/connect+grpc/go.sum similarity index 100% rename from internal/examples/connect+grpc/go.sum rename to examples/connect+grpc/go.sum diff --git a/internal/examples/fileserver/README.md b/examples/fileserver/README.md similarity index 100% rename from internal/examples/fileserver/README.md rename to examples/fileserver/README.md diff --git a/internal/examples/fileserver/main.go b/examples/fileserver/main.go similarity index 100% rename from internal/examples/fileserver/main.go rename to examples/fileserver/main.go diff --git a/examples/openlibraryproxy/README.md b/examples/openlibraryproxy/README.md new file mode 100644 index 0000000..228917b --- /dev/null +++ b/examples/openlibraryproxy/README.md @@ -0,0 +1,42 @@ +# OpenLibrary Proxy + +Open Library proxy creates a vanguard service to serve [books.proto](./proto/openlibrary/v1/books.proto]. + +## Demo + +Run the proxy server with: +``` +go run . +``` + +Now we can use `buf curl` to call OpenLibrary's REST API via our newly created proxy. + +### Get a book + +```shell +curl --location 'https://openlibrary.org/api/books?bibkeys=ISBN:0201558025,LCCN:93005405&format=json' +``` + +```shell +buf curl --schema=./proto http://localhost:8080/openlibrary.v1.BooksService/GetBooks --data '{"bibkeys": "ISBN:0201558025,LCCN:93005405"}' +``` + +### Search for books + +Search currently can't translate due to duplicate field errors: +``` +{ + "code": "internal", + "message": "proto: (line 17562:5): duplicate field \"num_found\"" +} +``` + +```shell +curl --location 'http://openlibrary.org/search.json?q=the%2Blord%2Bof%2Bthe%2Brings +``` + +```shell +buf curl --schema=./proto http://localhost:8080/openlibrary.v1.BooksService/SearchBooks \ + --data '{"q": "the lord of the rings"}' +``` + diff --git a/examples/openlibraryproxy/main.go b/examples/openlibraryproxy/main.go new file mode 100644 index 0000000..c3ce311 --- /dev/null +++ b/examples/openlibraryproxy/main.go @@ -0,0 +1,106 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "flag" + "log" + "net/http" + "net/http/httputil" + "net/url" + "os" + "strings" + + "connectrpc.com/vanguard" + _ "connectrpc.com/vanguard/internal/gen/openlibrary/v1" +) + +func main() { + flagset := flag.NewFlagSet("stripeproxy", flag.ExitOnError) + port := flagset.String("p", "8080", "port to serve on") + addr := flagset.String("url", "https://openlibrary.org", "base URL to proxy to") + debug := flagset.Bool("debug", false, "enable debug logging") + if err := flagset.Parse(os.Args[1:]); err != nil { + log.Fatal(err) + } + + remote, err := url.Parse(*addr) + if err != nil { + log.Fatal(err) + } + proxy := httputil.NewSingleHostReverseProxy(remote) + if *debug { + proxy.Transport = &DebugTransport{} + } + // Create the handler for the proxy. + handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + log.Println(r.Method, r.URL) + r.Host = remote.Host + w.Header().Set("X-Vanguard", "OpenLibrary Proxy") + + // Alter the request for the OpenLibrary API implementation to + // ensure that all requests are JSON and use the data jscmd. + if strings.HasPrefix(r.URL.Path, "/api/books") { + // Convert all requests to JSON, and use the data jscmd. + values := r.URL.Query() + values.Set("format", "json") + values.Set("jscmd", "data") + r.URL.RawQuery = values.Encode() + } + proxy.ServeHTTP(w, r) + }) + + mux := &vanguard.Mux{ + Protocols: []vanguard.Protocol{ + // Convert all requests to REST. + vanguard.ProtocolREST, + }, + } + // Register the OpenLibrary BooksService. + if err := mux.RegisterServiceByName(handler, "openlibrary.v1.BooksService"); err != nil { + log.Fatal(err) + } + + // Alter the codec to use proto names for JSON. + mux.AddCodec(vanguard.CodecJSON, func(resolver vanguard.TypeResolver) vanguard.Codec { + codec := vanguard.DefaultJSONCodec(resolver) + codec.MarshalOptions.UseProtoNames = true + return codec + }) + + log.Printf("Proxy %s on HTTP port: %s\n", *addr, *port) + log.Fatal(http.ListenAndServe(":"+*port, mux)) +} + +type DebugTransport struct{} + +func (d *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) { + req.RequestURI = req.URL.String() + raw, err := httputil.DumpRequest(req, true) + if err != nil { + return nil, err + } + log.Println("Request:", string(raw)) + rsp, err := http.DefaultTransport.RoundTrip(req) + if err != nil { + return nil, err + } + raw, err = httputil.DumpResponse(rsp, true) + if err != nil { + return nil, err + } + log.Println("Response:", string(raw)) + return rsp, nil +} diff --git a/internal/examples/pets/internal/proto/buf.lock b/examples/openlibraryproxy/proto/buf.lock similarity index 100% rename from internal/examples/pets/internal/proto/buf.lock rename to examples/openlibraryproxy/proto/buf.lock diff --git a/internal/examples/pets/internal/proto/buf.yaml b/examples/openlibraryproxy/proto/buf.yaml similarity index 100% rename from internal/examples/pets/internal/proto/buf.yaml rename to examples/openlibraryproxy/proto/buf.yaml diff --git a/examples/openlibraryproxy/proto/openlibrary/v1/books.proto b/examples/openlibraryproxy/proto/openlibrary/v1/books.proto new file mode 100644 index 0000000..3077898 --- /dev/null +++ b/examples/openlibraryproxy/proto/openlibrary/v1/books.proto @@ -0,0 +1,202 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package openlibrary.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; + +// The Open Library API. +// +// The Book API is a generic, flexible, configurable endpoint which allows +// requesting information on one or more books using ISBNs, OCLC Numbers, LCCNs +// and OLIDs (Open Library IDs). It is inspired by the Google Books Dynamic +// links API and is compatible with it. +// +// https://openlibrary.org/ +service BooksService { + // Returns a list of books given a list of ISBNs, OCLC Numbers, LCCNs and + // OLIDs (Open Library IDs). + rpc GetBooks(GetBooksRequest) returns (GetBooksResponse) { + option (google.api.http) = { + get : "/api/books" + response_body : "books" + }; + } + // Searches for books and returns a list of books given a query string. + rpc SearchBooks(SearchBooksRequest) returns (SearchBooksResponse) { + option (google.api.http) = { + get : "/search.json" + }; + } +} + +message GetBooksRequest { + // List of IDs to request the information. The API supports ISBNs, LCCNs, OCLC + // numbers and OLIDs (Open Library IDs). + // + // ISBN + // Ex. &bibkeys=ISBN:0451526538 (The API supports both ISBN 10 and 13.) + // + // OCLC + // &bibkeys=OCLC:######### + // + // LCCN + // &bibkeys=LCCN:######### + // + // OLID + // &bibkeys=OLID:OL123M + string bibkeys = 1; // repeated + + // Implementation detail: The following fields are not supported by the API + // and are overridden by the proxy. + + // The format of the response. The default is javascript. Always call with + // format=json to get a JSON response. + string format = 2; + // The contents of each JSON object will be decided by the jscmd parameter. + string jscmd = 3; + // The callback function name. Used only when format=javascript. + string callback = 4; +} + +message GetBooksResponse { map books = 1; } + +// View the documentation for the Book type at +message Book { + string bib_key = 1; + string info_url = 2; + string preview = 3; + string preview_url = 4; + string thumbnail_url = 5; + + // Data fields + string url = 6; + // Unique key for the book. + string key = 7; + // Title of the book. + string title = 8; + // Subtitle of the book. + string subtitle = 9; + message Author { + string url = 1; + string name = 2; + } + // List of authors. + repeated Author authors = 10; + // All identifiers of the book in the following format: + // { + // "isbn_10": [...], + // "isbn_13": [...], + // "lccn": [...], + // "oclc": [...], + // "goodreads": [...] + // } + google.protobuf.Struct identifiers = 11; + message Classifications { + repeated string lc_classificcations = 1; + repeated string dewey_decimal_class = 2; + } + // Classifications of the book. + Classifications classifications = 12; + // List of subjects, places, people and times of the book. Each entry will be + // in the following format: + message Subject { + string url = 1; + string name = 2; + } + repeated Subject subjects = 13; + message Publisher { string name = 1; } + // List of publishers. + repeated Publisher publishers = 14; + message PublishPlace { string name = 1; } + // List of publish places. + repeated PublishPlace publish_places = 15; + // Publish date of the book. + string publish_date = 16; + message Excerpts { + string comment = 1; + string text = 2; + } + // List of excerpts. + repeated Excerpts excerpts = 17; + message Link { + string url = 1; + string title = 2; + } + // List of links. + repeated Link links = 18; + message Cover { + string small = 1; + string medium = 2; + string large = 3; + } + // Cover of the book. + Cover cover = 19; + message EBook { + string preview_url = 1; + string availability = 2; + google.protobuf.Struct formats = 3; + string borrow_url = 4; + string checkouts_url = 5; + } + // Number of pages of the book. + int32 number_of_pages = 20; + // Weight of the book. + string weight = 21; +} + +message SearchBooksRequest { + // Query string to search for books. + string q = 1; + // Title of the book. + string title = 2; + // Author of the book. + string author = 3; + // Sort order of the results. The default is relevance. + // See: + // https://github.com/internetarchive/openlibrary/blob/abd73aa37ea27b4e7d70f521bfd1e30b7dc1dc6e/openlibrary/plugins/worksearch/schemes/works.py#L113-L132 + string sort = 4; +} +message SearchBooksResponse { + // Start index of the results. + int32 start = 1; + // Number of results found. + int32 num_found = 2; + // List of docs. + // Each document specified listed in "docs" will be of the following format: + // { + // "cover_i": 258027, + // "has_fulltext": true, + // "edition_count": 120, + // "title": "The Lord of the Rings", + // "author_name": [ + // "J. R. R. Tolkien" + // ], + // "first_publish_year": 1954, + // "key": "OL27448W", + // "ia": [ + // "returnofking00tolk_1", + // "lordofrings00tolk_1", + // "lordofrings00tolk_0", + // ], + // "author_key": [ + // "OL26320A" + // ], + // "public_scan_b": true + // } + repeated google.protobuf.Struct docs = 3; +} diff --git a/internal/examples/pets/README.md b/examples/pets/README.md similarity index 100% rename from internal/examples/pets/README.md rename to examples/pets/README.md diff --git a/internal/examples/pets/buf.gen.yaml b/examples/pets/buf.gen.yaml similarity index 81% rename from internal/examples/pets/buf.gen.yaml rename to examples/pets/buf.gen.yaml index c2a7502..9e2c254 100644 --- a/internal/examples/pets/buf.gen.yaml +++ b/examples/pets/buf.gen.yaml @@ -2,7 +2,7 @@ version: v1 managed: enabled: true go_package_prefix: - default: connectrpc.com/vanguard/internal/examples/pets/internal/gen + default: connectrpc.com/vanguard/internal/gen except: - buf.build/googleapis/googleapis plugins: diff --git a/internal/examples/pets/cmd/pets-be/main.go b/examples/pets/cmd/pets-be/main.go similarity index 94% rename from internal/examples/pets/cmd/pets-be/main.go rename to examples/pets/cmd/pets-be/main.go index 71da997..53d6b2c 100644 --- a/internal/examples/pets/cmd/pets-be/main.go +++ b/examples/pets/cmd/pets-be/main.go @@ -30,8 +30,8 @@ import ( "connectrpc.com/grpcreflect" "connectrpc.com/vanguard" - "connectrpc.com/vanguard/internal/examples/pets/internal" - "connectrpc.com/vanguard/internal/examples/pets/internal/gen/io/swagger/petstore/v2/petstorev2connect" + "connectrpc.com/vanguard/examples/pets/internal" + "connectrpc.com/vanguard/internal/gen/io/swagger/petstore/v2/petstorev2connect" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" "golang.org/x/sync/errgroup" diff --git a/internal/examples/pets/cmd/pets-fe/main.go b/examples/pets/cmd/pets-fe/main.go similarity index 96% rename from internal/examples/pets/cmd/pets-fe/main.go rename to examples/pets/cmd/pets-fe/main.go index 547bee4..41eb5b9 100644 --- a/internal/examples/pets/cmd/pets-fe/main.go +++ b/examples/pets/cmd/pets-fe/main.go @@ -32,8 +32,8 @@ import ( "connectrpc.com/grpcreflect" "connectrpc.com/vanguard" - "connectrpc.com/vanguard/internal/examples/pets/internal" - "connectrpc.com/vanguard/internal/examples/pets/internal/gen/io/swagger/petstore/v2/petstorev2connect" + "connectrpc.com/vanguard/examples/pets/internal" + "connectrpc.com/vanguard/internal/gen/io/swagger/petstore/v2/petstorev2connect" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" "golang.org/x/sync/errgroup" diff --git a/internal/examples/pets/go.mod b/examples/pets/go.mod similarity index 85% rename from internal/examples/pets/go.mod rename to examples/pets/go.mod index f29c7bc..3e10cb7 100644 --- a/internal/examples/pets/go.mod +++ b/examples/pets/go.mod @@ -1,9 +1,9 @@ -module connectrpc.com/vanguard/internal/examples/pets +module connectrpc.com/vanguard/examples/pets go 1.20 // once the repo is public, we can remove this -replace connectrpc.com/vanguard => ../../../ +replace connectrpc.com/vanguard => ../../ require ( connectrpc.com/connect v1.11.0 diff --git a/internal/examples/pets/go.sum b/examples/pets/go.sum similarity index 100% rename from internal/examples/pets/go.sum rename to examples/pets/go.sum diff --git a/internal/examples/pets/internal/trace.go b/examples/pets/internal/trace.go similarity index 100% rename from internal/examples/pets/internal/trace.go rename to examples/pets/internal/trace.go diff --git a/examples/pets/proto/buf.lock b/examples/pets/proto/buf.lock new file mode 100644 index 0000000..6c4355d --- /dev/null +++ b/examples/pets/proto/buf.lock @@ -0,0 +1,8 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de diff --git a/examples/pets/proto/buf.yaml b/examples/pets/proto/buf.yaml new file mode 100644 index 0000000..11c4f8e --- /dev/null +++ b/examples/pets/proto/buf.yaml @@ -0,0 +1,17 @@ +version: v1 +deps: + - buf.build/googleapis/googleapis +lint: + use: + - DEFAULT + except: + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME + - RPC_REQUEST_RESPONSE_UNIQUE + - ENUM_VALUE_UPPER_SNAKE_CASE + - ENUM_VALUE_PREFIX + - ENUM_ZERO_VALUE_SUFFIX + rpc_allow_google_protobuf_empty_responses: true +breaking: + use: + - WIRE_JSON diff --git a/internal/examples/pets/internal/proto/io/swagger/petstore/v2/pets.proto b/examples/pets/proto/io/swagger/petstore/v2/pets.proto similarity index 100% rename from internal/examples/pets/internal/proto/io/swagger/petstore/v2/pets.proto rename to examples/pets/proto/io/swagger/petstore/v2/pets.proto diff --git a/go.work b/go.work index 2982e1d..44db64e 100644 --- a/go.work +++ b/go.work @@ -2,6 +2,6 @@ go 1.20 use ( . - ./internal/examples/connect+grpc - ./internal/examples/pets + ./examples/connect+grpc + ./examples/pets ) diff --git a/internal/examples/pets/internal/gen/io/swagger/petstore/v2/pets.pb.go b/internal/gen/io/swagger/petstore/v2/pets.pb.go similarity index 96% rename from internal/examples/pets/internal/gen/io/swagger/petstore/v2/pets.pb.go rename to internal/gen/io/swagger/petstore/v2/pets.pb.go index 45f71b5..0a46efd 100644 --- a/internal/examples/pets/internal/gen/io/swagger/petstore/v2/pets.pb.go +++ b/internal/gen/io/swagger/petstore/v2/pets.pb.go @@ -838,24 +838,22 @@ var file_io_swagger_petstore_v2_pets_proto_rawDesc = []byte{ 0x72, 0x2e, 0x70, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x65, 0x74, 0x73, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x62, 0x04, 0x70, 0x65, 0x74, 0x73, 0x12, 0x11, 0x2f, 0x70, 0x65, 0x74, 0x2f, 0x66, 0x69, 0x6e, 0x64, 0x42, 0x79, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x90, 0x02, 0x01, 0x42, 0x81, 0x02, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x69, + 0x74, 0x75, 0x73, 0x90, 0x02, 0x01, 0x42, 0xea, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x42, 0x09, 0x50, 0x65, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x5d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x63, + 0x50, 0x01, 0x5a, 0x46, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x72, 0x64, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x70, 0x65, - 0x74, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, - 0x69, 0x6f, 0x2f, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x2f, 0x70, 0x65, 0x74, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x32, 0x3b, 0x70, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x76, - 0x32, 0xa2, 0x02, 0x03, 0x49, 0x53, 0x50, 0xaa, 0x02, 0x16, 0x49, 0x6f, 0x2e, 0x53, 0x77, 0x61, - 0x67, 0x67, 0x65, 0x72, 0x2e, 0x50, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x32, - 0xca, 0x02, 0x16, 0x49, 0x6f, 0x5c, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x5c, 0x50, 0x65, - 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x22, 0x49, 0x6f, 0x5c, 0x53, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x69, 0x6f, 0x2f, 0x73, 0x77, 0x61, 0x67, + 0x67, 0x65, 0x72, 0x2f, 0x70, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x32, 0x3b, + 0x70, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x49, 0x53, 0x50, + 0xaa, 0x02, 0x16, 0x49, 0x6f, 0x2e, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x50, 0x65, + 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x16, 0x49, 0x6f, 0x5c, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x5c, 0x50, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5c, - 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x19, 0x49, 0x6f, 0x3a, 0x3a, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x3a, 0x3a, 0x50, 0x65, - 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x56, 0x32, 0xe2, 0x02, 0x22, 0x49, 0x6f, 0x5c, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x5c, + 0x50, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x49, 0x6f, 0x3a, 0x3a, 0x53, 0x77, + 0x61, 0x67, 0x67, 0x65, 0x72, 0x3a, 0x3a, 0x50, 0x65, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x3a, + 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/examples/pets/internal/gen/io/swagger/petstore/v2/petstorev2connect/pets.connect.go b/internal/gen/io/swagger/petstore/v2/petstorev2connect/pets.connect.go similarity index 99% rename from internal/examples/pets/internal/gen/io/swagger/petstore/v2/petstorev2connect/pets.connect.go rename to internal/gen/io/swagger/petstore/v2/petstorev2connect/pets.connect.go index 8c97a8c..00b5579 100644 --- a/internal/examples/pets/internal/gen/io/swagger/petstore/v2/petstorev2connect/pets.connect.go +++ b/internal/gen/io/swagger/petstore/v2/petstorev2connect/pets.connect.go @@ -20,7 +20,7 @@ package petstorev2connect import ( connect "connectrpc.com/connect" - v2 "connectrpc.com/vanguard/internal/examples/pets/internal/gen/io/swagger/petstore/v2" + v2 "connectrpc.com/vanguard/internal/gen/io/swagger/petstore/v2" context "context" errors "errors" emptypb "google.golang.org/protobuf/types/known/emptypb" diff --git a/internal/gen/openlibrary/v1/books.pb.go b/internal/gen/openlibrary/v1/books.pb.go new file mode 100644 index 0000000..6deb117 --- /dev/null +++ b/internal/gen/openlibrary/v1/books.pb.go @@ -0,0 +1,1501 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: openlibrary/v1/books.proto + +package openlibraryv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetBooksRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // List of IDs to request the information. The API supports ISBNs, LCCNs, OCLC + // numbers and OLIDs (Open Library IDs). + // + // ISBN + // Ex. &bibkeys=ISBN:0451526538 (The API supports both ISBN 10 and 13.) + // + // OCLC + // &bibkeys=OCLC:######### + // + // LCCN + // &bibkeys=LCCN:######### + // + // OLID + // &bibkeys=OLID:OL123M + Bibkeys string `protobuf:"bytes,1,opt,name=bibkeys,proto3" json:"bibkeys,omitempty"` // repeated + // The format of the response. The default is javascript. Always call with + // format=json to get a JSON response. + Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` + // The contents of each JSON object will be decided by the jscmd parameter. + Jscmd string `protobuf:"bytes,3,opt,name=jscmd,proto3" json:"jscmd,omitempty"` + // The callback function name. Used only when format=javascript. + Callback string `protobuf:"bytes,4,opt,name=callback,proto3" json:"callback,omitempty"` +} + +func (x *GetBooksRequest) Reset() { + *x = GetBooksRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBooksRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBooksRequest) ProtoMessage() {} + +func (x *GetBooksRequest) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBooksRequest.ProtoReflect.Descriptor instead. +func (*GetBooksRequest) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{0} +} + +func (x *GetBooksRequest) GetBibkeys() string { + if x != nil { + return x.Bibkeys + } + return "" +} + +func (x *GetBooksRequest) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *GetBooksRequest) GetJscmd() string { + if x != nil { + return x.Jscmd + } + return "" +} + +func (x *GetBooksRequest) GetCallback() string { + if x != nil { + return x.Callback + } + return "" +} + +type GetBooksResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Books map[string]*Book `protobuf:"bytes,1,rep,name=books,proto3" json:"books,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *GetBooksResponse) Reset() { + *x = GetBooksResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBooksResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBooksResponse) ProtoMessage() {} + +func (x *GetBooksResponse) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBooksResponse.ProtoReflect.Descriptor instead. +func (*GetBooksResponse) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{1} +} + +func (x *GetBooksResponse) GetBooks() map[string]*Book { + if x != nil { + return x.Books + } + return nil +} + +// View the documentation for the Book type at +type Book struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BibKey string `protobuf:"bytes,1,opt,name=bib_key,json=bibKey,proto3" json:"bib_key,omitempty"` + InfoUrl string `protobuf:"bytes,2,opt,name=info_url,json=infoUrl,proto3" json:"info_url,omitempty"` + Preview string `protobuf:"bytes,3,opt,name=preview,proto3" json:"preview,omitempty"` + PreviewUrl string `protobuf:"bytes,4,opt,name=preview_url,json=previewUrl,proto3" json:"preview_url,omitempty"` + ThumbnailUrl string `protobuf:"bytes,5,opt,name=thumbnail_url,json=thumbnailUrl,proto3" json:"thumbnail_url,omitempty"` + // Data fields + Url string `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"` + // Unique key for the book. + Key string `protobuf:"bytes,7,opt,name=key,proto3" json:"key,omitempty"` + // Title of the book. + Title string `protobuf:"bytes,8,opt,name=title,proto3" json:"title,omitempty"` + // Subtitle of the book. + Subtitle string `protobuf:"bytes,9,opt,name=subtitle,proto3" json:"subtitle,omitempty"` + // List of authors. + Authors []*Book_Author `protobuf:"bytes,10,rep,name=authors,proto3" json:"authors,omitempty"` + // All identifiers of the book in the following format: + // + // { + // "isbn_10": [...], + // "isbn_13": [...], + // "lccn": [...], + // "oclc": [...], + // "goodreads": [...] + // } + Identifiers *structpb.Struct `protobuf:"bytes,11,opt,name=identifiers,proto3" json:"identifiers,omitempty"` + // Classifications of the book. + Classifications *Book_Classifications `protobuf:"bytes,12,opt,name=classifications,proto3" json:"classifications,omitempty"` + Subjects []*Book_Subject `protobuf:"bytes,13,rep,name=subjects,proto3" json:"subjects,omitempty"` + // List of publishers. + Publishers []*Book_Publisher `protobuf:"bytes,14,rep,name=publishers,proto3" json:"publishers,omitempty"` + // List of publish places. + PublishPlaces []*Book_PublishPlace `protobuf:"bytes,15,rep,name=publish_places,json=publishPlaces,proto3" json:"publish_places,omitempty"` + // Publish date of the book. + PublishDate string `protobuf:"bytes,16,opt,name=publish_date,json=publishDate,proto3" json:"publish_date,omitempty"` + // List of excerpts. + Excerpts []*Book_Excerpts `protobuf:"bytes,17,rep,name=excerpts,proto3" json:"excerpts,omitempty"` + // List of links. + Links []*Book_Link `protobuf:"bytes,18,rep,name=links,proto3" json:"links,omitempty"` + // Cover of the book. + Cover *Book_Cover `protobuf:"bytes,19,opt,name=cover,proto3" json:"cover,omitempty"` + // Number of pages of the book. + NumberOfPages int32 `protobuf:"varint,20,opt,name=number_of_pages,json=numberOfPages,proto3" json:"number_of_pages,omitempty"` + // Weight of the book. + Weight string `protobuf:"bytes,21,opt,name=weight,proto3" json:"weight,omitempty"` +} + +func (x *Book) Reset() { + *x = Book{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book) ProtoMessage() {} + +func (x *Book) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book.ProtoReflect.Descriptor instead. +func (*Book) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2} +} + +func (x *Book) GetBibKey() string { + if x != nil { + return x.BibKey + } + return "" +} + +func (x *Book) GetInfoUrl() string { + if x != nil { + return x.InfoUrl + } + return "" +} + +func (x *Book) GetPreview() string { + if x != nil { + return x.Preview + } + return "" +} + +func (x *Book) GetPreviewUrl() string { + if x != nil { + return x.PreviewUrl + } + return "" +} + +func (x *Book) GetThumbnailUrl() string { + if x != nil { + return x.ThumbnailUrl + } + return "" +} + +func (x *Book) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Book) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Book) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Book) GetSubtitle() string { + if x != nil { + return x.Subtitle + } + return "" +} + +func (x *Book) GetAuthors() []*Book_Author { + if x != nil { + return x.Authors + } + return nil +} + +func (x *Book) GetIdentifiers() *structpb.Struct { + if x != nil { + return x.Identifiers + } + return nil +} + +func (x *Book) GetClassifications() *Book_Classifications { + if x != nil { + return x.Classifications + } + return nil +} + +func (x *Book) GetSubjects() []*Book_Subject { + if x != nil { + return x.Subjects + } + return nil +} + +func (x *Book) GetPublishers() []*Book_Publisher { + if x != nil { + return x.Publishers + } + return nil +} + +func (x *Book) GetPublishPlaces() []*Book_PublishPlace { + if x != nil { + return x.PublishPlaces + } + return nil +} + +func (x *Book) GetPublishDate() string { + if x != nil { + return x.PublishDate + } + return "" +} + +func (x *Book) GetExcerpts() []*Book_Excerpts { + if x != nil { + return x.Excerpts + } + return nil +} + +func (x *Book) GetLinks() []*Book_Link { + if x != nil { + return x.Links + } + return nil +} + +func (x *Book) GetCover() *Book_Cover { + if x != nil { + return x.Cover + } + return nil +} + +func (x *Book) GetNumberOfPages() int32 { + if x != nil { + return x.NumberOfPages + } + return 0 +} + +func (x *Book) GetWeight() string { + if x != nil { + return x.Weight + } + return "" +} + +type SearchBooksRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Query string to search for books. + Q string `protobuf:"bytes,1,opt,name=q,proto3" json:"q,omitempty"` + // Title of the book. + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + // Author of the book. + Author string `protobuf:"bytes,3,opt,name=author,proto3" json:"author,omitempty"` + // Sort order of the results. The default is relevance. + // See: + // https://github.com/internetarchive/openlibrary/blob/abd73aa37ea27b4e7d70f521bfd1e30b7dc1dc6e/openlibrary/plugins/worksearch/schemes/works.py#L113-L132 + Sort string `protobuf:"bytes,4,opt,name=sort,proto3" json:"sort,omitempty"` +} + +func (x *SearchBooksRequest) Reset() { + *x = SearchBooksRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchBooksRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchBooksRequest) ProtoMessage() {} + +func (x *SearchBooksRequest) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchBooksRequest.ProtoReflect.Descriptor instead. +func (*SearchBooksRequest) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{3} +} + +func (x *SearchBooksRequest) GetQ() string { + if x != nil { + return x.Q + } + return "" +} + +func (x *SearchBooksRequest) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *SearchBooksRequest) GetAuthor() string { + if x != nil { + return x.Author + } + return "" +} + +func (x *SearchBooksRequest) GetSort() string { + if x != nil { + return x.Sort + } + return "" +} + +type SearchBooksResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Start index of the results. + Start int32 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + // Number of results found. + NumFound int32 `protobuf:"varint,2,opt,name=num_found,json=numFound,proto3" json:"num_found,omitempty"` + // List of docs. + // Each document specified listed in "docs" will be of the following format: + // + // { + // "cover_i": 258027, + // "has_fulltext": true, + // "edition_count": 120, + // "title": "The Lord of the Rings", + // "author_name": [ + // "J. R. R. Tolkien" + // ], + // "first_publish_year": 1954, + // "key": "OL27448W", + // "ia": [ + // "returnofking00tolk_1", + // "lordofrings00tolk_1", + // "lordofrings00tolk_0", + // ], + // "author_key": [ + // "OL26320A" + // ], + // "public_scan_b": true + // } + Docs []*structpb.Struct `protobuf:"bytes,3,rep,name=docs,proto3" json:"docs,omitempty"` +} + +func (x *SearchBooksResponse) Reset() { + *x = SearchBooksResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchBooksResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchBooksResponse) ProtoMessage() {} + +func (x *SearchBooksResponse) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchBooksResponse.ProtoReflect.Descriptor instead. +func (*SearchBooksResponse) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{4} +} + +func (x *SearchBooksResponse) GetStart() int32 { + if x != nil { + return x.Start + } + return 0 +} + +func (x *SearchBooksResponse) GetNumFound() int32 { + if x != nil { + return x.NumFound + } + return 0 +} + +func (x *SearchBooksResponse) GetDocs() []*structpb.Struct { + if x != nil { + return x.Docs + } + return nil +} + +type Book_Author struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Book_Author) Reset() { + *x = Book_Author{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_Author) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_Author) ProtoMessage() {} + +func (x *Book_Author) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_Author.ProtoReflect.Descriptor instead. +func (*Book_Author) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *Book_Author) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Book_Author) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Book_Classifications struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LcClassificcations []string `protobuf:"bytes,1,rep,name=lc_classificcations,json=lcClassificcations,proto3" json:"lc_classificcations,omitempty"` + DeweyDecimalClass []string `protobuf:"bytes,2,rep,name=dewey_decimal_class,json=deweyDecimalClass,proto3" json:"dewey_decimal_class,omitempty"` +} + +func (x *Book_Classifications) Reset() { + *x = Book_Classifications{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_Classifications) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_Classifications) ProtoMessage() {} + +func (x *Book_Classifications) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_Classifications.ProtoReflect.Descriptor instead. +func (*Book_Classifications) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *Book_Classifications) GetLcClassificcations() []string { + if x != nil { + return x.LcClassificcations + } + return nil +} + +func (x *Book_Classifications) GetDeweyDecimalClass() []string { + if x != nil { + return x.DeweyDecimalClass + } + return nil +} + +// List of subjects, places, people and times of the book. Each entry will be +// in the following format: +type Book_Subject struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Book_Subject) Reset() { + *x = Book_Subject{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_Subject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_Subject) ProtoMessage() {} + +func (x *Book_Subject) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_Subject.ProtoReflect.Descriptor instead. +func (*Book_Subject) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 2} +} + +func (x *Book_Subject) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Book_Subject) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Book_Publisher struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Book_Publisher) Reset() { + *x = Book_Publisher{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_Publisher) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_Publisher) ProtoMessage() {} + +func (x *Book_Publisher) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_Publisher.ProtoReflect.Descriptor instead. +func (*Book_Publisher) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 3} +} + +func (x *Book_Publisher) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Book_PublishPlace struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Book_PublishPlace) Reset() { + *x = Book_PublishPlace{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_PublishPlace) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_PublishPlace) ProtoMessage() {} + +func (x *Book_PublishPlace) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_PublishPlace.ProtoReflect.Descriptor instead. +func (*Book_PublishPlace) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 4} +} + +func (x *Book_PublishPlace) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Book_Excerpts struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` + Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` +} + +func (x *Book_Excerpts) Reset() { + *x = Book_Excerpts{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_Excerpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_Excerpts) ProtoMessage() {} + +func (x *Book_Excerpts) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_Excerpts.ProtoReflect.Descriptor instead. +func (*Book_Excerpts) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 5} +} + +func (x *Book_Excerpts) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + +func (x *Book_Excerpts) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +type Book_Link struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` +} + +func (x *Book_Link) Reset() { + *x = Book_Link{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_Link) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_Link) ProtoMessage() {} + +func (x *Book_Link) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_Link.ProtoReflect.Descriptor instead. +func (*Book_Link) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 6} +} + +func (x *Book_Link) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Book_Link) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +type Book_Cover struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Small string `protobuf:"bytes,1,opt,name=small,proto3" json:"small,omitempty"` + Medium string `protobuf:"bytes,2,opt,name=medium,proto3" json:"medium,omitempty"` + Large string `protobuf:"bytes,3,opt,name=large,proto3" json:"large,omitempty"` +} + +func (x *Book_Cover) Reset() { + *x = Book_Cover{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_Cover) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_Cover) ProtoMessage() {} + +func (x *Book_Cover) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_Cover.ProtoReflect.Descriptor instead. +func (*Book_Cover) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 7} +} + +func (x *Book_Cover) GetSmall() string { + if x != nil { + return x.Small + } + return "" +} + +func (x *Book_Cover) GetMedium() string { + if x != nil { + return x.Medium + } + return "" +} + +func (x *Book_Cover) GetLarge() string { + if x != nil { + return x.Large + } + return "" +} + +type Book_EBook struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PreviewUrl string `protobuf:"bytes,1,opt,name=preview_url,json=previewUrl,proto3" json:"preview_url,omitempty"` + Availability string `protobuf:"bytes,2,opt,name=availability,proto3" json:"availability,omitempty"` + Formats *structpb.Struct `protobuf:"bytes,3,opt,name=formats,proto3" json:"formats,omitempty"` + BorrowUrl string `protobuf:"bytes,4,opt,name=borrow_url,json=borrowUrl,proto3" json:"borrow_url,omitempty"` + CheckoutsUrl string `protobuf:"bytes,5,opt,name=checkouts_url,json=checkoutsUrl,proto3" json:"checkouts_url,omitempty"` +} + +func (x *Book_EBook) Reset() { + *x = Book_EBook{} + if protoimpl.UnsafeEnabled { + mi := &file_openlibrary_v1_books_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book_EBook) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book_EBook) ProtoMessage() {} + +func (x *Book_EBook) ProtoReflect() protoreflect.Message { + mi := &file_openlibrary_v1_books_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book_EBook.ProtoReflect.Descriptor instead. +func (*Book_EBook) Descriptor() ([]byte, []int) { + return file_openlibrary_v1_books_proto_rawDescGZIP(), []int{2, 8} +} + +func (x *Book_EBook) GetPreviewUrl() string { + if x != nil { + return x.PreviewUrl + } + return "" +} + +func (x *Book_EBook) GetAvailability() string { + if x != nil { + return x.Availability + } + return "" +} + +func (x *Book_EBook) GetFormats() *structpb.Struct { + if x != nil { + return x.Formats + } + return nil +} + +func (x *Book_EBook) GetBorrowUrl() string { + if x != nil { + return x.BorrowUrl + } + return "" +} + +func (x *Book_EBook) GetCheckoutsUrl() string { + if x != nil { + return x.CheckoutsUrl + } + return "" +} + +var File_openlibrary_v1_books_proto protoreflect.FileDescriptor + +var file_openlibrary_v1_books_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2f, 0x76, 0x31, + 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6f, 0x70, + 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x75, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, + 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x62, + 0x69, 0x62, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x69, + 0x62, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x6a, 0x73, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6a, 0x73, + 0x63, 0x6d, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x22, + 0xa5, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x1a, 0x4e, 0x0a, 0x0a, 0x42, 0x6f, 0x6f, 0x6b, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x8e, 0x0c, 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6b, + 0x12, 0x17, 0x0a, 0x07, 0x62, 0x69, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x62, 0x69, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x6e, 0x66, + 0x6f, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6e, 0x66, + 0x6f, 0x55, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x1f, + 0x0a, 0x0b, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x55, 0x72, 0x6c, 0x12, + 0x23, 0x0a, 0x0d, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x5f, 0x75, 0x72, 0x6c, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, + 0x6c, 0x55, 0x72, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1a, + 0x0a, 0x08, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, + 0x6b, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x52, 0x07, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x73, 0x12, 0x39, 0x0a, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, + 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x4e, 0x0a, 0x0f, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0f, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x38, 0x0a, 0x08, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, + 0x42, 0x6f, 0x6f, 0x6b, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x08, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x3e, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, + 0x68, 0x65, 0x72, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, + 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x73, 0x68, 0x65, 0x72, 0x73, 0x12, 0x48, 0x0a, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, + 0x68, 0x5f, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, + 0x42, 0x6f, 0x6f, 0x6b, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x50, 0x6c, 0x61, 0x63, + 0x65, 0x52, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, + 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x5f, 0x64, 0x61, 0x74, 0x65, + 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x44, + 0x61, 0x74, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x65, 0x78, 0x63, 0x65, 0x72, 0x70, 0x74, 0x73, 0x18, + 0x11, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x2e, 0x45, 0x78, 0x63, 0x65, + 0x72, 0x70, 0x74, 0x73, 0x52, 0x08, 0x65, 0x78, 0x63, 0x65, 0x72, 0x70, 0x74, 0x73, 0x12, 0x2f, + 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x42, + 0x6f, 0x6f, 0x6b, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x12, + 0x30, 0x0a, 0x05, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, + 0x42, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x05, 0x63, 0x6f, 0x76, 0x65, + 0x72, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x6f, 0x66, 0x5f, 0x70, + 0x61, 0x67, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x4f, 0x66, 0x50, 0x61, 0x67, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x77, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x1a, 0x2e, 0x0a, 0x06, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x1a, 0x72, 0x0a, 0x0f, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x6c, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x69, 0x66, 0x69, 0x63, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x12, 0x6c, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x65, 0x77, 0x65, 0x79, 0x5f, 0x64, + 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x11, 0x64, 0x65, 0x77, 0x65, 0x79, 0x44, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, + 0x43, 0x6c, 0x61, 0x73, 0x73, 0x1a, 0x2f, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, + 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0x1f, 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, + 0x68, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0x22, 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, + 0x73, 0x68, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0x38, 0x0a, 0x08, 0x45, + 0x78, 0x63, 0x65, 0x72, 0x70, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x65, 0x78, 0x74, 0x1a, 0x2e, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x10, 0x0a, + 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x69, 0x74, 0x6c, 0x65, 0x1a, 0x4b, 0x0a, 0x05, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, + 0x6d, 0x61, 0x6c, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, + 0x6c, 0x61, 0x72, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x72, + 0x67, 0x65, 0x1a, 0xc3, 0x01, 0x0a, 0x05, 0x45, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x0a, 0x0b, + 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, + 0x0c, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x12, 0x31, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x07, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x72, 0x72, 0x6f, 0x77, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f, 0x72, 0x72, 0x6f, 0x77, + 0x55, 0x72, 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x73, + 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x6f, 0x75, 0x74, 0x73, 0x55, 0x72, 0x6c, 0x22, 0x64, 0x0a, 0x12, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0c, + 0x0a, 0x01, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x71, 0x12, 0x14, 0x0a, 0x05, + 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, + 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, + 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x22, 0x75, + 0x0a, 0x13, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, + 0x75, 0x6d, 0x5f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x6e, 0x75, 0x6d, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, + 0x04, 0x64, 0x6f, 0x63, 0x73, 0x32, 0xe6, 0x01, 0x0a, 0x0c, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x68, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, + 0x6b, 0x73, 0x12, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x62, 0x05, 0x62, + 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x0a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, + 0x12, 0x6c, 0x0a, 0x0b, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x12, + 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x42, 0x6f, 0x6f, 0x6b, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, + 0x12, 0x0c, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x42, 0xbc, + 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x41, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x72, 0x70, 0x63, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x72, 0x64, 0x2f, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, + 0x62, 0x72, 0x61, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x3b, 0x6f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x79, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4f, 0x58, 0x58, 0xaa, 0x02, 0x0e, 0x4f, + 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0e, + 0x4f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x1a, 0x4f, 0x70, 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4f, 0x70, + 0x65, 0x6e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_openlibrary_v1_books_proto_rawDescOnce sync.Once + file_openlibrary_v1_books_proto_rawDescData = file_openlibrary_v1_books_proto_rawDesc +) + +func file_openlibrary_v1_books_proto_rawDescGZIP() []byte { + file_openlibrary_v1_books_proto_rawDescOnce.Do(func() { + file_openlibrary_v1_books_proto_rawDescData = protoimpl.X.CompressGZIP(file_openlibrary_v1_books_proto_rawDescData) + }) + return file_openlibrary_v1_books_proto_rawDescData +} + +var file_openlibrary_v1_books_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_openlibrary_v1_books_proto_goTypes = []interface{}{ + (*GetBooksRequest)(nil), // 0: openlibrary.v1.GetBooksRequest + (*GetBooksResponse)(nil), // 1: openlibrary.v1.GetBooksResponse + (*Book)(nil), // 2: openlibrary.v1.Book + (*SearchBooksRequest)(nil), // 3: openlibrary.v1.SearchBooksRequest + (*SearchBooksResponse)(nil), // 4: openlibrary.v1.SearchBooksResponse + nil, // 5: openlibrary.v1.GetBooksResponse.BooksEntry + (*Book_Author)(nil), // 6: openlibrary.v1.Book.Author + (*Book_Classifications)(nil), // 7: openlibrary.v1.Book.Classifications + (*Book_Subject)(nil), // 8: openlibrary.v1.Book.Subject + (*Book_Publisher)(nil), // 9: openlibrary.v1.Book.Publisher + (*Book_PublishPlace)(nil), // 10: openlibrary.v1.Book.PublishPlace + (*Book_Excerpts)(nil), // 11: openlibrary.v1.Book.Excerpts + (*Book_Link)(nil), // 12: openlibrary.v1.Book.Link + (*Book_Cover)(nil), // 13: openlibrary.v1.Book.Cover + (*Book_EBook)(nil), // 14: openlibrary.v1.Book.EBook + (*structpb.Struct)(nil), // 15: google.protobuf.Struct +} +var file_openlibrary_v1_books_proto_depIdxs = []int32{ + 5, // 0: openlibrary.v1.GetBooksResponse.books:type_name -> openlibrary.v1.GetBooksResponse.BooksEntry + 6, // 1: openlibrary.v1.Book.authors:type_name -> openlibrary.v1.Book.Author + 15, // 2: openlibrary.v1.Book.identifiers:type_name -> google.protobuf.Struct + 7, // 3: openlibrary.v1.Book.classifications:type_name -> openlibrary.v1.Book.Classifications + 8, // 4: openlibrary.v1.Book.subjects:type_name -> openlibrary.v1.Book.Subject + 9, // 5: openlibrary.v1.Book.publishers:type_name -> openlibrary.v1.Book.Publisher + 10, // 6: openlibrary.v1.Book.publish_places:type_name -> openlibrary.v1.Book.PublishPlace + 11, // 7: openlibrary.v1.Book.excerpts:type_name -> openlibrary.v1.Book.Excerpts + 12, // 8: openlibrary.v1.Book.links:type_name -> openlibrary.v1.Book.Link + 13, // 9: openlibrary.v1.Book.cover:type_name -> openlibrary.v1.Book.Cover + 15, // 10: openlibrary.v1.SearchBooksResponse.docs:type_name -> google.protobuf.Struct + 2, // 11: openlibrary.v1.GetBooksResponse.BooksEntry.value:type_name -> openlibrary.v1.Book + 15, // 12: openlibrary.v1.Book.EBook.formats:type_name -> google.protobuf.Struct + 0, // 13: openlibrary.v1.BooksService.GetBooks:input_type -> openlibrary.v1.GetBooksRequest + 3, // 14: openlibrary.v1.BooksService.SearchBooks:input_type -> openlibrary.v1.SearchBooksRequest + 1, // 15: openlibrary.v1.BooksService.GetBooks:output_type -> openlibrary.v1.GetBooksResponse + 4, // 16: openlibrary.v1.BooksService.SearchBooks:output_type -> openlibrary.v1.SearchBooksResponse + 15, // [15:17] is the sub-list for method output_type + 13, // [13:15] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_openlibrary_v1_books_proto_init() } +func file_openlibrary_v1_books_proto_init() { + if File_openlibrary_v1_books_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_openlibrary_v1_books_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBooksRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBooksResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchBooksRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchBooksResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_Author); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_Classifications); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_Subject); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_Publisher); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_PublishPlace); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_Excerpts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_Link); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_Cover); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openlibrary_v1_books_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book_EBook); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_openlibrary_v1_books_proto_rawDesc, + NumEnums: 0, + NumMessages: 15, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_openlibrary_v1_books_proto_goTypes, + DependencyIndexes: file_openlibrary_v1_books_proto_depIdxs, + MessageInfos: file_openlibrary_v1_books_proto_msgTypes, + }.Build() + File_openlibrary_v1_books_proto = out.File + file_openlibrary_v1_books_proto_rawDesc = nil + file_openlibrary_v1_books_proto_goTypes = nil + file_openlibrary_v1_books_proto_depIdxs = nil +} diff --git a/internal/gen/openlibrary/v1/openlibraryv1connect/books.connect.go b/internal/gen/openlibrary/v1/openlibraryv1connect/books.connect.go new file mode 100644 index 0000000..2eed797 --- /dev/null +++ b/internal/gen/openlibrary/v1/openlibraryv1connect/books.connect.go @@ -0,0 +1,151 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: openlibrary/v1/books.proto + +package openlibraryv1connect + +import ( + connect "connectrpc.com/connect" + v1 "connectrpc.com/vanguard/internal/gen/openlibrary/v1" + context "context" + errors "errors" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion0_1_0 + +const ( + // BooksServiceName is the fully-qualified name of the BooksService service. + BooksServiceName = "openlibrary.v1.BooksService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // BooksServiceGetBooksProcedure is the fully-qualified name of the BooksService's GetBooks RPC. + BooksServiceGetBooksProcedure = "/openlibrary.v1.BooksService/GetBooks" + // BooksServiceSearchBooksProcedure is the fully-qualified name of the BooksService's SearchBooks + // RPC. + BooksServiceSearchBooksProcedure = "/openlibrary.v1.BooksService/SearchBooks" +) + +// BooksServiceClient is a client for the openlibrary.v1.BooksService service. +type BooksServiceClient interface { + // Returns a list of books given a list of ISBNs, OCLC Numbers, LCCNs and + // OLIDs (Open Library IDs). + GetBooks(context.Context, *connect.Request[v1.GetBooksRequest]) (*connect.Response[v1.GetBooksResponse], error) + // Searches for books and returns a list of books given a query string. + SearchBooks(context.Context, *connect.Request[v1.SearchBooksRequest]) (*connect.Response[v1.SearchBooksResponse], error) +} + +// NewBooksServiceClient constructs a client for the openlibrary.v1.BooksService service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewBooksServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) BooksServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &booksServiceClient{ + getBooks: connect.NewClient[v1.GetBooksRequest, v1.GetBooksResponse]( + httpClient, + baseURL+BooksServiceGetBooksProcedure, + opts..., + ), + searchBooks: connect.NewClient[v1.SearchBooksRequest, v1.SearchBooksResponse]( + httpClient, + baseURL+BooksServiceSearchBooksProcedure, + opts..., + ), + } +} + +// booksServiceClient implements BooksServiceClient. +type booksServiceClient struct { + getBooks *connect.Client[v1.GetBooksRequest, v1.GetBooksResponse] + searchBooks *connect.Client[v1.SearchBooksRequest, v1.SearchBooksResponse] +} + +// GetBooks calls openlibrary.v1.BooksService.GetBooks. +func (c *booksServiceClient) GetBooks(ctx context.Context, req *connect.Request[v1.GetBooksRequest]) (*connect.Response[v1.GetBooksResponse], error) { + return c.getBooks.CallUnary(ctx, req) +} + +// SearchBooks calls openlibrary.v1.BooksService.SearchBooks. +func (c *booksServiceClient) SearchBooks(ctx context.Context, req *connect.Request[v1.SearchBooksRequest]) (*connect.Response[v1.SearchBooksResponse], error) { + return c.searchBooks.CallUnary(ctx, req) +} + +// BooksServiceHandler is an implementation of the openlibrary.v1.BooksService service. +type BooksServiceHandler interface { + // Returns a list of books given a list of ISBNs, OCLC Numbers, LCCNs and + // OLIDs (Open Library IDs). + GetBooks(context.Context, *connect.Request[v1.GetBooksRequest]) (*connect.Response[v1.GetBooksResponse], error) + // Searches for books and returns a list of books given a query string. + SearchBooks(context.Context, *connect.Request[v1.SearchBooksRequest]) (*connect.Response[v1.SearchBooksResponse], error) +} + +// NewBooksServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewBooksServiceHandler(svc BooksServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + booksServiceGetBooksHandler := connect.NewUnaryHandler( + BooksServiceGetBooksProcedure, + svc.GetBooks, + opts..., + ) + booksServiceSearchBooksHandler := connect.NewUnaryHandler( + BooksServiceSearchBooksProcedure, + svc.SearchBooks, + opts..., + ) + return "/openlibrary.v1.BooksService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case BooksServiceGetBooksProcedure: + booksServiceGetBooksHandler.ServeHTTP(w, r) + case BooksServiceSearchBooksProcedure: + booksServiceSearchBooksHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedBooksServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedBooksServiceHandler struct{} + +func (UnimplementedBooksServiceHandler) GetBooks(context.Context, *connect.Request[v1.GetBooksRequest]) (*connect.Response[v1.GetBooksResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("openlibrary.v1.BooksService.GetBooks is not implemented")) +} + +func (UnimplementedBooksServiceHandler) SearchBooks(context.Context, *connect.Request[v1.SearchBooksRequest]) (*connect.Response[v1.SearchBooksResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("openlibrary.v1.BooksService.SearchBooks is not implemented")) +} diff --git a/internal/proto/buf.lock b/internal/proto/buf.lock index 3435191..6c4355d 100644 --- a/internal/proto/buf.lock +++ b/internal/proto/buf.lock @@ -4,5 +4,5 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: 711e289f6a384c4caeebaff7c6931ade - digest: shake256:e08fb55dad7469f69df00304eed31427d2d1576e9aab31e6bf86642688e04caaf0372f15fe6974cf79432779a635b3ea401ca69c943976dc42749524e4c25d94 + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de