├── .editorconfig ├── .env.example ├── .gitignore ├── Dockerfile ├── README.md ├── app.go ├── assets └── imgs │ ├── app.png │ ├── architecture.png │ ├── create.png │ ├── explain.png │ ├── flow.png │ ├── get.png │ ├── paginated.png │ ├── register.png │ ├── register2.png │ └── swagger.png ├── cmds ├── app │ └── main.go ├── dic │ └── main.go └── module │ └── main.go ├── configs ├── listeners.yaml ├── loggers.yaml ├── middlewares.yaml ├── modules.yaml ├── provider.go ├── routes.yaml └── upgrades.yaml ├── docs ├── basic_usage.md ├── custom_route.md ├── dic.md ├── flow_modification.md ├── http_middleware.md ├── install.md ├── log_extension.md ├── pub_sub.md ├── security.md └── upgrade.md ├── generated └── .gitignore ├── go.mod ├── go.sum ├── libs ├── bima │ ├── pagination.proto │ └── root.proto ├── google │ ├── api │ │ ├── annotations.proto │ │ ├── http.proto │ │ └── httpbody.proto │ ├── protobuf │ │ ├── any.proto │ │ ├── api.proto │ │ ├── compiler │ │ │ └── plugin.proto │ │ ├── descriptor.proto │ │ ├── duration.proto │ │ ├── empty.proto │ │ ├── field_mask.proto │ │ ├── source_context.proto │ │ ├── struct.proto │ │ ├── timestamp.proto │ │ ├── type.proto │ │ └── wrappers.proto │ └── rpc │ │ ├── code.proto │ │ ├── error_details.proto │ │ └── status.proto └── protoc-gen-openapiv2 │ └── options │ ├── annotations.proto │ └── openapiv2.proto ├── plugins └── .gitignore ├── proto_gen.sh ├── protos └── builds │ ├── pagination.pb.go │ └── root.pb.go └── swaggers ├── apidocs.swagger.json ├── favicon-16x16.png ├── favicon-32x32.png ├── index.html ├── jquery.min.js ├── modules.json ├── oauth2-redirect.html ├── swagger-ui-bundle.js ├── swagger-ui-bundle.js.map ├── swagger-ui-es-bundle-core.js ├── swagger-ui-es-bundle-core.js.map ├── swagger-ui-es-bundle.js ├── swagger-ui-es-bundle.js.map ├── swagger-ui-standalone-preset.js ├── swagger-ui-standalone-preset.js.map ├── swagger-ui.css ├── swagger-ui.css.map ├── swagger-ui.js └── swagger-ui.js.map /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_PORT=7777 2 | GRPC_PORT=1717 3 | APP_DEBUG=true 4 | APP_VERSION=1.1@dev 5 | APP_NAME=Crowde Skeleton 6 | APP_HOST=localhost 7 | API_VERSION=v1 8 | HEADER_USER_ID=User-Id 9 | HEADER_USER_EMAIL=User-Email 10 | HEADER_USER_ROLE=User-Type 11 | MAXIMUM_ROLE=2 12 | DB_DRIVER=mysql 13 | DB_HOST=localhost 14 | DB_PORT=3306 15 | DB_NAME=skeleton 16 | DB_USER=root 17 | DB_PASSWORD=secret 18 | ELASTICSEARCH_HOST=http://localhost 19 | ELASTICSEARCH_PORT=9200 20 | MONGODB_HOST=localhost 21 | MONGODB_PORT=27017 22 | AMQP_HOST=localhost 23 | AMQP_PORT=5672 24 | AMQP_USER=guest 25 | AMQP_PASSWORD=guest 26 | CACHE_LIFETIME=1020 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | !generated/.gitignore 3 | generated/* 4 | swaggers/apidocs-swagger.json 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:alpine 2 | 3 | RUN apk update && apk add --no-cache git 4 | RUN adduser -D -g '' appuser 5 | WORKDIR $GOPATH/src/app 6 | COPY . . 7 | RUN go mod tidy 8 | RUN go run cmds/dic/main.go 9 | WORKDIR $GOPATH/src/app/cmds/app 10 | RUN go build . 11 | 12 | EXPOSE 7777 13 | 14 | CMD ["./app"] 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Skeleton 2 | 3 | ![Skeleton](assets/imgs/register.png) 4 | 5 | ![Run App](assets/imgs/app.png) 6 | 7 | ![Swagger](assets/imgs/swagger.png) 8 | 9 | ## Arsitektur 10 | 11 | ![Architecture](assets/imgs/architecture.png) 12 | 13 | ## Request Flow 14 | 15 | ![Request Flow](assets/imgs/flow.png) 16 | 17 | ![Request Explaination](assets/imgs/explain.png) 18 | 19 | ## Flow Pagination 20 | 21 | ![Pagination](assets/imgs/paginated.png) 22 | 23 | ## Flow Create/Update/Delete 24 | 25 | ![Create/Update/Delete](assets/imgs/create.png) 26 | 27 | ## Flow Get 28 | 29 | ![Get](assets/imgs/get.png) 30 | 31 | ## Tool 32 | 33 | Skeleton menggunakan [gRPC Gateway](https://github.com/grpc-ecosystem/grpc-gateway), untuk menginstall tools gRPC Gateway, kamu dapat mengikuti petunjuk pada dokumentasi resminya atau kamu dapat mengikuti tahapan instalasi Skeleton. Bila kamu berhasil menginstall Skeleton sesuai dengan langkah yang diberikan, maka secara secara otomatis, tools gRPC Gateway pun akan terinstall. 34 | 35 | ## Perintah 36 | 37 | - Build Dependency Graph 38 | 39 | ``` 40 | go run cmds/dic/main.go 41 | ``` 42 | 43 | - Application 44 | 45 | ``` 46 | go run cmds/app/main.go 47 | ``` 48 | 49 | - Generator 50 | 51 | ``` 52 | go run cmds/module/main.go register 53 | go run cmds/module/main.go unregister 54 | ``` 55 | 56 | ## Testing 57 | 58 | ``` 59 | $ go test ./... [-v] 60 | ``` 61 | 62 | ## Contoh 63 | 64 | - [Todo Application](https://github.com/crowdeco/skeleton-todo) 65 | 66 | ## Dokumentasi 67 | 68 | - [Instalasi](docs/install.md) 69 | 70 | - [Awal Memulai](docs/basic_usage.md) 71 | 72 | - [Memodifikasi Flow](docs/flow_modification.md) 73 | 74 | - [Mendaftarkan Log Extension](docs/log_extension.md) 75 | 76 | - [Menggunakan Fitur Pub/Sub](docs/pub_sub.md) 77 | 78 | - [HTTP Middleware](docs/http_middleware.md) 79 | 80 | - [Security](docs/security.md) 81 | 82 | - [Custom Route](docs/custom_route.md) 83 | 84 | - [List Dependency Injection](docs/dic.md) 85 | 86 | - [Cara Aman Upgrade Aplikasi](upgrade.md) 87 | -------------------------------------------------------------------------------- /app.go: -------------------------------------------------------------------------------- 1 | package skeleton 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "time" 7 | 8 | "github.com/crowdeco/bima/v2/configs" 9 | "github.com/crowdeco/skeleton/generated/dic" 10 | "github.com/joho/godotenv" 11 | "github.com/sirupsen/logrus" 12 | ) 13 | 14 | func Run() { 15 | workDir, _ := os.Getwd() 16 | godotenv.Load() 17 | container, _ := dic.NewContainer() 18 | util := container.GetBimaUtilCli() 19 | env := container.GetBimaConfigEnv() 20 | 21 | if env.Debug { 22 | util.Println("✍ Engine Checking and Configuring...") 23 | time.Sleep(1 * time.Second) 24 | } 25 | 26 | var upgrades []configs.Upgrade 27 | for _, c := range container.GetBimaConfigParserUpgrade().Parse(workDir) { 28 | upgrades = append(upgrades, container.Get(c).(configs.Upgrade)) 29 | } 30 | 31 | var servers []configs.Server 32 | for _, c := range container.GetBimaConfigParserModule().Parse(workDir) { 33 | servers = append(servers, container.Get(fmt.Sprintf("%s:server", c)).(configs.Server)) 34 | } 35 | 36 | var listeners []configs.Listener 37 | for _, c := range container.GetBimaConfigParserListener().Parse(workDir) { 38 | listeners = append(listeners, container.Get(c).(configs.Listener)) 39 | } 40 | 41 | var middlewares []configs.Middleware 42 | for _, c := range container.GetBimaConfigParserMiddleware().Parse(workDir) { 43 | middlewares = append(middlewares, container.Get(c).(configs.Middleware)) 44 | } 45 | 46 | var extensions []logrus.Hook 47 | for _, c := range container.GetBimaConfigParserLogger().Parse(workDir) { 48 | extensions = append(extensions, container.Get(c).(logrus.Hook)) 49 | } 50 | 51 | var routes []configs.Route 52 | for _, c := range container.GetBimaConfigParserRoute().Parse(workDir) { 53 | routes = append(routes, container.Get(c).(configs.Route)) 54 | } 55 | 56 | extension := container.GetBimaPlugin() 57 | extension.Scan(fmt.Sprintf("%s/plugins", workDir)) 58 | 59 | upgrades = append(upgrades, extension.GetUpgrades()...) 60 | servers = append(servers, extension.GetServers()...) 61 | listeners = append(listeners, extension.GetListeners()...) 62 | middlewares = append(middlewares, extension.GetMiddlewares()...) 63 | extensions = append(extensions, extension.GetLoggers()...) 64 | routes = append(routes, extension.GetRoutes()...) 65 | 66 | upgrader := container.GetBimaUpgrader() 67 | upgrader.Register(upgrades) 68 | upgrader.Run() 69 | 70 | if env.Debug { 71 | util.Printf("✓ ") 72 | fmt.Printf("Total pessanger %d\n", len(servers)) 73 | util.Println("⌛ Starting Engine...") 74 | time.Sleep(300 * time.Millisecond) 75 | util.Println("🔥🔥🔥🔥🔥🔥🔥🔥🔥") 76 | time.Sleep(300 * time.Millisecond) 77 | util.Println("🔥🔥🔥🔥🔥🔥🔥🔥🔥") 78 | time.Sleep(300 * time.Millisecond) 79 | util.Println("🔥🔥🔥🔥🔥🔥🔥🔥🔥") 80 | time.Sleep(300 * time.Millisecond) 81 | util.Println("🔥 Engine Ready...") 82 | time.Sleep(1500 * time.Millisecond) 83 | } 84 | 85 | container.GetBimaRouterMux().Register(routes) 86 | container.GetBimaLoggerExtension().Register(extensions) 87 | container.GetBimaHandlerMiddleware().Register(middlewares) 88 | container.GetBimaEventDispatcher().Register(listeners) 89 | container.GetBimaRouterGateway().Register(servers) 90 | 91 | if env.Debug { 92 | util.Println("🚀 Taking Off...") 93 | time.Sleep(1 * time.Second) 94 | 95 | util.Println("🎧 🎧 🎧 Enjoy The Flight 🎧 🎧 🎧") 96 | } 97 | 98 | container.GetBimaApplication().Run(servers) 99 | } 100 | -------------------------------------------------------------------------------- /assets/imgs/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/app.png -------------------------------------------------------------------------------- /assets/imgs/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/architecture.png -------------------------------------------------------------------------------- /assets/imgs/create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/create.png -------------------------------------------------------------------------------- /assets/imgs/explain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/explain.png -------------------------------------------------------------------------------- /assets/imgs/flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/flow.png -------------------------------------------------------------------------------- /assets/imgs/get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/get.png -------------------------------------------------------------------------------- /assets/imgs/paginated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/paginated.png -------------------------------------------------------------------------------- /assets/imgs/register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/register.png -------------------------------------------------------------------------------- /assets/imgs/register2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/register2.png -------------------------------------------------------------------------------- /assets/imgs/swagger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/assets/imgs/swagger.png -------------------------------------------------------------------------------- /cmds/app/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/crowdeco/skeleton" 4 | 5 | func main() { 6 | skeleton.Run() 7 | } 8 | -------------------------------------------------------------------------------- /cmds/dic/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | dics "github.com/crowdeco/skeleton/configs" 8 | "github.com/sarulabs/dingo/v4" 9 | ) 10 | 11 | func main() { 12 | err := dingo.GenerateContainer((*dics.Provider)(nil), "generated") 13 | if err != nil { 14 | fmt.Println(err.Error()) 15 | os.Exit(1) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /cmds/module/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io/ioutil" 7 | "os" 8 | "os/exec" 9 | "regexp" 10 | "strings" 11 | 12 | configs "github.com/crowdeco/bima/v2/configs" 13 | dic "github.com/crowdeco/skeleton/generated/dic" 14 | "github.com/fatih/color" 15 | "github.com/jinzhu/copier" 16 | "github.com/joho/godotenv" 17 | "github.com/vito/go-interact/interact" 18 | "golang.org/x/mod/modfile" 19 | ) 20 | 21 | func main() { 22 | godotenv.Load() 23 | container, _ := dic.NewContainer() 24 | util := container.GetBimaUtilCli() 25 | 26 | if len(os.Args) < 2 { 27 | util.Println("Cara Penggunaan:") 28 | util.Println("go run cmds/module/main.go register") 29 | util.Println("go run cmds/module/main.g unregister") 30 | util.Println("By:") 31 | util.Println("𝕒𝕕𝟛𝕟") 32 | os.Exit(1) 33 | } 34 | 35 | if os.Args[1] != "register" && os.Args[1] != "unregister" { 36 | util.Println("Perintah tidak diketahui") 37 | util.Println("By:") 38 | util.Println("𝕒𝕕𝟛𝕟") 39 | os.Exit(1) 40 | } 41 | 42 | if os.Args[1] == "register" { 43 | register(container, util) 44 | 45 | _, err := exec.Command("sh", "proto_gen.sh").Output() 46 | if err != nil { 47 | util.Println(err.Error()) 48 | os.Exit(1) 49 | } 50 | 51 | _, err = exec.Command("go", "mod", "tidy").Output() 52 | if err != nil { 53 | util.Println(err.Error()) 54 | os.Exit(1) 55 | } 56 | 57 | _, err = exec.Command("go", "run", "cmds/dic/main.go").Output() 58 | if err != nil { 59 | util.Println(err.Error()) 60 | os.Exit(1) 61 | } 62 | } 63 | 64 | if os.Args[1] == "unregister" { 65 | if len(os.Args) < 3 { 66 | util.Println("Modul wajib diisi") 67 | util.Println("By:") 68 | util.Println("𝕒𝕕𝟛𝕟") 69 | os.Exit(1) 70 | } 71 | 72 | unregister(container, util, os.Args[2]) 73 | 74 | _, err := exec.Command("go", "run", "cmds/dic/main.go").Output() 75 | if err != nil { 76 | util.Println(err.Error()) 77 | os.Exit(1) 78 | } 79 | 80 | _, err = exec.Command("go", "mod", "tidy").Output() 81 | if err != nil { 82 | util.Println(err.Error()) 83 | os.Exit(1) 84 | } 85 | } 86 | 87 | util.Println("By:") 88 | util.Println("𝕒𝕕𝟛𝕟") 89 | } 90 | 91 | func unregister(container *dic.Container, util *color.Color, module string) { 92 | workDir, _ := os.Getwd() 93 | moduleParser := container.GetBimaConfigParserModule() 94 | word := container.GetBimaUtilWord() 95 | pluralizer := container.GetBimaUtilPluralizer() 96 | moduleName := word.Camelcase(pluralizer.Singular(module)) 97 | modulePlural := word.Underscore(pluralizer.Plural(moduleName)) 98 | list := moduleParser.Parse(workDir) 99 | 100 | exist := false 101 | for _, v := range list { 102 | if v == fmt.Sprintf("module:%s", word.Underscore(module)) { 103 | exist = true 104 | break 105 | } 106 | } 107 | 108 | if !exist { 109 | util.Println("Modul tidak terdaftar") 110 | return 111 | } 112 | 113 | mod, err := ioutil.ReadFile(fmt.Sprintf("%s/go.mod", workDir)) 114 | if err != nil { 115 | panic(err) 116 | } 117 | 118 | jsonModules := fmt.Sprintf("%s/swaggers/modules.json", workDir) 119 | file, _ := ioutil.ReadFile(jsonModules) 120 | modulesJson := []configs.ModuleJson{} 121 | registered := modulesJson 122 | json.Unmarshal(file, &modulesJson) 123 | for _, v := range modulesJson { 124 | if v.Name != moduleName { 125 | registered = append(registered, v) 126 | } 127 | } 128 | 129 | registeredByte, _ := json.Marshal(registered) 130 | ioutil.WriteFile(jsonModules, registeredByte, 0644) 131 | 132 | packageName := modfile.ModulePath(mod) 133 | yaml := fmt.Sprintf("%s/configs/modules.yaml", workDir) 134 | file, _ = ioutil.ReadFile(yaml) 135 | modules := string(file) 136 | 137 | provider := fmt.Sprintf("%s/configs/provider.go", workDir) 138 | file, _ = ioutil.ReadFile(provider) 139 | codeblock := string(file) 140 | 141 | modRegex := regexp.MustCompile(fmt.Sprintf("(?m)[\r\n]+^.*module:%s.*$", word.Underscore(module))) 142 | modules = modRegex.ReplaceAllString(modules, "") 143 | ioutil.WriteFile(yaml, []byte(modules), 0644) 144 | 145 | regex := regexp.MustCompile(fmt.Sprintf("(?m)[\r\n]+^.*%s.*$", fmt.Sprintf("%s/%s", packageName, modulePlural))) 146 | codeblock = regex.ReplaceAllString(codeblock, "") 147 | 148 | codeblock = modRegex.ReplaceAllString(codeblock, "") 149 | ioutil.WriteFile(provider, []byte(codeblock), 0644) 150 | 151 | os.RemoveAll(fmt.Sprintf("%s/%s", workDir, modulePlural)) 152 | os.Remove(fmt.Sprintf("%s/protos/%s.proto", workDir, word.Underscore(module))) 153 | os.Remove(fmt.Sprintf("%s/protos/builds/%s.pb.go", workDir, word.Underscore(module))) 154 | os.Remove(fmt.Sprintf("%s/protos/builds/%s.pb.gw.go", workDir, word.Underscore(module))) 155 | os.Remove(fmt.Sprintf("%s/swaggers/%s.swagger.json", workDir, word.Underscore(module))) 156 | 157 | util.Println("Modul berhasil dihapus") 158 | } 159 | 160 | func register(container *dic.Container, util *color.Color) { 161 | generator := container.GetBimaModuleGenerator() 162 | module := container.GetBimaTemplateModule() 163 | field := container.GetBimaTemplateField() 164 | word := container.GetBimaUtilWord() 165 | mapType := container.GetBimaConfigType() 166 | 167 | util.Println(` 168 | ______ __ ______ __ __ __ 169 | / \ / | / \ / | / | / | 170 | /$$$$$$ | ______ ______ __ __ __ ____$$ | ______ /$$$$$$ |$$ | __ ______ $$ | ______ _$$ |_ ______ _______ 171 | $$ | $$/ / \ / \ / | / | / | / $$ | / \ $$ \__$$/ $$ | / | / \ $$ | / \ / $$ | / \ / \ 172 | $$ | /$$$$$$ |/$$$$$$ |$$ | $$ | $$ |/$$$$$$$ |/$$$$$$ | $$ \ $$ |_/$$/ /$$$$$$ |$$ |/$$$$$$ |$$$$$$/ /$$$$$$ |$$$$$$$ | 173 | $$ | __ $$ | $$/ $$ | $$ |$$ | $$ | $$ |$$ | $$ |$$ $$ | $$$$$$ |$$ $$< $$ $$ |$$ |$$ $$ | $$ | __ $$ | $$ |$$ | $$ | 174 | $$ \__/ |$$ | $$ \__$$ |$$ \_$$ \_$$ |$$ \__$$ |$$$$$$$$/ / \__$$ |$$$$$$ \ $$$$$$$$/ $$ |$$$$$$$$/ $$ |/ |$$ \__$$ |$$ | $$ | 175 | $$ $$/ $$ | $$ $$/ $$ $$ $$/ $$ $$ |$$ | $$ $$/ $$ | $$ |$$ |$$ |$$ | $$ $$/ $$ $$/ $$ | $$ | 176 | $$$$$$/ $$/ $$$$$$/ $$$$$/$$$$/ $$$$$$$/ $$$$$$$/ $$$$$$/ $$/ $$/ $$$$$$$/ $$/ $$$$$$$/ $$$$/ $$$$$$/ $$/ $$/ 177 | 178 | `) 179 | moduleName(util, module) 180 | 181 | index := 2 182 | more := true 183 | for more { 184 | err := interact.NewInteraction("Tambah Kolom?").Resolve(&more) 185 | if err != nil { 186 | util.Println(err.Error()) 187 | os.Exit(1) 188 | } 189 | 190 | if more { 191 | addColumn(util, field, mapType) 192 | 193 | field.Name = strings.Replace(field.Name, " ", "", -1) 194 | column := configs.FieldTemplate{} 195 | 196 | copier.Copy(&column, field) 197 | 198 | column.Index = index 199 | column.Name = strings.Title(column.Name) 200 | column.NameUnderScore = word.Underscore(column.Name) 201 | module.Fields = append(module.Fields, &column) 202 | 203 | field.Name = "" 204 | field.ProtobufType = "" 205 | 206 | index++ 207 | } 208 | } 209 | 210 | if len(module.Fields) < 1 { 211 | util.Println("Harus ada minimal satu kolom dalam tabel") 212 | os.Exit(1) 213 | } 214 | 215 | generator.Generate(module) 216 | 217 | workDir, _ := os.Getwd() 218 | util.Println(fmt.Sprintf("Module berhasil didaftarkan pada file: %s/modules.yaml", workDir)) 219 | } 220 | 221 | func addColumn(util *color.Color, field *configs.FieldTemplate, mapType *configs.Type) { 222 | err := interact.NewInteraction("Masukkan Nama Kolom?").Resolve(&field.Name) 223 | if err != nil { 224 | util.Println(err.Error()) 225 | os.Exit(1) 226 | } 227 | 228 | if field.Name == "" { 229 | util.Println("Nama Kolom tidak boleh kosong") 230 | addColumn(util, field, mapType) 231 | } 232 | 233 | field.ProtobufType = "string" 234 | err = interact.NewInteraction("Masukkan Tipe Data?", 235 | interact.Choice{Display: "double", Value: "double"}, 236 | interact.Choice{Display: "float", Value: "float"}, 237 | interact.Choice{Display: "int32", Value: "int32"}, 238 | interact.Choice{Display: "int64", Value: "int64"}, 239 | interact.Choice{Display: "uint32", Value: "uint32"}, 240 | interact.Choice{Display: "sint32", Value: "sint32"}, 241 | interact.Choice{Display: "sint64", Value: "sint64"}, 242 | interact.Choice{Display: "fixed32", Value: "fixed32"}, 243 | interact.Choice{Display: "fixed64", Value: "fixed64"}, 244 | interact.Choice{Display: "sfixed32", Value: "sfixed32"}, 245 | interact.Choice{Display: "sfixed64", Value: "sfixed64"}, 246 | interact.Choice{Display: "bool", Value: "bool"}, 247 | interact.Choice{Display: "string", Value: "string"}, 248 | interact.Choice{Display: "bytes", Value: "bytes"}, 249 | ).Resolve(&field.ProtobufType) 250 | if err != nil { 251 | util.Println(err.Error()) 252 | os.Exit(1) 253 | } 254 | field.GolangType = mapType.Value(field.ProtobufType) 255 | 256 | field.IsRequired = true 257 | err = interact.NewInteraction("Apakah Kolom Wajib Diisi?").Resolve(&field.IsRequired) 258 | if err != nil { 259 | util.Println(err.Error()) 260 | os.Exit(1) 261 | } 262 | } 263 | 264 | func moduleName(util *color.Color, module *configs.ModuleTemplate) { 265 | err := interact.NewInteraction("Masukkan Nama Modul?").Resolve(&module.Name) 266 | if err != nil { 267 | util.Println(err.Error()) 268 | os.Exit(1) 269 | } 270 | 271 | if strings.HasSuffix(module.Name, "test") { 272 | util.Println("Modul mengandung kata 'test'") 273 | moduleName(util, module) 274 | } 275 | 276 | if module.Name == "" { 277 | util.Println("Nama Modul tidak boleh kosong") 278 | moduleName(util, module) 279 | } 280 | } 281 | -------------------------------------------------------------------------------- /configs/listeners.yaml: -------------------------------------------------------------------------------- 1 | listeners: 2 | - bima:listener:filter:elasticsearch 3 | - bima:listener:create:elasticsearch 4 | - bima:listener:update:elasticsearch 5 | - bima:listener:delete:elasticsearch 6 | - bima:listener:create:created_by 7 | - bima:listener:update:updated_by 8 | - bima:listener:delete:deleted_by 9 | -------------------------------------------------------------------------------- /configs/loggers.yaml: -------------------------------------------------------------------------------- 1 | loggers: 2 | - bima:logger:extension:mongodb 3 | -------------------------------------------------------------------------------- /configs/middlewares.yaml: -------------------------------------------------------------------------------- 1 | middlewares: 2 | - bima:middleware:recovery 3 | # - bima:middleware:auth 4 | -------------------------------------------------------------------------------- /configs/modules.yaml: -------------------------------------------------------------------------------- 1 | modules: 2 | -------------------------------------------------------------------------------- /configs/provider.go: -------------------------------------------------------------------------------- 1 | // Don't change anything in this file, this file used by Skeleton Module Manager 2 | package dics 3 | 4 | import ( 5 | //@modules:import 6 | "github.com/crowdeco/bima/v2/dics" 7 | "github.com/sarulabs/dingo/v4" 8 | ) 9 | 10 | type Provider struct { 11 | dingo.BaseProvider 12 | } 13 | 14 | func (p *Provider) Load() error { 15 | if err := p.AddDefSlice(dics.Container); err != nil { 16 | return err 17 | } 18 | //@modules:register 19 | 20 | return nil 21 | } 22 | -------------------------------------------------------------------------------- /configs/routes.yaml: -------------------------------------------------------------------------------- 1 | routes: 2 | - bima:routes:api-doc 3 | - bima:routes:health 4 | -------------------------------------------------------------------------------- /configs/upgrades.yaml: -------------------------------------------------------------------------------- 1 | upgrades: 2 | -------------------------------------------------------------------------------- /docs/basic_usage.md: -------------------------------------------------------------------------------- 1 | ## Memulai Skeleton 2 | 3 | - Pastikan DI Container terupdate `go run cmds/dic/main.go` 4 | 5 | - Buat modul baru dengan perintah `go run cmds/module/main.go register` 6 | 7 | ![Register Module](../assets/imgs/register.png) 8 | 9 | - Ikuti setiap langkah yang ada, maka **Skeleton** akan membuatkan modul untukmu secara otomatis dan menambahkan modulmu pada file `configs/modules.yaml` 10 | 11 | 12 | ![Register Module](../assets/imgs/register2.png) 13 | 14 | - Jalankan aplikasi `go run cmds/app/main.go` 15 | 16 | ![Run App](../assets/imgs/app.png) 17 | 18 | Dan bila kamu membuka halaman Dokumentasi Api maka tampilannya adalah sebagai berikut: 19 | 20 | ![Swagger](../assets/imgs/swagger.png) 21 | 22 | - Modulmu dapat diakses via `http://localhost:/api/[API_VERSION]/` `modul-plural` adalah bentuk plural dari nama modul yang kamu masukkan, kamu juga dapat melihatnya pada file `protos/.proto`, bila bingung, bisa melihat contoh pada [skeleton-todo](https://github.com/crowdeco/skeleton-todo/blob/main/protos/todo.proto#L34) 23 | 24 | - Untuk menghapus module, kamu dapat jalankan perintah `go run cmds/module/main.go unregister ` 25 | -------------------------------------------------------------------------------- /docs/custom_route.md: -------------------------------------------------------------------------------- 1 | # Cara membuat custom route 2 | 3 | - Buat file folder modul misal `controllers/upload.go` 4 | 5 | - Buat struct sesuai interface berikut: 6 | 7 | ```go 8 | Route interface { 9 | Path() string 10 | Method() string 11 | Handle(w http.ResponseWriter, r *http.Request, params map[string]string) 12 | SetClient(client *grpc.ClientConn) 13 | Middlewares() []Middleware 14 | } 15 | ``` 16 | - Daftarkan struct pada DIC (selanjutnya disebut **service**) pada folder `dics/.go`, bila bingung bisa baca dokumentasi dari [Dingo](https://github.com/sarulabs/dingo) 17 | 18 | - Daftarkan service pada file `configs/routes.yaml` 19 | 20 | - Rebuild DIC dengan perintah `go run cmds/dic/main.go` 21 | -------------------------------------------------------------------------------- /docs/dic.md: -------------------------------------------------------------------------------- 1 | ## List Dependency Injection 2 | 3 | ```go 4 | "bima:config:parser:listener" 5 | "bima:config:parser:logger" 6 | "bima:config:parser:middleware" 7 | "bima:config:parser:module" 8 | "bima:config:parser:route" 9 | "bima:config:parser:upgrade" 10 | "bima:config:user" 11 | "bima:config:template" 12 | "bima:template:module" 13 | "bima:template:field" 14 | "bima:generator:dic" 15 | "bima:generator:model" 16 | "bima:generator:module" 17 | "bima:generator:proto" 18 | "bima:generator:provider" 19 | "bima:generator:server" 20 | "bima:generator:validation" 21 | "bima:generator:swagger" 22 | "bima:database:driver:mysql" 23 | "bima:database:driver:postgresql" 24 | "bima:event:dispatcher" 25 | "bima:handler:middleware" 26 | "bima:logger:extension" 27 | "bima:listener:create:elasticsearch" 28 | "bima:listener:update:elasticsearch" 29 | "bima:listener:delete:elasticsearch" 30 | "bima:listener:create:created_by" 31 | "bima:listener:update:updated_by" 32 | "bima:listener:delete:deleted_by" 33 | "bima:listener:filter:elasticsearch" 34 | "bima:interface:database" 35 | "bima:interface:elasticsearch" 36 | "bima:interface:grpc" 37 | "bima:interface:queue" 38 | "bima:interface:rest" 39 | "bima:handler:messager" 40 | "bima:handler:handler" 41 | "bima:middleware:auth" 42 | "bima:middleware:recovery" 43 | "bima:router:mux" 44 | "bima:router:gateway" 45 | "bima:routes:api-doc" 46 | "bima:routes:health" 47 | "bima:pagination:paginator" 48 | "bima:pagination:request" 49 | "bima:service:repository" 50 | "bima:cache:memory" 51 | "bima:util:number" 52 | "bima:util:word" 53 | "bima:module" 54 | "bima:server" 55 | ``` 56 | -------------------------------------------------------------------------------- /docs/flow_modification.md: -------------------------------------------------------------------------------- 1 | # Cara memodifikasi alur menggunakan event listener 2 | 3 | - Buat file folder modul misal `listeners/serach.go` 4 | 5 | - Buat struct sesuai interface berikut: 6 | 7 | ```go 8 | Listener interface { 9 | Handle(event interface{}) 10 | Listen() string 11 | Priority() int 12 | } 13 | ``` 14 | 15 | Berikut adalah daftar event yang terdapat dalam **Skeleton** (terdapat dalam file [`events.go`](https://github.com/crowdeco/bima/blob/main/events/event.go)) 16 | 17 | ```go 18 | const PAGINATION_EVENT = "event.pagination" 19 | const BEFORE_CREATE_EVENT = "event.before_create" 20 | const AFTER_CREATE_EVENT = "event.after_create" 21 | const BEFORE_UPDATE_EVENT = "event.before_update" 22 | const AFTER_UPDATE_EVENT = "event.after_update" 23 | const BEFORE_DELETE_EVENT = "event.before_delete" 24 | const AFTER_DELETE_EVENT = "event.after_delete" 25 | const REQUEST_EVENT = "event.request" 26 | const RESPONSE_EVENT = "event.response" 27 | ``` 28 | 29 | - Daftarkan struct pada DIC (selanjutnya disebut **service**) pada folder `dics/.go`, bila bingung bisa baca dokumentasi dari [Dingo](https://github.com/sarulabs/dingo) 30 | 31 | - Daftarkan service pada file `configs/listeners.yaml` 32 | 33 | - Rebuild DIC dengan perintah `go run cmds/dic/main.go` 34 | -------------------------------------------------------------------------------- /docs/http_middleware.md: -------------------------------------------------------------------------------- 1 | # Cara mendaftarkan middleware 2 | 3 | ## Global middleware 4 | 5 | - Buat file folder modul misal `middlewares/rate_limiter.go` 6 | 7 | - Buat struct sesuai interface berikut: 8 | 9 | ```go 10 | Middleware interface { 11 | Attach(request *http.Request, response http.ResponseWriter) bool 12 | Priority() int 13 | } 14 | ``` 15 | 16 | - Daftarkan struct pada DIC (selanjutnya disebut **service**) pada folder `dics/.go`, bila bingung bisa baca dokumentasi dari [Dingo](https://github.com/sarulabs/dingo) 17 | 18 | - Daftarkan service pada file `configs/middlewares.yaml` 19 | 20 | - Rebuild DIC dengan perintah `go run cmds/dic/main.go` 21 | 22 | ## Middleware per route 23 | 24 | - Sebelumnya, baca dulu [cara membuat custom route](./custom_route.md) 25 | 26 | - Tambahkan method `Middlewares()`, middleware yang ingin digunakan pada route tersebut 27 | 28 | ```go 29 | func (r *Route) Middlewares() []Middleware { 30 | return []Middleware{ 31 | middleware1, 32 | middleware2, 33 | middleware3, 34 | } 35 | } 36 | ``` 37 | 38 | - Perlu dijadikan perhatian, pada route middleware, skeleton tidak melakukan priority order seperti pada global middleware. 39 | -------------------------------------------------------------------------------- /docs/install.md: -------------------------------------------------------------------------------- 1 | # Cara Install Skeleton 2 | 3 | ## Kebutuhan Software 4 | 5 | - Golang versi 1.14 atau lebih tinggi 6 | 7 | - Protobuf 8 | 9 | - [Protobuf Compiler](https://grpc.io/docs/protoc-installation) 10 | 11 | - Database (`mysql`, `sqlserver` atau `postgresql`) 12 | 13 | - AMQP ([RabbitMQ](https://www.rabbitmq.com)) 14 | 15 | - [Elasticsearch](https://www.elastic.co) 16 | 17 | - [MongoDB](https://www.mongodb.com) 18 | 19 | ## Cara Install 20 | 21 | - Clone `git clone https://github.com/crowdeco/skeleton.git project` 22 | 23 | - Masuk ke project `cd project` 24 | 25 | - Jalankan perintah `go run cmds/dic/main.go` 26 | 27 | - Install tool 28 | 29 | ```bash 30 | go install \ 31 | github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \ 32 | github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \ 33 | github.com/golang/protobuf/protoc-gen-go \ 34 | google.golang.org/grpc/cmd/protoc-gen-go-grpc 35 | ``` 36 | 37 | - Install dependency `go mod tidy` 38 | 39 | - Buat konfigurasi `cp .env.example .env` dan ubah sesuai kebutuhan 40 | -------------------------------------------------------------------------------- /docs/log_extension.md: -------------------------------------------------------------------------------- 1 | # Menambahkan Log Extension 2 | 3 | **Skeleton** menggunakan [Logrus](https://github.com/sirupsen/logrus) sebagai logger sehingga memungkinkan semua extension yang ada pada Logrus dapat digunakan pada **Skeleton** dengan mudah. 4 | 5 | Untuk mendaftarkan log extension, cukup membuatnya sebagai service pada `dics/.go`, bila bingung bisa baca dokumentasi dari [Dingo](https://github.com/sarulabs/dingo) 6 | 7 | - Daftarkan service pada file `configs/loggers.yaml` 8 | 9 | - Rebuild DIC dengan perintah `go run cmds/dic/main.go` 10 | -------------------------------------------------------------------------------- /docs/pub_sub.md: -------------------------------------------------------------------------------- 1 | # Cara menggunakan fitur Pub/Sub 2 | 3 | ## Cara mem-publish pesan 4 | 5 | Untuk mem-publish pesan dari file `module.go` kamu cukup memanggil 6 | 7 | ```go 8 | v := models.Todo{} 9 | //Your Logic 10 | 11 | message, _ := json.Marshal(v) 12 | m.Messenger.Publish("", message)) 13 | ``` 14 | 15 | 16 | ## Cara mendapatkan pesan 17 | 18 | Untuk mendapatkan pesan, kamu cukup copas potongan code dibawah pada method `Consume()` pada file `module.go` 19 | 20 | ```go 21 | messages, err := m.Messenger.Consume("") 22 | if err != nil { 23 | m.Logger.Error(fmt.Sprintf("%+v", err)) 24 | } 25 | 26 | v := models.Todo{} 27 | for message := range messages { 28 | json.Unmarshal(message.Payload, &v) 29 | 30 | m.Logger.Info(fmt.Sprintf("%+v", v)) 31 | 32 | // Your logic here 33 | 34 | message.Ack() 35 | } 36 | ``` 37 | -------------------------------------------------------------------------------- /docs/security.md: -------------------------------------------------------------------------------- 1 | # Security pada Skeleton 2 | 3 | **Skeleton** di-design untuk berjalan di belakang Api Gateway sehingga untuk security, **Skeleton** menggunakan paradigma yang berbeda. Karena berjalan dibelakang Api Gateway, maka **Skeleton** menganggap bahwa untuk authentication dihandle oleh Api Gateway dan **Skeleton** menjadikan header penanda bahwa sebuah request telah diautentikasi. 4 | 5 | Untuk mensetting header, kamu dapat mengaturnya pada `.env` yaitu `HEADER_USER_ID`, `HEADER_USER_EMAIL`, dan `HEADER_USER_ROLE`. Selain itu, kamu juga bisa mengatur authorization dengan mensetting header `MAXIMUM_ROLE` dimana semakin kecil nilai dari header `MAXIMUM_ROLE`, semakin strict. 6 | 7 | ## Mengaktifkan Security Middleware 8 | 9 | Secara default, fitur security yang dijelaskan di atas tidak diaktifkan (disable) dan untuk mengaktifkannya, kamu cukup menghapus komentar pada file `configs/middlewares.yaml` baris `bima:middleware:auth`. 10 | -------------------------------------------------------------------------------- /docs/upgrade.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/docs/upgrade.md -------------------------------------------------------------------------------- /generated/.gitignore: -------------------------------------------------------------------------------- 1 | dic 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/crowdeco/skeleton 2 | 3 | go 1.14 4 | 5 | require ( 6 | github.com/ThreeDotsLabs/watermill-amqp v1.1.0 7 | github.com/crowdeco/bima/v2 v2.0.6 8 | github.com/fatih/color v1.10.0 9 | github.com/gadelkareem/cachita v0.2.1 10 | github.com/gertd/go-pluralize v0.1.7 11 | github.com/golang/protobuf v1.4.3 12 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.3.0 13 | github.com/jinzhu/copier v0.2.3 14 | github.com/joho/godotenv v1.3.0 15 | github.com/olivere/elastic/v7 v7.0.22 16 | github.com/onsi/ginkgo v1.15.0 // indirect 17 | github.com/onsi/gomega v1.10.5 // indirect 18 | github.com/sarulabs/di/v2 v2.4.0 19 | github.com/sarulabs/dingo/v4 v4.0.2 20 | github.com/sirupsen/logrus v1.8.0 21 | github.com/vcraescu/go-paginator/v2 v2.0.0 22 | github.com/vito/go-interact v1.0.0 23 | golang.org/x/mod v0.4.1 24 | google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb // indirect 25 | google.golang.org/grpc v1.36.0 26 | google.golang.org/protobuf v1.25.1-0.20201208041424-160c7477e0e8 27 | gorm.io/gorm v1.21.3 28 | ) 29 | -------------------------------------------------------------------------------- /libs/bima/pagination.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package grpcs; 4 | 5 | option go_package = ".;grpcs"; 6 | 7 | message PaginationMetadata { 8 | int32 page = 1; 9 | int32 previous = 2; 10 | int32 next = 3; 11 | int32 limit = 4; 12 | int32 record = 5; 13 | int32 total = 6; 14 | } 15 | 16 | message Pagination { 17 | int32 page = 1; 18 | uint64 counter = 2; 19 | int32 limit = 3; 20 | repeated string fields = 4; 21 | repeated string values = 5; 22 | } 23 | -------------------------------------------------------------------------------- /libs/bima/root.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package grpcs; 4 | 5 | import "protoc-gen-openapiv2/options/annotations.proto"; 6 | 7 | option go_package = ".;grpcs"; 8 | 9 | option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { 10 | info: { 11 | title: "Todo API" 12 | version: "1.0" 13 | } 14 | host: "localhost:7777" 15 | schemes: HTTP 16 | schemes: HTTPS 17 | consumes: "application/json" 18 | produces: "application/json" 19 | security_definitions: { 20 | security: { 21 | key: "BasicAuth" 22 | value: { 23 | type: TYPE_BASIC 24 | } 25 | } 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /libs/google/api/annotations.proto: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, Google Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package google.api; 18 | 19 | import "google/api/http.proto"; 20 | import "google/protobuf/descriptor.proto"; 21 | 22 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; 23 | option java_multiple_files = true; 24 | option java_outer_classname = "AnnotationsProto"; 25 | option java_package = "com.google.api"; 26 | option objc_class_prefix = "GAPI"; 27 | 28 | extend google.protobuf.MethodOptions { 29 | // See `HttpRule`. 30 | HttpRule http = 72295728; 31 | } 32 | -------------------------------------------------------------------------------- /libs/google/api/http.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package google.api; 18 | 19 | option cc_enable_arenas = true; 20 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; 21 | option java_multiple_files = true; 22 | option java_outer_classname = "HttpProto"; 23 | option java_package = "com.google.api"; 24 | option objc_class_prefix = "GAPI"; 25 | 26 | 27 | // Defines the HTTP configuration for an API service. It contains a list of 28 | // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method 29 | // to one or more HTTP REST API methods. 30 | message Http { 31 | // A list of HTTP configuration rules that apply to individual API methods. 32 | // 33 | // **NOTE:** All service configuration rules follow "last one wins" order. 34 | repeated HttpRule rules = 1; 35 | 36 | // When set to true, URL path parmeters will be fully URI-decoded except in 37 | // cases of single segment matches in reserved expansion, where "%2F" will be 38 | // left encoded. 39 | // 40 | // The default behavior is to not decode RFC 6570 reserved characters in multi 41 | // segment matches. 42 | bool fully_decode_reserved_expansion = 2; 43 | } 44 | 45 | // `HttpRule` defines the mapping of an RPC method to one or more HTTP 46 | // REST API methods. The mapping specifies how different portions of the RPC 47 | // request message are mapped to URL path, URL query parameters, and 48 | // HTTP request body. The mapping is typically specified as an 49 | // `google.api.http` annotation on the RPC method, 50 | // see "google/api/annotations.proto" for details. 51 | // 52 | // The mapping consists of a field specifying the path template and 53 | // method kind. The path template can refer to fields in the request 54 | // message, as in the example below which describes a REST GET 55 | // operation on a resource collection of messages: 56 | // 57 | // 58 | // service Messaging { 59 | // rpc GetMessage(GetMessageRequest) returns (Message) { 60 | // option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; 61 | // } 62 | // } 63 | // message GetMessageRequest { 64 | // message SubMessage { 65 | // string subfield = 1; 66 | // } 67 | // string message_id = 1; // mapped to the URL 68 | // SubMessage sub = 2; // `sub.subfield` is url-mapped 69 | // } 70 | // message Message { 71 | // string text = 1; // content of the resource 72 | // } 73 | // 74 | // The same http annotation can alternatively be expressed inside the 75 | // `GRPC API Configuration` YAML file. 76 | // 77 | // http: 78 | // rules: 79 | // - selector: .Messaging.GetMessage 80 | // get: /v1/messages/{message_id}/{sub.subfield} 81 | // 82 | // This definition enables an automatic, bidrectional mapping of HTTP 83 | // JSON to RPC. Example: 84 | // 85 | // HTTP | RPC 86 | // -----|----- 87 | // `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` 88 | // 89 | // In general, not only fields but also field paths can be referenced 90 | // from a path pattern. Fields mapped to the path pattern cannot be 91 | // repeated and must have a primitive (non-message) type. 92 | // 93 | // Any fields in the request message which are not bound by the path 94 | // pattern automatically become (optional) HTTP query 95 | // parameters. Assume the following definition of the request message: 96 | // 97 | // 98 | // service Messaging { 99 | // rpc GetMessage(GetMessageRequest) returns (Message) { 100 | // option (google.api.http).get = "/v1/messages/{message_id}"; 101 | // } 102 | // } 103 | // message GetMessageRequest { 104 | // message SubMessage { 105 | // string subfield = 1; 106 | // } 107 | // string message_id = 1; // mapped to the URL 108 | // int64 revision = 2; // becomes a parameter 109 | // SubMessage sub = 3; // `sub.subfield` becomes a parameter 110 | // } 111 | // 112 | // 113 | // This enables a HTTP JSON to RPC mapping as below: 114 | // 115 | // HTTP | RPC 116 | // -----|----- 117 | // `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` 118 | // 119 | // Note that fields which are mapped to HTTP parameters must have a 120 | // primitive type or a repeated primitive type. Message types are not 121 | // allowed. In the case of a repeated type, the parameter can be 122 | // repeated in the URL, as in `...?param=A¶m=B`. 123 | // 124 | // For HTTP method kinds which allow a request body, the `body` field 125 | // specifies the mapping. Consider a REST update method on the 126 | // message resource collection: 127 | // 128 | // 129 | // service Messaging { 130 | // rpc UpdateMessage(UpdateMessageRequest) returns (Message) { 131 | // option (google.api.http) = { 132 | // put: "/v1/messages/{message_id}" 133 | // body: "message" 134 | // }; 135 | // } 136 | // } 137 | // message UpdateMessageRequest { 138 | // string message_id = 1; // mapped to the URL 139 | // Message message = 2; // mapped to the body 140 | // } 141 | // 142 | // 143 | // The following HTTP JSON to RPC mapping is enabled, where the 144 | // representation of the JSON in the request body is determined by 145 | // protos JSON encoding: 146 | // 147 | // HTTP | RPC 148 | // -----|----- 149 | // `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` 150 | // 151 | // The special name `*` can be used in the body mapping to define that 152 | // every field not bound by the path template should be mapped to the 153 | // request body. This enables the following alternative definition of 154 | // the update method: 155 | // 156 | // service Messaging { 157 | // rpc UpdateMessage(Message) returns (Message) { 158 | // option (google.api.http) = { 159 | // put: "/v1/messages/{message_id}" 160 | // body: "*" 161 | // }; 162 | // } 163 | // } 164 | // message Message { 165 | // string message_id = 1; 166 | // string text = 2; 167 | // } 168 | // 169 | // 170 | // The following HTTP JSON to RPC mapping is enabled: 171 | // 172 | // HTTP | RPC 173 | // -----|----- 174 | // `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` 175 | // 176 | // Note that when using `*` in the body mapping, it is not possible to 177 | // have HTTP parameters, as all fields not bound by the path end in 178 | // the body. This makes this option more rarely used in practice of 179 | // defining REST APIs. The common usage of `*` is in custom methods 180 | // which don't use the URL at all for transferring data. 181 | // 182 | // It is possible to define multiple HTTP methods for one RPC by using 183 | // the `additional_bindings` option. Example: 184 | // 185 | // service Messaging { 186 | // rpc GetMessage(GetMessageRequest) returns (Message) { 187 | // option (google.api.http) = { 188 | // get: "/v1/messages/{message_id}" 189 | // additional_bindings { 190 | // get: "/v1/users/{user_id}/messages/{message_id}" 191 | // } 192 | // }; 193 | // } 194 | // } 195 | // message GetMessageRequest { 196 | // string message_id = 1; 197 | // string user_id = 2; 198 | // } 199 | // 200 | // 201 | // This enables the following two alternative HTTP JSON to RPC 202 | // mappings: 203 | // 204 | // HTTP | RPC 205 | // -----|----- 206 | // `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` 207 | // `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` 208 | // 209 | // # Rules for HTTP mapping 210 | // 211 | // The rules for mapping HTTP path, query parameters, and body fields 212 | // to the request message are as follows: 213 | // 214 | // 1. The `body` field specifies either `*` or a field path, or is 215 | // omitted. If omitted, it indicates there is no HTTP request body. 216 | // 2. Leaf fields (recursive expansion of nested messages in the 217 | // request) can be classified into three types: 218 | // (a) Matched in the URL template. 219 | // (b) Covered by body (if body is `*`, everything except (a) fields; 220 | // else everything under the body field) 221 | // (c) All other fields. 222 | // 3. URL query parameters found in the HTTP request are mapped to (c) fields. 223 | // 4. Any body sent with an HTTP request can contain only (b) fields. 224 | // 225 | // The syntax of the path template is as follows: 226 | // 227 | // Template = "/" Segments [ Verb ] ; 228 | // Segments = Segment { "/" Segment } ; 229 | // Segment = "*" | "**" | LITERAL | Variable ; 230 | // Variable = "{" FieldPath [ "=" Segments ] "}" ; 231 | // FieldPath = IDENT { "." IDENT } ; 232 | // Verb = ":" LITERAL ; 233 | // 234 | // The syntax `*` matches a single path segment. The syntax `**` matches zero 235 | // or more path segments, which must be the last part of the path except the 236 | // `Verb`. The syntax `LITERAL` matches literal text in the path. 237 | // 238 | // The syntax `Variable` matches part of the URL path as specified by its 239 | // template. A variable template must not contain other variables. If a variable 240 | // matches a single path segment, its template may be omitted, e.g. `{var}` 241 | // is equivalent to `{var=*}`. 242 | // 243 | // If a variable contains exactly one path segment, such as `"{var}"` or 244 | // `"{var=*}"`, when such a variable is expanded into a URL path, all characters 245 | // except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the 246 | // Discovery Document as `{var}`. 247 | // 248 | // If a variable contains one or more path segments, such as `"{var=foo/*}"` 249 | // or `"{var=**}"`, when such a variable is expanded into a URL path, all 250 | // characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables 251 | // show up in the Discovery Document as `{+var}`. 252 | // 253 | // NOTE: While the single segment variable matches the semantics of 254 | // [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 255 | // Simple String Expansion, the multi segment variable **does not** match 256 | // RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion 257 | // does not expand special characters like `?` and `#`, which would lead 258 | // to invalid URLs. 259 | // 260 | // NOTE: the field paths in variables and in the `body` must not refer to 261 | // repeated fields or map fields. 262 | message HttpRule { 263 | // Selects methods to which this rule applies. 264 | // 265 | // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. 266 | string selector = 1; 267 | 268 | // Determines the URL pattern is matched by this rules. This pattern can be 269 | // used with any of the {get|put|post|delete|patch} methods. A custom method 270 | // can be defined using the 'custom' field. 271 | oneof pattern { 272 | // Used for listing and getting information about resources. 273 | string get = 2; 274 | 275 | // Used for updating a resource. 276 | string put = 3; 277 | 278 | // Used for creating a resource. 279 | string post = 4; 280 | 281 | // Used for deleting a resource. 282 | string delete = 5; 283 | 284 | // Used for updating a resource. 285 | string patch = 6; 286 | 287 | // The custom pattern is used for specifying an HTTP method that is not 288 | // included in the `pattern` field, such as HEAD, or "*" to leave the 289 | // HTTP method unspecified for this rule. The wild-card rule is useful 290 | // for services that provide content to Web (HTML) clients. 291 | CustomHttpPattern custom = 8; 292 | } 293 | 294 | // The name of the request field whose value is mapped to the HTTP body, or 295 | // `*` for mapping all fields not captured by the path pattern to the HTTP 296 | // body. NOTE: the referred field must not be a repeated field and must be 297 | // present at the top-level of request message type. 298 | string body = 7; 299 | 300 | // Optional. The name of the response field whose value is mapped to the HTTP 301 | // body of response. Other response fields are ignored. When 302 | // not set, the response message will be used as HTTP body of response. 303 | string response_body = 12; 304 | 305 | // Additional HTTP bindings for the selector. Nested bindings must 306 | // not contain an `additional_bindings` field themselves (that is, 307 | // the nesting may only be one level deep). 308 | repeated HttpRule additional_bindings = 11; 309 | } 310 | 311 | // A custom pattern is used for defining custom HTTP verb. 312 | message CustomHttpPattern { 313 | // The name of this custom HTTP verb. 314 | string kind = 1; 315 | 316 | // The path matched by this custom verb. 317 | string path = 2; 318 | } 319 | -------------------------------------------------------------------------------- /libs/google/api/httpbody.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Google LLC. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | syntax = "proto3"; 17 | 18 | package google.api; 19 | 20 | import "google/protobuf/any.proto"; 21 | 22 | option cc_enable_arenas = true; 23 | option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; 24 | option java_multiple_files = true; 25 | option java_outer_classname = "HttpBodyProto"; 26 | option java_package = "com.google.api"; 27 | option objc_class_prefix = "GAPI"; 28 | 29 | // Message that represents an arbitrary HTTP body. It should only be used for 30 | // payload formats that can't be represented as JSON, such as raw binary or 31 | // an HTML page. 32 | // 33 | // 34 | // This message can be used both in streaming and non-streaming API methods in 35 | // the request as well as the response. 36 | // 37 | // It can be used as a top-level request field, which is convenient if one 38 | // wants to extract parameters from either the URL or HTTP template into the 39 | // request fields and also want access to the raw HTTP body. 40 | // 41 | // Example: 42 | // 43 | // message GetResourceRequest { 44 | // // A unique request id. 45 | // string request_id = 1; 46 | // 47 | // // The raw HTTP body is bound to this field. 48 | // google.api.HttpBody http_body = 2; 49 | // } 50 | // 51 | // service ResourceService { 52 | // rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); 53 | // rpc UpdateResource(google.api.HttpBody) returns 54 | // (google.protobuf.Empty); 55 | // } 56 | // 57 | // Example with streaming methods: 58 | // 59 | // service CaldavService { 60 | // rpc GetCalendar(stream google.api.HttpBody) 61 | // returns (stream google.api.HttpBody); 62 | // rpc UpdateCalendar(stream google.api.HttpBody) 63 | // returns (stream google.api.HttpBody); 64 | // } 65 | // 66 | // Use of this type only changes how the request and response bodies are 67 | // handled, all other features will continue to work unchanged. 68 | message HttpBody { 69 | // The HTTP Content-Type header value specifying the content type of the body. 70 | string content_type = 1; 71 | 72 | // The HTTP request/response body as raw binary. 73 | bytes data = 2; 74 | 75 | // Application specific response metadata. Must be set in the first response 76 | // for streaming APIs. 77 | repeated google.protobuf.Any extensions = 3; 78 | } -------------------------------------------------------------------------------- /libs/google/protobuf/any.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 36 | option go_package = "github.com/golang/protobuf/ptypes/any"; 37 | option java_package = "com.google.protobuf"; 38 | option java_outer_classname = "AnyProto"; 39 | option java_multiple_files = true; 40 | option objc_class_prefix = "GPB"; 41 | 42 | // `Any` contains an arbitrary serialized protocol buffer message along with a 43 | // URL that describes the type of the serialized message. 44 | // 45 | // Protobuf library provides support to pack/unpack Any values in the form 46 | // of utility functions or additional generated methods of the Any type. 47 | // 48 | // Example 1: Pack and unpack a message in C++. 49 | // 50 | // Foo foo = ...; 51 | // Any any; 52 | // any.PackFrom(foo); 53 | // ... 54 | // if (any.UnpackTo(&foo)) { 55 | // ... 56 | // } 57 | // 58 | // Example 2: Pack and unpack a message in Java. 59 | // 60 | // Foo foo = ...; 61 | // Any any = Any.pack(foo); 62 | // ... 63 | // if (any.is(Foo.class)) { 64 | // foo = any.unpack(Foo.class); 65 | // } 66 | // 67 | // Example 3: Pack and unpack a message in Python. 68 | // 69 | // foo = Foo(...) 70 | // any = Any() 71 | // any.Pack(foo) 72 | // ... 73 | // if any.Is(Foo.DESCRIPTOR): 74 | // any.Unpack(foo) 75 | // ... 76 | // 77 | // Example 4: Pack and unpack a message in Go 78 | // 79 | // foo := &pb.Foo{...} 80 | // any, err := ptypes.MarshalAny(foo) 81 | // ... 82 | // foo := &pb.Foo{} 83 | // if err := ptypes.UnmarshalAny(any, foo); err != nil { 84 | // ... 85 | // } 86 | // 87 | // The pack methods provided by protobuf library will by default use 88 | // 'type.googleapis.com/full.type.name' as the type URL and the unpack 89 | // methods only use the fully qualified type name after the last '/' 90 | // in the type URL, for example "foo.bar.com/x/y.z" will yield type 91 | // name "y.z". 92 | // 93 | // 94 | // JSON 95 | // ==== 96 | // The JSON representation of an `Any` value uses the regular 97 | // representation of the deserialized, embedded message, with an 98 | // additional field `@type` which contains the type URL. Example: 99 | // 100 | // package google.profile; 101 | // message Person { 102 | // string first_name = 1; 103 | // string last_name = 2; 104 | // } 105 | // 106 | // { 107 | // "@type": "type.googleapis.com/google.profile.Person", 108 | // "firstName": , 109 | // "lastName": 110 | // } 111 | // 112 | // If the embedded message type is well-known and has a custom JSON 113 | // representation, that representation will be embedded adding a field 114 | // `value` which holds the custom JSON in addition to the `@type` 115 | // field. Example (for message [google.protobuf.Duration][]): 116 | // 117 | // { 118 | // "@type": "type.googleapis.com/google.protobuf.Duration", 119 | // "value": "1.212s" 120 | // } 121 | // 122 | message Any { 123 | // A URL/resource name that uniquely identifies the type of the serialized 124 | // protocol buffer message. This string must contain at least 125 | // one "/" character. The last segment of the URL's path must represent 126 | // the fully qualified name of the type (as in 127 | // `path/google.protobuf.Duration`). The name should be in a canonical form 128 | // (e.g., leading "." is not accepted). 129 | // 130 | // In practice, teams usually precompile into the binary all types that they 131 | // expect it to use in the context of Any. However, for URLs which use the 132 | // scheme `http`, `https`, or no scheme, one can optionally set up a type 133 | // server that maps type URLs to message definitions as follows: 134 | // 135 | // * If no scheme is provided, `https` is assumed. 136 | // * An HTTP GET on the URL must yield a [google.protobuf.Type][] 137 | // value in binary format, or produce an error. 138 | // * Applications are allowed to cache lookup results based on the 139 | // URL, or have them precompiled into a binary to avoid any 140 | // lookup. Therefore, binary compatibility needs to be preserved 141 | // on changes to types. (Use versioned type names to manage 142 | // breaking changes.) 143 | // 144 | // Note: this functionality is not currently available in the official 145 | // protobuf release, and it is not used for type URLs beginning with 146 | // type.googleapis.com. 147 | // 148 | // Schemes other than `http`, `https` (or the empty scheme) might be 149 | // used with implementation specific semantics. 150 | // 151 | string type_url = 1; 152 | 153 | // Must be a valid serialized protocol buffer of the above specified type. 154 | bytes value = 2; 155 | } 156 | -------------------------------------------------------------------------------- /libs/google/protobuf/api.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | import "google/protobuf/source_context.proto"; 36 | import "google/protobuf/type.proto"; 37 | 38 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 39 | option java_package = "com.google.protobuf"; 40 | option java_outer_classname = "ApiProto"; 41 | option java_multiple_files = true; 42 | option objc_class_prefix = "GPB"; 43 | option go_package = "google.golang.org/genproto/protobuf/api;api"; 44 | 45 | // Api is a light-weight descriptor for an API Interface. 46 | // 47 | // Interfaces are also described as "protocol buffer services" in some contexts, 48 | // such as by the "service" keyword in a .proto file, but they are different 49 | // from API Services, which represent a concrete implementation of an interface 50 | // as opposed to simply a description of methods and bindings. They are also 51 | // sometimes simply referred to as "APIs" in other contexts, such as the name of 52 | // this message itself. See https://cloud.google.com/apis/design/glossary for 53 | // detailed terminology. 54 | message Api { 55 | 56 | // The fully qualified name of this interface, including package name 57 | // followed by the interface's simple name. 58 | string name = 1; 59 | 60 | // The methods of this interface, in unspecified order. 61 | repeated Method methods = 2; 62 | 63 | // Any metadata attached to the interface. 64 | repeated Option options = 3; 65 | 66 | // A version string for this interface. If specified, must have the form 67 | // `major-version.minor-version`, as in `1.10`. If the minor version is 68 | // omitted, it defaults to zero. If the entire version field is empty, the 69 | // major version is derived from the package name, as outlined below. If the 70 | // field is not empty, the version in the package name will be verified to be 71 | // consistent with what is provided here. 72 | // 73 | // The versioning schema uses [semantic 74 | // versioning](http://semver.org) where the major version number 75 | // indicates a breaking change and the minor version an additive, 76 | // non-breaking change. Both version numbers are signals to users 77 | // what to expect from different versions, and should be carefully 78 | // chosen based on the product plan. 79 | // 80 | // The major version is also reflected in the package name of the 81 | // interface, which must end in `v`, as in 82 | // `google.feature.v1`. For major versions 0 and 1, the suffix can 83 | // be omitted. Zero major versions must only be used for 84 | // experimental, non-GA interfaces. 85 | // 86 | // 87 | string version = 4; 88 | 89 | // Source context for the protocol buffer service represented by this 90 | // message. 91 | SourceContext source_context = 5; 92 | 93 | // Included interfaces. See [Mixin][]. 94 | repeated Mixin mixins = 6; 95 | 96 | // The source syntax of the service. 97 | Syntax syntax = 7; 98 | } 99 | 100 | // Method represents a method of an API interface. 101 | message Method { 102 | 103 | // The simple name of this method. 104 | string name = 1; 105 | 106 | // A URL of the input message type. 107 | string request_type_url = 2; 108 | 109 | // If true, the request is streamed. 110 | bool request_streaming = 3; 111 | 112 | // The URL of the output message type. 113 | string response_type_url = 4; 114 | 115 | // If true, the response is streamed. 116 | bool response_streaming = 5; 117 | 118 | // Any metadata attached to the method. 119 | repeated Option options = 6; 120 | 121 | // The source syntax of this method. 122 | Syntax syntax = 7; 123 | } 124 | 125 | // Declares an API Interface to be included in this interface. The including 126 | // interface must redeclare all the methods from the included interface, but 127 | // documentation and options are inherited as follows: 128 | // 129 | // - If after comment and whitespace stripping, the documentation 130 | // string of the redeclared method is empty, it will be inherited 131 | // from the original method. 132 | // 133 | // - Each annotation belonging to the service config (http, 134 | // visibility) which is not set in the redeclared method will be 135 | // inherited. 136 | // 137 | // - If an http annotation is inherited, the path pattern will be 138 | // modified as follows. Any version prefix will be replaced by the 139 | // version of the including interface plus the [root][] path if 140 | // specified. 141 | // 142 | // Example of a simple mixin: 143 | // 144 | // package google.acl.v1; 145 | // service AccessControl { 146 | // // Get the underlying ACL object. 147 | // rpc GetAcl(GetAclRequest) returns (Acl) { 148 | // option (google.api.http).get = "/v1/{resource=**}:getAcl"; 149 | // } 150 | // } 151 | // 152 | // package google.storage.v2; 153 | // service Storage { 154 | // rpc GetAcl(GetAclRequest) returns (Acl); 155 | // 156 | // // Get a data record. 157 | // rpc GetData(GetDataRequest) returns (Data) { 158 | // option (google.api.http).get = "/v2/{resource=**}"; 159 | // } 160 | // } 161 | // 162 | // Example of a mixin configuration: 163 | // 164 | // apis: 165 | // - name: google.storage.v2.Storage 166 | // mixins: 167 | // - name: google.acl.v1.AccessControl 168 | // 169 | // The mixin construct implies that all methods in `AccessControl` are 170 | // also declared with same name and request/response types in 171 | // `Storage`. A documentation generator or annotation processor will 172 | // see the effective `Storage.GetAcl` method after inherting 173 | // documentation and annotations as follows: 174 | // 175 | // service Storage { 176 | // // Get the underlying ACL object. 177 | // rpc GetAcl(GetAclRequest) returns (Acl) { 178 | // option (google.api.http).get = "/v2/{resource=**}:getAcl"; 179 | // } 180 | // ... 181 | // } 182 | // 183 | // Note how the version in the path pattern changed from `v1` to `v2`. 184 | // 185 | // If the `root` field in the mixin is specified, it should be a 186 | // relative path under which inherited HTTP paths are placed. Example: 187 | // 188 | // apis: 189 | // - name: google.storage.v2.Storage 190 | // mixins: 191 | // - name: google.acl.v1.AccessControl 192 | // root: acls 193 | // 194 | // This implies the following inherited HTTP annotation: 195 | // 196 | // service Storage { 197 | // // Get the underlying ACL object. 198 | // rpc GetAcl(GetAclRequest) returns (Acl) { 199 | // option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; 200 | // } 201 | // ... 202 | // } 203 | message Mixin { 204 | // The fully qualified name of the interface which is included. 205 | string name = 1; 206 | 207 | // If non-empty specifies a path under which inherited HTTP paths 208 | // are rooted. 209 | string root = 2; 210 | } 211 | -------------------------------------------------------------------------------- /libs/google/protobuf/compiler/plugin.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // 33 | // WARNING: The plugin interface is currently EXPERIMENTAL and is subject to 34 | // change. 35 | // 36 | // protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is 37 | // just a program that reads a CodeGeneratorRequest from stdin and writes a 38 | // CodeGeneratorResponse to stdout. 39 | // 40 | // Plugins written using C++ can use google/protobuf/compiler/plugin.h instead 41 | // of dealing with the raw protocol defined here. 42 | // 43 | // A plugin executable needs only to be placed somewhere in the path. The 44 | // plugin should be named "protoc-gen-$NAME", and will then be used when the 45 | // flag "--${NAME}_out" is passed to protoc. 46 | 47 | syntax = "proto2"; 48 | 49 | package google.protobuf.compiler; 50 | option java_package = "com.google.protobuf.compiler"; 51 | option java_outer_classname = "PluginProtos"; 52 | 53 | option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go"; 54 | 55 | import "google/protobuf/descriptor.proto"; 56 | 57 | // The version number of protocol compiler. 58 | message Version { 59 | optional int32 major = 1; 60 | optional int32 minor = 2; 61 | optional int32 patch = 3; 62 | // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should 63 | // be empty for mainline stable releases. 64 | optional string suffix = 4; 65 | } 66 | 67 | // An encoded CodeGeneratorRequest is written to the plugin's stdin. 68 | message CodeGeneratorRequest { 69 | // The .proto files that were explicitly listed on the command-line. The 70 | // code generator should generate code only for these files. Each file's 71 | // descriptor will be included in proto_file, below. 72 | repeated string file_to_generate = 1; 73 | 74 | // The generator parameter passed on the command-line. 75 | optional string parameter = 2; 76 | 77 | // FileDescriptorProtos for all files in files_to_generate and everything 78 | // they import. The files will appear in topological order, so each file 79 | // appears before any file that imports it. 80 | // 81 | // protoc guarantees that all proto_files will be written after 82 | // the fields above, even though this is not technically guaranteed by the 83 | // protobuf wire format. This theoretically could allow a plugin to stream 84 | // in the FileDescriptorProtos and handle them one by one rather than read 85 | // the entire set into memory at once. However, as of this writing, this 86 | // is not similarly optimized on protoc's end -- it will store all fields in 87 | // memory at once before sending them to the plugin. 88 | // 89 | // Type names of fields and extensions in the FileDescriptorProto are always 90 | // fully qualified. 91 | repeated FileDescriptorProto proto_file = 15; 92 | 93 | // The version number of protocol compiler. 94 | optional Version compiler_version = 3; 95 | 96 | } 97 | 98 | // The plugin writes an encoded CodeGeneratorResponse to stdout. 99 | message CodeGeneratorResponse { 100 | // Error message. If non-empty, code generation failed. The plugin process 101 | // should exit with status code zero even if it reports an error in this way. 102 | // 103 | // This should be used to indicate errors in .proto files which prevent the 104 | // code generator from generating correct code. Errors which indicate a 105 | // problem in protoc itself -- such as the input CodeGeneratorRequest being 106 | // unparseable -- should be reported by writing a message to stderr and 107 | // exiting with a non-zero status code. 108 | optional string error = 1; 109 | 110 | // A bitmask of supported features that the code generator supports. 111 | // This is a bitwise "or" of values from the Feature enum. 112 | optional uint64 supported_features = 2; 113 | 114 | // Sync with code_generator.h. 115 | enum Feature { 116 | FEATURE_NONE = 0; 117 | FEATURE_PROTO3_OPTIONAL = 1; 118 | } 119 | 120 | // Represents a single generated file. 121 | message File { 122 | // The file name, relative to the output directory. The name must not 123 | // contain "." or ".." components and must be relative, not be absolute (so, 124 | // the file cannot lie outside the output directory). "/" must be used as 125 | // the path separator, not "\". 126 | // 127 | // If the name is omitted, the content will be appended to the previous 128 | // file. This allows the generator to break large files into small chunks, 129 | // and allows the generated text to be streamed back to protoc so that large 130 | // files need not reside completely in memory at one time. Note that as of 131 | // this writing protoc does not optimize for this -- it will read the entire 132 | // CodeGeneratorResponse before writing files to disk. 133 | optional string name = 1; 134 | 135 | // If non-empty, indicates that the named file should already exist, and the 136 | // content here is to be inserted into that file at a defined insertion 137 | // point. This feature allows a code generator to extend the output 138 | // produced by another code generator. The original generator may provide 139 | // insertion points by placing special annotations in the file that look 140 | // like: 141 | // @@protoc_insertion_point(NAME) 142 | // The annotation can have arbitrary text before and after it on the line, 143 | // which allows it to be placed in a comment. NAME should be replaced with 144 | // an identifier naming the point -- this is what other generators will use 145 | // as the insertion_point. Code inserted at this point will be placed 146 | // immediately above the line containing the insertion point (thus multiple 147 | // insertions to the same point will come out in the order they were added). 148 | // The double-@ is intended to make it unlikely that the generated code 149 | // could contain things that look like insertion points by accident. 150 | // 151 | // For example, the C++ code generator places the following line in the 152 | // .pb.h files that it generates: 153 | // // @@protoc_insertion_point(namespace_scope) 154 | // This line appears within the scope of the file's package namespace, but 155 | // outside of any particular class. Another plugin can then specify the 156 | // insertion_point "namespace_scope" to generate additional classes or 157 | // other declarations that should be placed in this scope. 158 | // 159 | // Note that if the line containing the insertion point begins with 160 | // whitespace, the same whitespace will be added to every line of the 161 | // inserted text. This is useful for languages like Python, where 162 | // indentation matters. In these languages, the insertion point comment 163 | // should be indented the same amount as any inserted code will need to be 164 | // in order to work correctly in that context. 165 | // 166 | // The code generator that generates the initial file and the one which 167 | // inserts into it must both run as part of a single invocation of protoc. 168 | // Code generators are executed in the order in which they appear on the 169 | // command line. 170 | // 171 | // If |insertion_point| is present, |name| must also be present. 172 | optional string insertion_point = 2; 173 | 174 | // The file contents. 175 | optional string content = 15; 176 | } 177 | repeated File file = 15; 178 | } 179 | -------------------------------------------------------------------------------- /libs/google/protobuf/descriptor.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | // 35 | // The messages in this file describe the definitions found in .proto files. 36 | // A valid .proto file can be translated directly to a FileDescriptorProto 37 | // without any other information (e.g. without reading its imports). 38 | 39 | 40 | syntax = "proto2"; 41 | 42 | package google.protobuf; 43 | 44 | option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; 45 | option java_package = "com.google.protobuf"; 46 | option java_outer_classname = "DescriptorProtos"; 47 | option csharp_namespace = "Google.Protobuf.Reflection"; 48 | option objc_class_prefix = "GPB"; 49 | option cc_enable_arenas = true; 50 | 51 | // descriptor.proto must be optimized for speed because reflection-based 52 | // algorithms don't work during bootstrapping. 53 | option optimize_for = SPEED; 54 | 55 | // The protocol compiler can output a FileDescriptorSet containing the .proto 56 | // files it parses. 57 | message FileDescriptorSet { 58 | repeated FileDescriptorProto file = 1; 59 | } 60 | 61 | // Describes a complete .proto file. 62 | message FileDescriptorProto { 63 | optional string name = 1; // file name, relative to root of source tree 64 | optional string package = 2; // e.g. "foo", "foo.bar", etc. 65 | 66 | // Names of files imported by this file. 67 | repeated string dependency = 3; 68 | // Indexes of the public imported files in the dependency list above. 69 | repeated int32 public_dependency = 10; 70 | // Indexes of the weak imported files in the dependency list. 71 | // For Google-internal migration only. Do not use. 72 | repeated int32 weak_dependency = 11; 73 | 74 | // All top-level definitions in this file. 75 | repeated DescriptorProto message_type = 4; 76 | repeated EnumDescriptorProto enum_type = 5; 77 | repeated ServiceDescriptorProto service = 6; 78 | repeated FieldDescriptorProto extension = 7; 79 | 80 | optional FileOptions options = 8; 81 | 82 | // This field contains optional information about the original source code. 83 | // You may safely remove this entire field without harming runtime 84 | // functionality of the descriptors -- the information is needed only by 85 | // development tools. 86 | optional SourceCodeInfo source_code_info = 9; 87 | 88 | // The syntax of the proto file. 89 | // The supported values are "proto2" and "proto3". 90 | optional string syntax = 12; 91 | } 92 | 93 | // Describes a message type. 94 | message DescriptorProto { 95 | optional string name = 1; 96 | 97 | repeated FieldDescriptorProto field = 2; 98 | repeated FieldDescriptorProto extension = 6; 99 | 100 | repeated DescriptorProto nested_type = 3; 101 | repeated EnumDescriptorProto enum_type = 4; 102 | 103 | message ExtensionRange { 104 | optional int32 start = 1; // Inclusive. 105 | optional int32 end = 2; // Exclusive. 106 | 107 | optional ExtensionRangeOptions options = 3; 108 | } 109 | repeated ExtensionRange extension_range = 5; 110 | 111 | repeated OneofDescriptorProto oneof_decl = 8; 112 | 113 | optional MessageOptions options = 7; 114 | 115 | // Range of reserved tag numbers. Reserved tag numbers may not be used by 116 | // fields or extension ranges in the same message. Reserved ranges may 117 | // not overlap. 118 | message ReservedRange { 119 | optional int32 start = 1; // Inclusive. 120 | optional int32 end = 2; // Exclusive. 121 | } 122 | repeated ReservedRange reserved_range = 9; 123 | // Reserved field names, which may not be used by fields in the same message. 124 | // A given name may only be reserved once. 125 | repeated string reserved_name = 10; 126 | } 127 | 128 | message ExtensionRangeOptions { 129 | // The parser stores options it doesn't recognize here. See above. 130 | repeated UninterpretedOption uninterpreted_option = 999; 131 | 132 | 133 | // Clients can define custom options in extensions of this message. See above. 134 | extensions 1000 to max; 135 | } 136 | 137 | // Describes a field within a message. 138 | message FieldDescriptorProto { 139 | enum Type { 140 | // 0 is reserved for errors. 141 | // Order is weird for historical reasons. 142 | TYPE_DOUBLE = 1; 143 | TYPE_FLOAT = 2; 144 | // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if 145 | // negative values are likely. 146 | TYPE_INT64 = 3; 147 | TYPE_UINT64 = 4; 148 | // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if 149 | // negative values are likely. 150 | TYPE_INT32 = 5; 151 | TYPE_FIXED64 = 6; 152 | TYPE_FIXED32 = 7; 153 | TYPE_BOOL = 8; 154 | TYPE_STRING = 9; 155 | // Tag-delimited aggregate. 156 | // Group type is deprecated and not supported in proto3. However, Proto3 157 | // implementations should still be able to parse the group wire format and 158 | // treat group fields as unknown fields. 159 | TYPE_GROUP = 10; 160 | TYPE_MESSAGE = 11; // Length-delimited aggregate. 161 | 162 | // New in version 2. 163 | TYPE_BYTES = 12; 164 | TYPE_UINT32 = 13; 165 | TYPE_ENUM = 14; 166 | TYPE_SFIXED32 = 15; 167 | TYPE_SFIXED64 = 16; 168 | TYPE_SINT32 = 17; // Uses ZigZag encoding. 169 | TYPE_SINT64 = 18; // Uses ZigZag encoding. 170 | } 171 | 172 | enum Label { 173 | // 0 is reserved for errors 174 | LABEL_OPTIONAL = 1; 175 | LABEL_REQUIRED = 2; 176 | LABEL_REPEATED = 3; 177 | } 178 | 179 | optional string name = 1; 180 | optional int32 number = 3; 181 | optional Label label = 4; 182 | 183 | // If type_name is set, this need not be set. If both this and type_name 184 | // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. 185 | optional Type type = 5; 186 | 187 | // For message and enum types, this is the name of the type. If the name 188 | // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping 189 | // rules are used to find the type (i.e. first the nested types within this 190 | // message are searched, then within the parent, on up to the root 191 | // namespace). 192 | optional string type_name = 6; 193 | 194 | // For extensions, this is the name of the type being extended. It is 195 | // resolved in the same manner as type_name. 196 | optional string extendee = 2; 197 | 198 | // For numeric types, contains the original text representation of the value. 199 | // For booleans, "true" or "false". 200 | // For strings, contains the default text contents (not escaped in any way). 201 | // For bytes, contains the C escaped value. All bytes >= 128 are escaped. 202 | // TODO(kenton): Base-64 encode? 203 | optional string default_value = 7; 204 | 205 | // If set, gives the index of a oneof in the containing type's oneof_decl 206 | // list. This field is a member of that oneof. 207 | optional int32 oneof_index = 9; 208 | 209 | // JSON name of this field. The value is set by protocol compiler. If the 210 | // user has set a "json_name" option on this field, that option's value 211 | // will be used. Otherwise, it's deduced from the field's name by converting 212 | // it to camelCase. 213 | optional string json_name = 10; 214 | 215 | optional FieldOptions options = 8; 216 | 217 | // If true, this is a proto3 "optional". When a proto3 field is optional, it 218 | // tracks presence regardless of field type. 219 | // 220 | // When proto3_optional is true, this field must be belong to a oneof to 221 | // signal to old proto3 clients that presence is tracked for this field. This 222 | // oneof is known as a "synthetic" oneof, and this field must be its sole 223 | // member (each proto3 optional field gets its own synthetic oneof). Synthetic 224 | // oneofs exist in the descriptor only, and do not generate any API. Synthetic 225 | // oneofs must be ordered after all "real" oneofs. 226 | // 227 | // For message fields, proto3_optional doesn't create any semantic change, 228 | // since non-repeated message fields always track presence. However it still 229 | // indicates the semantic detail of whether the user wrote "optional" or not. 230 | // This can be useful for round-tripping the .proto file. For consistency we 231 | // give message fields a synthetic oneof also, even though it is not required 232 | // to track presence. This is especially important because the parser can't 233 | // tell if a field is a message or an enum, so it must always create a 234 | // synthetic oneof. 235 | // 236 | // Proto2 optional fields do not set this flag, because they already indicate 237 | // optional with `LABEL_OPTIONAL`. 238 | optional bool proto3_optional = 17; 239 | } 240 | 241 | // Describes a oneof. 242 | message OneofDescriptorProto { 243 | optional string name = 1; 244 | optional OneofOptions options = 2; 245 | } 246 | 247 | // Describes an enum type. 248 | message EnumDescriptorProto { 249 | optional string name = 1; 250 | 251 | repeated EnumValueDescriptorProto value = 2; 252 | 253 | optional EnumOptions options = 3; 254 | 255 | // Range of reserved numeric values. Reserved values may not be used by 256 | // entries in the same enum. Reserved ranges may not overlap. 257 | // 258 | // Note that this is distinct from DescriptorProto.ReservedRange in that it 259 | // is inclusive such that it can appropriately represent the entire int32 260 | // domain. 261 | message EnumReservedRange { 262 | optional int32 start = 1; // Inclusive. 263 | optional int32 end = 2; // Inclusive. 264 | } 265 | 266 | // Range of reserved numeric values. Reserved numeric values may not be used 267 | // by enum values in the same enum declaration. Reserved ranges may not 268 | // overlap. 269 | repeated EnumReservedRange reserved_range = 4; 270 | 271 | // Reserved enum value names, which may not be reused. A given name may only 272 | // be reserved once. 273 | repeated string reserved_name = 5; 274 | } 275 | 276 | // Describes a value within an enum. 277 | message EnumValueDescriptorProto { 278 | optional string name = 1; 279 | optional int32 number = 2; 280 | 281 | optional EnumValueOptions options = 3; 282 | } 283 | 284 | // Describes a service. 285 | message ServiceDescriptorProto { 286 | optional string name = 1; 287 | repeated MethodDescriptorProto method = 2; 288 | 289 | optional ServiceOptions options = 3; 290 | } 291 | 292 | // Describes a method of a service. 293 | message MethodDescriptorProto { 294 | optional string name = 1; 295 | 296 | // Input and output type names. These are resolved in the same way as 297 | // FieldDescriptorProto.type_name, but must refer to a message type. 298 | optional string input_type = 2; 299 | optional string output_type = 3; 300 | 301 | optional MethodOptions options = 4; 302 | 303 | // Identifies if client streams multiple client messages 304 | optional bool client_streaming = 5 [default = false]; 305 | // Identifies if server streams multiple server messages 306 | optional bool server_streaming = 6 [default = false]; 307 | } 308 | 309 | 310 | // =================================================================== 311 | // Options 312 | 313 | // Each of the definitions above may have "options" attached. These are 314 | // just annotations which may cause code to be generated slightly differently 315 | // or may contain hints for code that manipulates protocol messages. 316 | // 317 | // Clients may define custom options as extensions of the *Options messages. 318 | // These extensions may not yet be known at parsing time, so the parser cannot 319 | // store the values in them. Instead it stores them in a field in the *Options 320 | // message called uninterpreted_option. This field must have the same name 321 | // across all *Options messages. We then use this field to populate the 322 | // extensions when we build a descriptor, at which point all protos have been 323 | // parsed and so all extensions are known. 324 | // 325 | // Extension numbers for custom options may be chosen as follows: 326 | // * For options which will only be used within a single application or 327 | // organization, or for experimental options, use field numbers 50000 328 | // through 99999. It is up to you to ensure that you do not use the 329 | // same number for multiple options. 330 | // * For options which will be published and used publicly by multiple 331 | // independent entities, e-mail protobuf-global-extension-registry@google.com 332 | // to reserve extension numbers. Simply provide your project name (e.g. 333 | // Objective-C plugin) and your project website (if available) -- there's no 334 | // need to explain how you intend to use them. Usually you only need one 335 | // extension number. You can declare multiple options with only one extension 336 | // number by putting them in a sub-message. See the Custom Options section of 337 | // the docs for examples: 338 | // https://developers.google.com/protocol-buffers/docs/proto#options 339 | // If this turns out to be popular, a web service will be set up 340 | // to automatically assign option numbers. 341 | 342 | message FileOptions { 343 | 344 | // Sets the Java package where classes generated from this .proto will be 345 | // placed. By default, the proto package is used, but this is often 346 | // inappropriate because proto packages do not normally start with backwards 347 | // domain names. 348 | optional string java_package = 1; 349 | 350 | 351 | // If set, all the classes from the .proto file are wrapped in a single 352 | // outer class with the given name. This applies to both Proto1 353 | // (equivalent to the old "--one_java_file" option) and Proto2 (where 354 | // a .proto always translates to a single class, but you may want to 355 | // explicitly choose the class name). 356 | optional string java_outer_classname = 8; 357 | 358 | // If set true, then the Java code generator will generate a separate .java 359 | // file for each top-level message, enum, and service defined in the .proto 360 | // file. Thus, these types will *not* be nested inside the outer class 361 | // named by java_outer_classname. However, the outer class will still be 362 | // generated to contain the file's getDescriptor() method as well as any 363 | // top-level extensions defined in the file. 364 | optional bool java_multiple_files = 10 [default = false]; 365 | 366 | // This option does nothing. 367 | optional bool java_generate_equals_and_hash = 20 [deprecated=true]; 368 | 369 | // If set true, then the Java2 code generator will generate code that 370 | // throws an exception whenever an attempt is made to assign a non-UTF-8 371 | // byte sequence to a string field. 372 | // Message reflection will do the same. 373 | // However, an extension field still accepts non-UTF-8 byte sequences. 374 | // This option has no effect on when used with the lite runtime. 375 | optional bool java_string_check_utf8 = 27 [default = false]; 376 | 377 | 378 | // Generated classes can be optimized for speed or code size. 379 | enum OptimizeMode { 380 | SPEED = 1; // Generate complete code for parsing, serialization, 381 | // etc. 382 | CODE_SIZE = 2; // Use ReflectionOps to implement these methods. 383 | LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. 384 | } 385 | optional OptimizeMode optimize_for = 9 [default = SPEED]; 386 | 387 | // Sets the Go package where structs generated from this .proto will be 388 | // placed. If omitted, the Go package will be derived from the following: 389 | // - The basename of the package import path, if provided. 390 | // - Otherwise, the package statement in the .proto file, if present. 391 | // - Otherwise, the basename of the .proto file, without extension. 392 | optional string go_package = 11; 393 | 394 | 395 | 396 | 397 | // Should generic services be generated in each language? "Generic" services 398 | // are not specific to any particular RPC system. They are generated by the 399 | // main code generators in each language (without additional plugins). 400 | // Generic services were the only kind of service generation supported by 401 | // early versions of google.protobuf. 402 | // 403 | // Generic services are now considered deprecated in favor of using plugins 404 | // that generate code specific to your particular RPC system. Therefore, 405 | // these default to false. Old code which depends on generic services should 406 | // explicitly set them to true. 407 | optional bool cc_generic_services = 16 [default = false]; 408 | optional bool java_generic_services = 17 [default = false]; 409 | optional bool py_generic_services = 18 [default = false]; 410 | optional bool php_generic_services = 42 [default = false]; 411 | 412 | // Is this file deprecated? 413 | // Depending on the target platform, this can emit Deprecated annotations 414 | // for everything in the file, or it will be completely ignored; in the very 415 | // least, this is a formalization for deprecating files. 416 | optional bool deprecated = 23 [default = false]; 417 | 418 | // Enables the use of arenas for the proto messages in this file. This applies 419 | // only to generated classes for C++. 420 | optional bool cc_enable_arenas = 31 [default = true]; 421 | 422 | 423 | // Sets the objective c class prefix which is prepended to all objective c 424 | // generated classes from this .proto. There is no default. 425 | optional string objc_class_prefix = 36; 426 | 427 | // Namespace for generated classes; defaults to the package. 428 | optional string csharp_namespace = 37; 429 | 430 | // By default Swift generators will take the proto package and CamelCase it 431 | // replacing '.' with underscore and use that to prefix the types/symbols 432 | // defined. When this options is provided, they will use this value instead 433 | // to prefix the types/symbols defined. 434 | optional string swift_prefix = 39; 435 | 436 | // Sets the php class prefix which is prepended to all php generated classes 437 | // from this .proto. Default is empty. 438 | optional string php_class_prefix = 40; 439 | 440 | // Use this option to change the namespace of php generated classes. Default 441 | // is empty. When this option is empty, the package name will be used for 442 | // determining the namespace. 443 | optional string php_namespace = 41; 444 | 445 | // Use this option to change the namespace of php generated metadata classes. 446 | // Default is empty. When this option is empty, the proto file name will be 447 | // used for determining the namespace. 448 | optional string php_metadata_namespace = 44; 449 | 450 | // Use this option to change the package of ruby generated classes. Default 451 | // is empty. When this option is not set, the package name will be used for 452 | // determining the ruby package. 453 | optional string ruby_package = 45; 454 | 455 | 456 | // The parser stores options it doesn't recognize here. 457 | // See the documentation for the "Options" section above. 458 | repeated UninterpretedOption uninterpreted_option = 999; 459 | 460 | // Clients can define custom options in extensions of this message. 461 | // See the documentation for the "Options" section above. 462 | extensions 1000 to max; 463 | 464 | reserved 38; 465 | } 466 | 467 | message MessageOptions { 468 | // Set true to use the old proto1 MessageSet wire format for extensions. 469 | // This is provided for backwards-compatibility with the MessageSet wire 470 | // format. You should not use this for any other reason: It's less 471 | // efficient, has fewer features, and is more complicated. 472 | // 473 | // The message must be defined exactly as follows: 474 | // message Foo { 475 | // option message_set_wire_format = true; 476 | // extensions 4 to max; 477 | // } 478 | // Note that the message cannot have any defined fields; MessageSets only 479 | // have extensions. 480 | // 481 | // All extensions of your type must be singular messages; e.g. they cannot 482 | // be int32s, enums, or repeated messages. 483 | // 484 | // Because this is an option, the above two restrictions are not enforced by 485 | // the protocol compiler. 486 | optional bool message_set_wire_format = 1 [default = false]; 487 | 488 | // Disables the generation of the standard "descriptor()" accessor, which can 489 | // conflict with a field of the same name. This is meant to make migration 490 | // from proto1 easier; new code should avoid fields named "descriptor". 491 | optional bool no_standard_descriptor_accessor = 2 [default = false]; 492 | 493 | // Is this message deprecated? 494 | // Depending on the target platform, this can emit Deprecated annotations 495 | // for the message, or it will be completely ignored; in the very least, 496 | // this is a formalization for deprecating messages. 497 | optional bool deprecated = 3 [default = false]; 498 | 499 | // Whether the message is an automatically generated map entry type for the 500 | // maps field. 501 | // 502 | // For maps fields: 503 | // map map_field = 1; 504 | // The parsed descriptor looks like: 505 | // message MapFieldEntry { 506 | // option map_entry = true; 507 | // optional KeyType key = 1; 508 | // optional ValueType value = 2; 509 | // } 510 | // repeated MapFieldEntry map_field = 1; 511 | // 512 | // Implementations may choose not to generate the map_entry=true message, but 513 | // use a native map in the target language to hold the keys and values. 514 | // The reflection APIs in such implementations still need to work as 515 | // if the field is a repeated message field. 516 | // 517 | // NOTE: Do not set the option in .proto files. Always use the maps syntax 518 | // instead. The option should only be implicitly set by the proto compiler 519 | // parser. 520 | optional bool map_entry = 7; 521 | 522 | reserved 8; // javalite_serializable 523 | reserved 9; // javanano_as_lite 524 | 525 | 526 | // The parser stores options it doesn't recognize here. See above. 527 | repeated UninterpretedOption uninterpreted_option = 999; 528 | 529 | // Clients can define custom options in extensions of this message. See above. 530 | extensions 1000 to max; 531 | } 532 | 533 | message FieldOptions { 534 | // The ctype option instructs the C++ code generator to use a different 535 | // representation of the field than it normally would. See the specific 536 | // options below. This option is not yet implemented in the open source 537 | // release -- sorry, we'll try to include it in a future version! 538 | optional CType ctype = 1 [default = STRING]; 539 | enum CType { 540 | // Default mode. 541 | STRING = 0; 542 | 543 | CORD = 1; 544 | 545 | STRING_PIECE = 2; 546 | } 547 | // The packed option can be enabled for repeated primitive fields to enable 548 | // a more efficient representation on the wire. Rather than repeatedly 549 | // writing the tag and type for each element, the entire array is encoded as 550 | // a single length-delimited blob. In proto3, only explicit setting it to 551 | // false will avoid using packed encoding. 552 | optional bool packed = 2; 553 | 554 | // The jstype option determines the JavaScript type used for values of the 555 | // field. The option is permitted only for 64 bit integral and fixed types 556 | // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING 557 | // is represented as JavaScript string, which avoids loss of precision that 558 | // can happen when a large value is converted to a floating point JavaScript. 559 | // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to 560 | // use the JavaScript "number" type. The behavior of the default option 561 | // JS_NORMAL is implementation dependent. 562 | // 563 | // This option is an enum to permit additional types to be added, e.g. 564 | // goog.math.Integer. 565 | optional JSType jstype = 6 [default = JS_NORMAL]; 566 | enum JSType { 567 | // Use the default type. 568 | JS_NORMAL = 0; 569 | 570 | // Use JavaScript strings. 571 | JS_STRING = 1; 572 | 573 | // Use JavaScript numbers. 574 | JS_NUMBER = 2; 575 | } 576 | 577 | // Should this field be parsed lazily? Lazy applies only to message-type 578 | // fields. It means that when the outer message is initially parsed, the 579 | // inner message's contents will not be parsed but instead stored in encoded 580 | // form. The inner message will actually be parsed when it is first accessed. 581 | // 582 | // This is only a hint. Implementations are free to choose whether to use 583 | // eager or lazy parsing regardless of the value of this option. However, 584 | // setting this option true suggests that the protocol author believes that 585 | // using lazy parsing on this field is worth the additional bookkeeping 586 | // overhead typically needed to implement it. 587 | // 588 | // This option does not affect the public interface of any generated code; 589 | // all method signatures remain the same. Furthermore, thread-safety of the 590 | // interface is not affected by this option; const methods remain safe to 591 | // call from multiple threads concurrently, while non-const methods continue 592 | // to require exclusive access. 593 | // 594 | // 595 | // Note that implementations may choose not to check required fields within 596 | // a lazy sub-message. That is, calling IsInitialized() on the outer message 597 | // may return true even if the inner message has missing required fields. 598 | // This is necessary because otherwise the inner message would have to be 599 | // parsed in order to perform the check, defeating the purpose of lazy 600 | // parsing. An implementation which chooses not to check required fields 601 | // must be consistent about it. That is, for any particular sub-message, the 602 | // implementation must either *always* check its required fields, or *never* 603 | // check its required fields, regardless of whether or not the message has 604 | // been parsed. 605 | optional bool lazy = 5 [default = false]; 606 | 607 | // Is this field deprecated? 608 | // Depending on the target platform, this can emit Deprecated annotations 609 | // for accessors, or it will be completely ignored; in the very least, this 610 | // is a formalization for deprecating fields. 611 | optional bool deprecated = 3 [default = false]; 612 | 613 | // For Google-internal migration only. Do not use. 614 | optional bool weak = 10 [default = false]; 615 | 616 | 617 | // The parser stores options it doesn't recognize here. See above. 618 | repeated UninterpretedOption uninterpreted_option = 999; 619 | 620 | // Clients can define custom options in extensions of this message. See above. 621 | extensions 1000 to max; 622 | 623 | reserved 4; // removed jtype 624 | } 625 | 626 | message OneofOptions { 627 | // The parser stores options it doesn't recognize here. See above. 628 | repeated UninterpretedOption uninterpreted_option = 999; 629 | 630 | // Clients can define custom options in extensions of this message. See above. 631 | extensions 1000 to max; 632 | } 633 | 634 | message EnumOptions { 635 | 636 | // Set this option to true to allow mapping different tag names to the same 637 | // value. 638 | optional bool allow_alias = 2; 639 | 640 | // Is this enum deprecated? 641 | // Depending on the target platform, this can emit Deprecated annotations 642 | // for the enum, or it will be completely ignored; in the very least, this 643 | // is a formalization for deprecating enums. 644 | optional bool deprecated = 3 [default = false]; 645 | 646 | reserved 5; // javanano_as_lite 647 | 648 | // The parser stores options it doesn't recognize here. See above. 649 | repeated UninterpretedOption uninterpreted_option = 999; 650 | 651 | // Clients can define custom options in extensions of this message. See above. 652 | extensions 1000 to max; 653 | } 654 | 655 | message EnumValueOptions { 656 | // Is this enum value deprecated? 657 | // Depending on the target platform, this can emit Deprecated annotations 658 | // for the enum value, or it will be completely ignored; in the very least, 659 | // this is a formalization for deprecating enum values. 660 | optional bool deprecated = 1 [default = false]; 661 | 662 | // The parser stores options it doesn't recognize here. See above. 663 | repeated UninterpretedOption uninterpreted_option = 999; 664 | 665 | // Clients can define custom options in extensions of this message. See above. 666 | extensions 1000 to max; 667 | } 668 | 669 | message ServiceOptions { 670 | 671 | // Note: Field numbers 1 through 32 are reserved for Google's internal RPC 672 | // framework. We apologize for hoarding these numbers to ourselves, but 673 | // we were already using them long before we decided to release Protocol 674 | // Buffers. 675 | 676 | // Is this service deprecated? 677 | // Depending on the target platform, this can emit Deprecated annotations 678 | // for the service, or it will be completely ignored; in the very least, 679 | // this is a formalization for deprecating services. 680 | optional bool deprecated = 33 [default = false]; 681 | 682 | // The parser stores options it doesn't recognize here. See above. 683 | repeated UninterpretedOption uninterpreted_option = 999; 684 | 685 | // Clients can define custom options in extensions of this message. See above. 686 | extensions 1000 to max; 687 | } 688 | 689 | message MethodOptions { 690 | 691 | // Note: Field numbers 1 through 32 are reserved for Google's internal RPC 692 | // framework. We apologize for hoarding these numbers to ourselves, but 693 | // we were already using them long before we decided to release Protocol 694 | // Buffers. 695 | 696 | // Is this method deprecated? 697 | // Depending on the target platform, this can emit Deprecated annotations 698 | // for the method, or it will be completely ignored; in the very least, 699 | // this is a formalization for deprecating methods. 700 | optional bool deprecated = 33 [default = false]; 701 | 702 | // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, 703 | // or neither? HTTP based RPC implementation may choose GET verb for safe 704 | // methods, and PUT verb for idempotent methods instead of the default POST. 705 | enum IdempotencyLevel { 706 | IDEMPOTENCY_UNKNOWN = 0; 707 | NO_SIDE_EFFECTS = 1; // implies idempotent 708 | IDEMPOTENT = 2; // idempotent, but may have side effects 709 | } 710 | optional IdempotencyLevel idempotency_level = 34 711 | [default = IDEMPOTENCY_UNKNOWN]; 712 | 713 | // The parser stores options it doesn't recognize here. See above. 714 | repeated UninterpretedOption uninterpreted_option = 999; 715 | 716 | // Clients can define custom options in extensions of this message. See above. 717 | extensions 1000 to max; 718 | } 719 | 720 | 721 | // A message representing a option the parser does not recognize. This only 722 | // appears in options protos created by the compiler::Parser class. 723 | // DescriptorPool resolves these when building Descriptor objects. Therefore, 724 | // options protos in descriptor objects (e.g. returned by Descriptor::options(), 725 | // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions 726 | // in them. 727 | message UninterpretedOption { 728 | // The name of the uninterpreted option. Each string represents a segment in 729 | // a dot-separated name. is_extension is true iff a segment represents an 730 | // extension (denoted with parentheses in options specs in .proto files). 731 | // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents 732 | // "foo.(bar.baz).qux". 733 | message NamePart { 734 | required string name_part = 1; 735 | required bool is_extension = 2; 736 | } 737 | repeated NamePart name = 2; 738 | 739 | // The value of the uninterpreted option, in whatever type the tokenizer 740 | // identified it as during parsing. Exactly one of these should be set. 741 | optional string identifier_value = 3; 742 | optional uint64 positive_int_value = 4; 743 | optional int64 negative_int_value = 5; 744 | optional double double_value = 6; 745 | optional bytes string_value = 7; 746 | optional string aggregate_value = 8; 747 | } 748 | 749 | // =================================================================== 750 | // Optional source code info 751 | 752 | // Encapsulates information about the original source file from which a 753 | // FileDescriptorProto was generated. 754 | message SourceCodeInfo { 755 | // A Location identifies a piece of source code in a .proto file which 756 | // corresponds to a particular definition. This information is intended 757 | // to be useful to IDEs, code indexers, documentation generators, and similar 758 | // tools. 759 | // 760 | // For example, say we have a file like: 761 | // message Foo { 762 | // optional string foo = 1; 763 | // } 764 | // Let's look at just the field definition: 765 | // optional string foo = 1; 766 | // ^ ^^ ^^ ^ ^^^ 767 | // a bc de f ghi 768 | // We have the following locations: 769 | // span path represents 770 | // [a,i) [ 4, 0, 2, 0 ] The whole field definition. 771 | // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). 772 | // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). 773 | // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). 774 | // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). 775 | // 776 | // Notes: 777 | // - A location may refer to a repeated field itself (i.e. not to any 778 | // particular index within it). This is used whenever a set of elements are 779 | // logically enclosed in a single code segment. For example, an entire 780 | // extend block (possibly containing multiple extension definitions) will 781 | // have an outer location whose path refers to the "extensions" repeated 782 | // field without an index. 783 | // - Multiple locations may have the same path. This happens when a single 784 | // logical declaration is spread out across multiple places. The most 785 | // obvious example is the "extend" block again -- there may be multiple 786 | // extend blocks in the same scope, each of which will have the same path. 787 | // - A location's span is not always a subset of its parent's span. For 788 | // example, the "extendee" of an extension declaration appears at the 789 | // beginning of the "extend" block and is shared by all extensions within 790 | // the block. 791 | // - Just because a location's span is a subset of some other location's span 792 | // does not mean that it is a descendant. For example, a "group" defines 793 | // both a type and a field in a single declaration. Thus, the locations 794 | // corresponding to the type and field and their components will overlap. 795 | // - Code which tries to interpret locations should probably be designed to 796 | // ignore those that it doesn't understand, as more types of locations could 797 | // be recorded in the future. 798 | repeated Location location = 1; 799 | message Location { 800 | // Identifies which part of the FileDescriptorProto was defined at this 801 | // location. 802 | // 803 | // Each element is a field number or an index. They form a path from 804 | // the root FileDescriptorProto to the place where the definition. For 805 | // example, this path: 806 | // [ 4, 3, 2, 7, 1 ] 807 | // refers to: 808 | // file.message_type(3) // 4, 3 809 | // .field(7) // 2, 7 810 | // .name() // 1 811 | // This is because FileDescriptorProto.message_type has field number 4: 812 | // repeated DescriptorProto message_type = 4; 813 | // and DescriptorProto.field has field number 2: 814 | // repeated FieldDescriptorProto field = 2; 815 | // and FieldDescriptorProto.name has field number 1: 816 | // optional string name = 1; 817 | // 818 | // Thus, the above path gives the location of a field name. If we removed 819 | // the last element: 820 | // [ 4, 3, 2, 7 ] 821 | // this path refers to the whole field declaration (from the beginning 822 | // of the label to the terminating semicolon). 823 | repeated int32 path = 1 [packed = true]; 824 | 825 | // Always has exactly three or four elements: start line, start column, 826 | // end line (optional, otherwise assumed same as start line), end column. 827 | // These are packed into a single field for efficiency. Note that line 828 | // and column numbers are zero-based -- typically you will want to add 829 | // 1 to each before displaying to a user. 830 | repeated int32 span = 2 [packed = true]; 831 | 832 | // If this SourceCodeInfo represents a complete declaration, these are any 833 | // comments appearing before and after the declaration which appear to be 834 | // attached to the declaration. 835 | // 836 | // A series of line comments appearing on consecutive lines, with no other 837 | // tokens appearing on those lines, will be treated as a single comment. 838 | // 839 | // leading_detached_comments will keep paragraphs of comments that appear 840 | // before (but not connected to) the current element. Each paragraph, 841 | // separated by empty lines, will be one comment element in the repeated 842 | // field. 843 | // 844 | // Only the comment content is provided; comment markers (e.g. //) are 845 | // stripped out. For block comments, leading whitespace and an asterisk 846 | // will be stripped from the beginning of each line other than the first. 847 | // Newlines are included in the output. 848 | // 849 | // Examples: 850 | // 851 | // optional int32 foo = 1; // Comment attached to foo. 852 | // // Comment attached to bar. 853 | // optional int32 bar = 2; 854 | // 855 | // optional string baz = 3; 856 | // // Comment attached to baz. 857 | // // Another line attached to baz. 858 | // 859 | // // Comment attached to qux. 860 | // // 861 | // // Another line attached to qux. 862 | // optional double qux = 4; 863 | // 864 | // // Detached comment for corge. This is not leading or trailing comments 865 | // // to qux or corge because there are blank lines separating it from 866 | // // both. 867 | // 868 | // // Detached comment for corge paragraph 2. 869 | // 870 | // optional string corge = 5; 871 | // /* Block comment attached 872 | // * to corge. Leading asterisks 873 | // * will be removed. */ 874 | // /* Block comment attached to 875 | // * grault. */ 876 | // optional int32 grault = 6; 877 | // 878 | // // ignored detached comments. 879 | optional string leading_comments = 3; 880 | optional string trailing_comments = 4; 881 | repeated string leading_detached_comments = 6; 882 | } 883 | } 884 | 885 | // Describes the relationship between generated code and its original source 886 | // file. A GeneratedCodeInfo message is associated with only one generated 887 | // source file, but may contain references to different source .proto files. 888 | message GeneratedCodeInfo { 889 | // An Annotation connects some span of text in generated code to an element 890 | // of its generating .proto file. 891 | repeated Annotation annotation = 1; 892 | message Annotation { 893 | // Identifies the element in the original source .proto file. This field 894 | // is formatted the same as SourceCodeInfo.Location.path. 895 | repeated int32 path = 1 [packed = true]; 896 | 897 | // Identifies the filesystem path to the original source .proto. 898 | optional string source_file = 2; 899 | 900 | // Identifies the starting offset in bytes in the generated code 901 | // that relates to the identified object. 902 | optional int32 begin = 3; 903 | 904 | // Identifies the ending offset in bytes in the generated code that 905 | // relates to the identified offset. The end offset should be one past 906 | // the last relevant byte (so the length of the text = end - begin). 907 | optional int32 end = 4; 908 | } 909 | } 910 | -------------------------------------------------------------------------------- /libs/google/protobuf/duration.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 36 | option cc_enable_arenas = true; 37 | option go_package = "github.com/golang/protobuf/ptypes/duration"; 38 | option java_package = "com.google.protobuf"; 39 | option java_outer_classname = "DurationProto"; 40 | option java_multiple_files = true; 41 | option objc_class_prefix = "GPB"; 42 | 43 | // A Duration represents a signed, fixed-length span of time represented 44 | // as a count of seconds and fractions of seconds at nanosecond 45 | // resolution. It is independent of any calendar and concepts like "day" 46 | // or "month". It is related to Timestamp in that the difference between 47 | // two Timestamp values is a Duration and it can be added or subtracted 48 | // from a Timestamp. Range is approximately +-10,000 years. 49 | // 50 | // # Examples 51 | // 52 | // Example 1: Compute Duration from two Timestamps in pseudo code. 53 | // 54 | // Timestamp start = ...; 55 | // Timestamp end = ...; 56 | // Duration duration = ...; 57 | // 58 | // duration.seconds = end.seconds - start.seconds; 59 | // duration.nanos = end.nanos - start.nanos; 60 | // 61 | // if (duration.seconds < 0 && duration.nanos > 0) { 62 | // duration.seconds += 1; 63 | // duration.nanos -= 1000000000; 64 | // } else if (duration.seconds > 0 && duration.nanos < 0) { 65 | // duration.seconds -= 1; 66 | // duration.nanos += 1000000000; 67 | // } 68 | // 69 | // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. 70 | // 71 | // Timestamp start = ...; 72 | // Duration duration = ...; 73 | // Timestamp end = ...; 74 | // 75 | // end.seconds = start.seconds + duration.seconds; 76 | // end.nanos = start.nanos + duration.nanos; 77 | // 78 | // if (end.nanos < 0) { 79 | // end.seconds -= 1; 80 | // end.nanos += 1000000000; 81 | // } else if (end.nanos >= 1000000000) { 82 | // end.seconds += 1; 83 | // end.nanos -= 1000000000; 84 | // } 85 | // 86 | // Example 3: Compute Duration from datetime.timedelta in Python. 87 | // 88 | // td = datetime.timedelta(days=3, minutes=10) 89 | // duration = Duration() 90 | // duration.FromTimedelta(td) 91 | // 92 | // # JSON Mapping 93 | // 94 | // In JSON format, the Duration type is encoded as a string rather than an 95 | // object, where the string ends in the suffix "s" (indicating seconds) and 96 | // is preceded by the number of seconds, with nanoseconds expressed as 97 | // fractional seconds. For example, 3 seconds with 0 nanoseconds should be 98 | // encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should 99 | // be expressed in JSON format as "3.000000001s", and 3 seconds and 1 100 | // microsecond should be expressed in JSON format as "3.000001s". 101 | // 102 | // 103 | message Duration { 104 | // Signed seconds of the span of time. Must be from -315,576,000,000 105 | // to +315,576,000,000 inclusive. Note: these bounds are computed from: 106 | // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years 107 | int64 seconds = 1; 108 | 109 | // Signed fractions of a second at nanosecond resolution of the span 110 | // of time. Durations less than one second are represented with a 0 111 | // `seconds` field and a positive or negative `nanos` field. For durations 112 | // of one second or more, a non-zero value for the `nanos` field must be 113 | // of the same sign as the `seconds` field. Must be from -999,999,999 114 | // to +999,999,999 inclusive. 115 | int32 nanos = 2; 116 | } 117 | -------------------------------------------------------------------------------- /libs/google/protobuf/empty.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 36 | option go_package = "github.com/golang/protobuf/ptypes/empty"; 37 | option java_package = "com.google.protobuf"; 38 | option java_outer_classname = "EmptyProto"; 39 | option java_multiple_files = true; 40 | option objc_class_prefix = "GPB"; 41 | option cc_enable_arenas = true; 42 | 43 | // A generic empty message that you can re-use to avoid defining duplicated 44 | // empty messages in your APIs. A typical example is to use it as the request 45 | // or the response type of an API method. For instance: 46 | // 47 | // service Foo { 48 | // rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); 49 | // } 50 | // 51 | // The JSON representation for `Empty` is empty JSON object `{}`. 52 | message Empty {} 53 | -------------------------------------------------------------------------------- /libs/google/protobuf/field_mask.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 36 | option java_package = "com.google.protobuf"; 37 | option java_outer_classname = "FieldMaskProto"; 38 | option java_multiple_files = true; 39 | option objc_class_prefix = "GPB"; 40 | option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; 41 | option cc_enable_arenas = true; 42 | 43 | // `FieldMask` represents a set of symbolic field paths, for example: 44 | // 45 | // paths: "f.a" 46 | // paths: "f.b.d" 47 | // 48 | // Here `f` represents a field in some root message, `a` and `b` 49 | // fields in the message found in `f`, and `d` a field found in the 50 | // message in `f.b`. 51 | // 52 | // Field masks are used to specify a subset of fields that should be 53 | // returned by a get operation or modified by an update operation. 54 | // Field masks also have a custom JSON encoding (see below). 55 | // 56 | // # Field Masks in Projections 57 | // 58 | // When used in the context of a projection, a response message or 59 | // sub-message is filtered by the API to only contain those fields as 60 | // specified in the mask. For example, if the mask in the previous 61 | // example is applied to a response message as follows: 62 | // 63 | // f { 64 | // a : 22 65 | // b { 66 | // d : 1 67 | // x : 2 68 | // } 69 | // y : 13 70 | // } 71 | // z: 8 72 | // 73 | // The result will not contain specific values for fields x,y and z 74 | // (their value will be set to the default, and omitted in proto text 75 | // output): 76 | // 77 | // 78 | // f { 79 | // a : 22 80 | // b { 81 | // d : 1 82 | // } 83 | // } 84 | // 85 | // A repeated field is not allowed except at the last position of a 86 | // paths string. 87 | // 88 | // If a FieldMask object is not present in a get operation, the 89 | // operation applies to all fields (as if a FieldMask of all fields 90 | // had been specified). 91 | // 92 | // Note that a field mask does not necessarily apply to the 93 | // top-level response message. In case of a REST get operation, the 94 | // field mask applies directly to the response, but in case of a REST 95 | // list operation, the mask instead applies to each individual message 96 | // in the returned resource list. In case of a REST custom method, 97 | // other definitions may be used. Where the mask applies will be 98 | // clearly documented together with its declaration in the API. In 99 | // any case, the effect on the returned resource/resources is required 100 | // behavior for APIs. 101 | // 102 | // # Field Masks in Update Operations 103 | // 104 | // A field mask in update operations specifies which fields of the 105 | // targeted resource are going to be updated. The API is required 106 | // to only change the values of the fields as specified in the mask 107 | // and leave the others untouched. If a resource is passed in to 108 | // describe the updated values, the API ignores the values of all 109 | // fields not covered by the mask. 110 | // 111 | // If a repeated field is specified for an update operation, new values will 112 | // be appended to the existing repeated field in the target resource. Note that 113 | // a repeated field is only allowed in the last position of a `paths` string. 114 | // 115 | // If a sub-message is specified in the last position of the field mask for an 116 | // update operation, then new value will be merged into the existing sub-message 117 | // in the target resource. 118 | // 119 | // For example, given the target message: 120 | // 121 | // f { 122 | // b { 123 | // d: 1 124 | // x: 2 125 | // } 126 | // c: [1] 127 | // } 128 | // 129 | // And an update message: 130 | // 131 | // f { 132 | // b { 133 | // d: 10 134 | // } 135 | // c: [2] 136 | // } 137 | // 138 | // then if the field mask is: 139 | // 140 | // paths: ["f.b", "f.c"] 141 | // 142 | // then the result will be: 143 | // 144 | // f { 145 | // b { 146 | // d: 10 147 | // x: 2 148 | // } 149 | // c: [1, 2] 150 | // } 151 | // 152 | // An implementation may provide options to override this default behavior for 153 | // repeated and message fields. 154 | // 155 | // In order to reset a field's value to the default, the field must 156 | // be in the mask and set to the default value in the provided resource. 157 | // Hence, in order to reset all fields of a resource, provide a default 158 | // instance of the resource and set all fields in the mask, or do 159 | // not provide a mask as described below. 160 | // 161 | // If a field mask is not present on update, the operation applies to 162 | // all fields (as if a field mask of all fields has been specified). 163 | // Note that in the presence of schema evolution, this may mean that 164 | // fields the client does not know and has therefore not filled into 165 | // the request will be reset to their default. If this is unwanted 166 | // behavior, a specific service may require a client to always specify 167 | // a field mask, producing an error if not. 168 | // 169 | // As with get operations, the location of the resource which 170 | // describes the updated values in the request message depends on the 171 | // operation kind. In any case, the effect of the field mask is 172 | // required to be honored by the API. 173 | // 174 | // ## Considerations for HTTP REST 175 | // 176 | // The HTTP kind of an update operation which uses a field mask must 177 | // be set to PATCH instead of PUT in order to satisfy HTTP semantics 178 | // (PUT must only be used for full updates). 179 | // 180 | // # JSON Encoding of Field Masks 181 | // 182 | // In JSON, a field mask is encoded as a single string where paths are 183 | // separated by a comma. Fields name in each path are converted 184 | // to/from lower-camel naming conventions. 185 | // 186 | // As an example, consider the following message declarations: 187 | // 188 | // message Profile { 189 | // User user = 1; 190 | // Photo photo = 2; 191 | // } 192 | // message User { 193 | // string display_name = 1; 194 | // string address = 2; 195 | // } 196 | // 197 | // In proto a field mask for `Profile` may look as such: 198 | // 199 | // mask { 200 | // paths: "user.display_name" 201 | // paths: "photo" 202 | // } 203 | // 204 | // In JSON, the same mask is represented as below: 205 | // 206 | // { 207 | // mask: "user.displayName,photo" 208 | // } 209 | // 210 | // # Field Masks and Oneof Fields 211 | // 212 | // Field masks treat fields in oneofs just as regular fields. Consider the 213 | // following message: 214 | // 215 | // message SampleMessage { 216 | // oneof test_oneof { 217 | // string name = 4; 218 | // SubMessage sub_message = 9; 219 | // } 220 | // } 221 | // 222 | // The field mask can be: 223 | // 224 | // mask { 225 | // paths: "name" 226 | // } 227 | // 228 | // Or: 229 | // 230 | // mask { 231 | // paths: "sub_message" 232 | // } 233 | // 234 | // Note that oneof type names ("test_oneof" in this case) cannot be used in 235 | // paths. 236 | // 237 | // ## Field Mask Verification 238 | // 239 | // The implementation of any API method which has a FieldMask type field in the 240 | // request should verify the included field paths, and return an 241 | // `INVALID_ARGUMENT` error if any path is unmappable. 242 | message FieldMask { 243 | // The set of field mask paths. 244 | repeated string paths = 1; 245 | } 246 | -------------------------------------------------------------------------------- /libs/google/protobuf/source_context.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 36 | option java_package = "com.google.protobuf"; 37 | option java_outer_classname = "SourceContextProto"; 38 | option java_multiple_files = true; 39 | option objc_class_prefix = "GPB"; 40 | option go_package = "google.golang.org/genproto/protobuf/source_context;source_context"; 41 | 42 | // `SourceContext` represents information about the source of a 43 | // protobuf element, like the file in which it is defined. 44 | message SourceContext { 45 | // The path-qualified name of the .proto file that contained the associated 46 | // protobuf element. For example: `"google/protobuf/source_context.proto"`. 47 | string file_name = 1; 48 | } 49 | -------------------------------------------------------------------------------- /libs/google/protobuf/struct.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 36 | option cc_enable_arenas = true; 37 | option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; 38 | option java_package = "com.google.protobuf"; 39 | option java_outer_classname = "StructProto"; 40 | option java_multiple_files = true; 41 | option objc_class_prefix = "GPB"; 42 | 43 | // `Struct` represents a structured data value, consisting of fields 44 | // which map to dynamically typed values. In some languages, `Struct` 45 | // might be supported by a native representation. For example, in 46 | // scripting languages like JS a struct is represented as an 47 | // object. The details of that representation are described together 48 | // with the proto support for the language. 49 | // 50 | // The JSON representation for `Struct` is JSON object. 51 | message Struct { 52 | // Unordered map of dynamically typed values. 53 | map fields = 1; 54 | } 55 | 56 | // `Value` represents a dynamically typed value which can be either 57 | // null, a number, a string, a boolean, a recursive struct value, or a 58 | // list of values. A producer of value is expected to set one of that 59 | // variants, absence of any variant indicates an error. 60 | // 61 | // The JSON representation for `Value` is JSON value. 62 | message Value { 63 | // The kind of value. 64 | oneof kind { 65 | // Represents a null value. 66 | NullValue null_value = 1; 67 | // Represents a double value. 68 | double number_value = 2; 69 | // Represents a string value. 70 | string string_value = 3; 71 | // Represents a boolean value. 72 | bool bool_value = 4; 73 | // Represents a structured value. 74 | Struct struct_value = 5; 75 | // Represents a repeated `Value`. 76 | ListValue list_value = 6; 77 | } 78 | } 79 | 80 | // `NullValue` is a singleton enumeration to represent the null value for the 81 | // `Value` type union. 82 | // 83 | // The JSON representation for `NullValue` is JSON `null`. 84 | enum NullValue { 85 | // Null value. 86 | NULL_VALUE = 0; 87 | } 88 | 89 | // `ListValue` is a wrapper around a repeated field of values. 90 | // 91 | // The JSON representation for `ListValue` is JSON array. 92 | message ListValue { 93 | // Repeated field of dynamically typed values. 94 | repeated Value values = 1; 95 | } 96 | -------------------------------------------------------------------------------- /libs/google/protobuf/timestamp.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 36 | option cc_enable_arenas = true; 37 | option go_package = "github.com/golang/protobuf/ptypes/timestamp"; 38 | option java_package = "com.google.protobuf"; 39 | option java_outer_classname = "TimestampProto"; 40 | option java_multiple_files = true; 41 | option objc_class_prefix = "GPB"; 42 | 43 | // A Timestamp represents a point in time independent of any time zone or local 44 | // calendar, encoded as a count of seconds and fractions of seconds at 45 | // nanosecond resolution. The count is relative to an epoch at UTC midnight on 46 | // January 1, 1970, in the proleptic Gregorian calendar which extends the 47 | // Gregorian calendar backwards to year one. 48 | // 49 | // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap 50 | // second table is needed for interpretation, using a [24-hour linear 51 | // smear](https://developers.google.com/time/smear). 52 | // 53 | // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By 54 | // restricting to that range, we ensure that we can convert to and from [RFC 55 | // 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. 56 | // 57 | // # Examples 58 | // 59 | // Example 1: Compute Timestamp from POSIX `time()`. 60 | // 61 | // Timestamp timestamp; 62 | // timestamp.set_seconds(time(NULL)); 63 | // timestamp.set_nanos(0); 64 | // 65 | // Example 2: Compute Timestamp from POSIX `gettimeofday()`. 66 | // 67 | // struct timeval tv; 68 | // gettimeofday(&tv, NULL); 69 | // 70 | // Timestamp timestamp; 71 | // timestamp.set_seconds(tv.tv_sec); 72 | // timestamp.set_nanos(tv.tv_usec * 1000); 73 | // 74 | // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. 75 | // 76 | // FILETIME ft; 77 | // GetSystemTimeAsFileTime(&ft); 78 | // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; 79 | // 80 | // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z 81 | // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. 82 | // Timestamp timestamp; 83 | // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); 84 | // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); 85 | // 86 | // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. 87 | // 88 | // long millis = System.currentTimeMillis(); 89 | // 90 | // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) 91 | // .setNanos((int) ((millis % 1000) * 1000000)).build(); 92 | // 93 | // 94 | // Example 5: Compute Timestamp from current time in Python. 95 | // 96 | // timestamp = Timestamp() 97 | // timestamp.GetCurrentTime() 98 | // 99 | // # JSON Mapping 100 | // 101 | // In JSON format, the Timestamp type is encoded as a string in the 102 | // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the 103 | // format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" 104 | // where {year} is always expressed using four digits while {month}, {day}, 105 | // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional 106 | // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), 107 | // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone 108 | // is required. A proto3 JSON serializer should always use UTC (as indicated by 109 | // "Z") when printing the Timestamp type and a proto3 JSON parser should be 110 | // able to accept both UTC and other timezones (as indicated by an offset). 111 | // 112 | // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 113 | // 01:30 UTC on January 15, 2017. 114 | // 115 | // In JavaScript, one can convert a Date object to this format using the 116 | // standard 117 | // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) 118 | // method. In Python, a standard `datetime.datetime` object can be converted 119 | // to this format using 120 | // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with 121 | // the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use 122 | // the Joda Time's [`ISODateTimeFormat.dateTime()`]( 123 | // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D 124 | // ) to obtain a formatter capable of generating timestamps in this format. 125 | // 126 | // 127 | message Timestamp { 128 | // Represents seconds of UTC time since Unix epoch 129 | // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 130 | // 9999-12-31T23:59:59Z inclusive. 131 | int64 seconds = 1; 132 | 133 | // Non-negative fractions of a second at nanosecond resolution. Negative 134 | // second values with fractions must still have non-negative nanos values 135 | // that count forward in time. Must be from 0 to 999,999,999 136 | // inclusive. 137 | int32 nanos = 2; 138 | } 139 | -------------------------------------------------------------------------------- /libs/google/protobuf/type.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package google.protobuf; 34 | 35 | import "google/protobuf/any.proto"; 36 | import "google/protobuf/source_context.proto"; 37 | 38 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 39 | option cc_enable_arenas = true; 40 | option java_package = "com.google.protobuf"; 41 | option java_outer_classname = "TypeProto"; 42 | option java_multiple_files = true; 43 | option objc_class_prefix = "GPB"; 44 | option go_package = "google.golang.org/genproto/protobuf/ptype;ptype"; 45 | 46 | // A protocol buffer message type. 47 | message Type { 48 | // The fully qualified message name. 49 | string name = 1; 50 | // The list of fields. 51 | repeated Field fields = 2; 52 | // The list of types appearing in `oneof` definitions in this type. 53 | repeated string oneofs = 3; 54 | // The protocol buffer options. 55 | repeated Option options = 4; 56 | // The source context. 57 | SourceContext source_context = 5; 58 | // The source syntax. 59 | Syntax syntax = 6; 60 | } 61 | 62 | // A single field of a message type. 63 | message Field { 64 | // Basic field types. 65 | enum Kind { 66 | // Field type unknown. 67 | TYPE_UNKNOWN = 0; 68 | // Field type double. 69 | TYPE_DOUBLE = 1; 70 | // Field type float. 71 | TYPE_FLOAT = 2; 72 | // Field type int64. 73 | TYPE_INT64 = 3; 74 | // Field type uint64. 75 | TYPE_UINT64 = 4; 76 | // Field type int32. 77 | TYPE_INT32 = 5; 78 | // Field type fixed64. 79 | TYPE_FIXED64 = 6; 80 | // Field type fixed32. 81 | TYPE_FIXED32 = 7; 82 | // Field type bool. 83 | TYPE_BOOL = 8; 84 | // Field type string. 85 | TYPE_STRING = 9; 86 | // Field type group. Proto2 syntax only, and deprecated. 87 | TYPE_GROUP = 10; 88 | // Field type message. 89 | TYPE_MESSAGE = 11; 90 | // Field type bytes. 91 | TYPE_BYTES = 12; 92 | // Field type uint32. 93 | TYPE_UINT32 = 13; 94 | // Field type enum. 95 | TYPE_ENUM = 14; 96 | // Field type sfixed32. 97 | TYPE_SFIXED32 = 15; 98 | // Field type sfixed64. 99 | TYPE_SFIXED64 = 16; 100 | // Field type sint32. 101 | TYPE_SINT32 = 17; 102 | // Field type sint64. 103 | TYPE_SINT64 = 18; 104 | } 105 | 106 | // Whether a field is optional, required, or repeated. 107 | enum Cardinality { 108 | // For fields with unknown cardinality. 109 | CARDINALITY_UNKNOWN = 0; 110 | // For optional fields. 111 | CARDINALITY_OPTIONAL = 1; 112 | // For required fields. Proto2 syntax only. 113 | CARDINALITY_REQUIRED = 2; 114 | // For repeated fields. 115 | CARDINALITY_REPEATED = 3; 116 | }; 117 | 118 | // The field type. 119 | Kind kind = 1; 120 | // The field cardinality. 121 | Cardinality cardinality = 2; 122 | // The field number. 123 | int32 number = 3; 124 | // The field name. 125 | string name = 4; 126 | // The field type URL, without the scheme, for message or enumeration 127 | // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. 128 | string type_url = 6; 129 | // The index of the field type in `Type.oneofs`, for message or enumeration 130 | // types. The first type has index 1; zero means the type is not in the list. 131 | int32 oneof_index = 7; 132 | // Whether to use alternative packed wire representation. 133 | bool packed = 8; 134 | // The protocol buffer options. 135 | repeated Option options = 9; 136 | // The field JSON name. 137 | string json_name = 10; 138 | // The string value of the default value of this field. Proto2 syntax only. 139 | string default_value = 11; 140 | } 141 | 142 | // Enum type definition. 143 | message Enum { 144 | // Enum type name. 145 | string name = 1; 146 | // Enum value definitions. 147 | repeated EnumValue enumvalue = 2; 148 | // Protocol buffer options. 149 | repeated Option options = 3; 150 | // The source context. 151 | SourceContext source_context = 4; 152 | // The source syntax. 153 | Syntax syntax = 5; 154 | } 155 | 156 | // Enum value definition. 157 | message EnumValue { 158 | // Enum value name. 159 | string name = 1; 160 | // Enum value number. 161 | int32 number = 2; 162 | // Protocol buffer options. 163 | repeated Option options = 3; 164 | } 165 | 166 | // A protocol buffer option, which can be attached to a message, field, 167 | // enumeration, etc. 168 | message Option { 169 | // The option's name. For protobuf built-in options (options defined in 170 | // descriptor.proto), this is the short name. For example, `"map_entry"`. 171 | // For custom options, it should be the fully-qualified name. For example, 172 | // `"google.api.http"`. 173 | string name = 1; 174 | // The option's value packed in an Any message. If the value is a primitive, 175 | // the corresponding wrapper type defined in google/protobuf/wrappers.proto 176 | // should be used. If the value is an enum, it should be stored as an int32 177 | // value using the google.protobuf.Int32Value type. 178 | Any value = 2; 179 | } 180 | 181 | // The syntax in which a protocol buffer element is defined. 182 | enum Syntax { 183 | // Syntax `proto2`. 184 | SYNTAX_PROTO2 = 0; 185 | // Syntax `proto3`. 186 | SYNTAX_PROTO3 = 1; 187 | } 188 | -------------------------------------------------------------------------------- /libs/google/protobuf/wrappers.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Wrappers for primitive (non-message) types. These types are useful 32 | // for embedding primitives in the `google.protobuf.Any` type and for places 33 | // where we need to distinguish between the absence of a primitive 34 | // typed field and its default value. 35 | // 36 | // These wrappers have no meaningful use within repeated fields as they lack 37 | // the ability to detect presence on individual elements. 38 | // These wrappers have no meaningful use within a map or a oneof since 39 | // individual entries of a map or fields of a oneof can already detect presence. 40 | 41 | syntax = "proto3"; 42 | 43 | package google.protobuf; 44 | 45 | option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 46 | option cc_enable_arenas = true; 47 | option go_package = "github.com/golang/protobuf/ptypes/wrappers"; 48 | option java_package = "com.google.protobuf"; 49 | option java_outer_classname = "WrappersProto"; 50 | option java_multiple_files = true; 51 | option objc_class_prefix = "GPB"; 52 | 53 | // Wrapper message for `double`. 54 | // 55 | // The JSON representation for `DoubleValue` is JSON number. 56 | message DoubleValue { 57 | // The double value. 58 | double value = 1; 59 | } 60 | 61 | // Wrapper message for `float`. 62 | // 63 | // The JSON representation for `FloatValue` is JSON number. 64 | message FloatValue { 65 | // The float value. 66 | float value = 1; 67 | } 68 | 69 | // Wrapper message for `int64`. 70 | // 71 | // The JSON representation for `Int64Value` is JSON string. 72 | message Int64Value { 73 | // The int64 value. 74 | int64 value = 1; 75 | } 76 | 77 | // Wrapper message for `uint64`. 78 | // 79 | // The JSON representation for `UInt64Value` is JSON string. 80 | message UInt64Value { 81 | // The uint64 value. 82 | uint64 value = 1; 83 | } 84 | 85 | // Wrapper message for `int32`. 86 | // 87 | // The JSON representation for `Int32Value` is JSON number. 88 | message Int32Value { 89 | // The int32 value. 90 | int32 value = 1; 91 | } 92 | 93 | // Wrapper message for `uint32`. 94 | // 95 | // The JSON representation for `UInt32Value` is JSON number. 96 | message UInt32Value { 97 | // The uint32 value. 98 | uint32 value = 1; 99 | } 100 | 101 | // Wrapper message for `bool`. 102 | // 103 | // The JSON representation for `BoolValue` is JSON `true` and `false`. 104 | message BoolValue { 105 | // The bool value. 106 | bool value = 1; 107 | } 108 | 109 | // Wrapper message for `string`. 110 | // 111 | // The JSON representation for `StringValue` is JSON string. 112 | message StringValue { 113 | // The string value. 114 | string value = 1; 115 | } 116 | 117 | // Wrapper message for `bytes`. 118 | // 119 | // The JSON representation for `BytesValue` is JSON string. 120 | message BytesValue { 121 | // The bytes value. 122 | bytes value = 1; 123 | } 124 | -------------------------------------------------------------------------------- /libs/google/rpc/code.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package google.rpc; 18 | 19 | option go_package = "google.golang.org/genproto/googleapis/rpc/code;code"; 20 | option java_multiple_files = true; 21 | option java_outer_classname = "CodeProto"; 22 | option java_package = "com.google.rpc"; 23 | option objc_class_prefix = "RPC"; 24 | 25 | 26 | // The canonical error codes for Google APIs. 27 | // 28 | // 29 | // Sometimes multiple error codes may apply. Services should return 30 | // the most specific error code that applies. For example, prefer 31 | // `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. 32 | // Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. 33 | enum Code { 34 | // Not an error; returned on success 35 | // 36 | // HTTP Mapping: 200 OK 37 | OK = 0; 38 | 39 | // The operation was cancelled, typically by the caller. 40 | // 41 | // HTTP Mapping: 499 Client Closed Request 42 | CANCELLED = 1; 43 | 44 | // Unknown error. For example, this error may be returned when 45 | // a `Status` value received from another address space belongs to 46 | // an error space that is not known in this address space. Also 47 | // errors raised by APIs that do not return enough error information 48 | // may be converted to this error. 49 | // 50 | // HTTP Mapping: 500 Internal Server Error 51 | UNKNOWN = 2; 52 | 53 | // The client specified an invalid argument. Note that this differs 54 | // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments 55 | // that are problematic regardless of the state of the system 56 | // (e.g., a malformed file name). 57 | // 58 | // HTTP Mapping: 400 Bad Request 59 | INVALID_ARGUMENT = 3; 60 | 61 | // The deadline expired before the operation could complete. For operations 62 | // that change the state of the system, this error may be returned 63 | // even if the operation has completed successfully. For example, a 64 | // successful response from a server could have been delayed long 65 | // enough for the deadline to expire. 66 | // 67 | // HTTP Mapping: 504 Gateway Timeout 68 | DEADLINE_EXCEEDED = 4; 69 | 70 | // Some requested entity (e.g., file or directory) was not found. 71 | // 72 | // Note to server developers: if a request is denied for an entire class 73 | // of users, such as gradual feature rollout or undocumented whitelist, 74 | // `NOT_FOUND` may be used. If a request is denied for some users within 75 | // a class of users, such as user-based access control, `PERMISSION_DENIED` 76 | // must be used. 77 | // 78 | // HTTP Mapping: 404 Not Found 79 | NOT_FOUND = 5; 80 | 81 | // The entity that a client attempted to create (e.g., file or directory) 82 | // already exists. 83 | // 84 | // HTTP Mapping: 409 Conflict 85 | ALREADY_EXISTS = 6; 86 | 87 | // The caller does not have permission to execute the specified 88 | // operation. `PERMISSION_DENIED` must not be used for rejections 89 | // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` 90 | // instead for those errors). `PERMISSION_DENIED` must not be 91 | // used if the caller can not be identified (use `UNAUTHENTICATED` 92 | // instead for those errors). This error code does not imply the 93 | // request is valid or the requested entity exists or satisfies 94 | // other pre-conditions. 95 | // 96 | // HTTP Mapping: 403 Forbidden 97 | PERMISSION_DENIED = 7; 98 | 99 | // The request does not have valid authentication credentials for the 100 | // operation. 101 | // 102 | // HTTP Mapping: 401 Unauthorized 103 | UNAUTHENTICATED = 16; 104 | 105 | // Some resource has been exhausted, perhaps a per-user quota, or 106 | // perhaps the entire file system is out of space. 107 | // 108 | // HTTP Mapping: 429 Too Many Requests 109 | RESOURCE_EXHAUSTED = 8; 110 | 111 | // The operation was rejected because the system is not in a state 112 | // required for the operation's execution. For example, the directory 113 | // to be deleted is non-empty, an rmdir operation is applied to 114 | // a non-directory, etc. 115 | // 116 | // Service implementors can use the following guidelines to decide 117 | // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: 118 | // (a) Use `UNAVAILABLE` if the client can retry just the failing call. 119 | // (b) Use `ABORTED` if the client should retry at a higher level 120 | // (e.g., when a client-specified test-and-set fails, indicating the 121 | // client should restart a read-modify-write sequence). 122 | // (c) Use `FAILED_PRECONDITION` if the client should not retry until 123 | // the system state has been explicitly fixed. E.g., if an "rmdir" 124 | // fails because the directory is non-empty, `FAILED_PRECONDITION` 125 | // should be returned since the client should not retry unless 126 | // the files are deleted from the directory. 127 | // 128 | // HTTP Mapping: 400 Bad Request 129 | FAILED_PRECONDITION = 9; 130 | 131 | // The operation was aborted, typically due to a concurrency issue such as 132 | // a sequencer check failure or transaction abort. 133 | // 134 | // See the guidelines above for deciding between `FAILED_PRECONDITION`, 135 | // `ABORTED`, and `UNAVAILABLE`. 136 | // 137 | // HTTP Mapping: 409 Conflict 138 | ABORTED = 10; 139 | 140 | // The operation was attempted past the valid range. E.g., seeking or 141 | // reading past end-of-file. 142 | // 143 | // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may 144 | // be fixed if the system state changes. For example, a 32-bit file 145 | // system will generate `INVALID_ARGUMENT` if asked to read at an 146 | // offset that is not in the range [0,2^32-1], but it will generate 147 | // `OUT_OF_RANGE` if asked to read from an offset past the current 148 | // file size. 149 | // 150 | // There is a fair bit of overlap between `FAILED_PRECONDITION` and 151 | // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific 152 | // error) when it applies so that callers who are iterating through 153 | // a space can easily look for an `OUT_OF_RANGE` error to detect when 154 | // they are done. 155 | // 156 | // HTTP Mapping: 400 Bad Request 157 | OUT_OF_RANGE = 11; 158 | 159 | // The operation is not implemented or is not supported/enabled in this 160 | // service. 161 | // 162 | // HTTP Mapping: 501 Not Implemented 163 | UNIMPLEMENTED = 12; 164 | 165 | // Internal errors. This means that some invariants expected by the 166 | // underlying system have been broken. This error code is reserved 167 | // for serious errors. 168 | // 169 | // HTTP Mapping: 500 Internal Server Error 170 | INTERNAL = 13; 171 | 172 | // The service is currently unavailable. This is most likely a 173 | // transient condition, which can be corrected by retrying with 174 | // a backoff. 175 | // 176 | // See the guidelines above for deciding between `FAILED_PRECONDITION`, 177 | // `ABORTED`, and `UNAVAILABLE`. 178 | // 179 | // HTTP Mapping: 503 Service Unavailable 180 | UNAVAILABLE = 14; 181 | 182 | // Unrecoverable data loss or corruption. 183 | // 184 | // HTTP Mapping: 500 Internal Server Error 185 | DATA_LOSS = 15; 186 | } 187 | -------------------------------------------------------------------------------- /libs/google/rpc/error_details.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package google.rpc; 18 | 19 | import "google/protobuf/duration.proto"; 20 | 21 | option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails"; 22 | option java_multiple_files = true; 23 | option java_outer_classname = "ErrorDetailsProto"; 24 | option java_package = "com.google.rpc"; 25 | option objc_class_prefix = "RPC"; 26 | 27 | 28 | // Describes when the clients can retry a failed request. Clients could ignore 29 | // the recommendation here or retry when this information is missing from error 30 | // responses. 31 | // 32 | // It's always recommended that clients should use exponential backoff when 33 | // retrying. 34 | // 35 | // Clients should wait until `retry_delay` amount of time has passed since 36 | // receiving the error response before retrying. If retrying requests also 37 | // fail, clients should use an exponential backoff scheme to gradually increase 38 | // the delay between retries based on `retry_delay`, until either a maximum 39 | // number of retires have been reached or a maximum retry delay cap has been 40 | // reached. 41 | message RetryInfo { 42 | // Clients should wait at least this long between retrying the same request. 43 | google.protobuf.Duration retry_delay = 1; 44 | } 45 | 46 | // Describes additional debugging info. 47 | message DebugInfo { 48 | // The stack trace entries indicating where the error occurred. 49 | repeated string stack_entries = 1; 50 | 51 | // Additional debugging information provided by the server. 52 | string detail = 2; 53 | } 54 | 55 | // Describes how a quota check failed. 56 | // 57 | // For example if a daily limit was exceeded for the calling project, 58 | // a service could respond with a QuotaFailure detail containing the project 59 | // id and the description of the quota limit that was exceeded. If the 60 | // calling project hasn't enabled the service in the developer console, then 61 | // a service could respond with the project id and set `service_disabled` 62 | // to true. 63 | // 64 | // Also see RetryDetail and Help types for other details about handling a 65 | // quota failure. 66 | message QuotaFailure { 67 | // A message type used to describe a single quota violation. For example, a 68 | // daily quota or a custom quota that was exceeded. 69 | message Violation { 70 | // The subject on which the quota check failed. 71 | // For example, "clientip:" or "project:". 73 | string subject = 1; 74 | 75 | // A description of how the quota check failed. Clients can use this 76 | // description to find more about the quota configuration in the service's 77 | // public documentation, or find the relevant quota limit to adjust through 78 | // developer console. 79 | // 80 | // For example: "Service disabled" or "Daily Limit for read operations 81 | // exceeded". 82 | string description = 2; 83 | } 84 | 85 | // Describes all quota violations. 86 | repeated Violation violations = 1; 87 | } 88 | 89 | // Describes what preconditions have failed. 90 | // 91 | // For example, if an RPC failed because it required the Terms of Service to be 92 | // acknowledged, it could list the terms of service violation in the 93 | // PreconditionFailure message. 94 | message PreconditionFailure { 95 | // A message type used to describe a single precondition failure. 96 | message Violation { 97 | // The type of PreconditionFailure. We recommend using a service-specific 98 | // enum type to define the supported precondition violation types. For 99 | // example, "TOS" for "Terms of Service violation". 100 | string type = 1; 101 | 102 | // The subject, relative to the type, that failed. 103 | // For example, "google.com/cloud" relative to the "TOS" type would 104 | // indicate which terms of service is being referenced. 105 | string subject = 2; 106 | 107 | // A description of how the precondition failed. Developers can use this 108 | // description to understand how to fix the failure. 109 | // 110 | // For example: "Terms of service not accepted". 111 | string description = 3; 112 | } 113 | 114 | // Describes all precondition violations. 115 | repeated Violation violations = 1; 116 | } 117 | 118 | // Describes violations in a client request. This error type focuses on the 119 | // syntactic aspects of the request. 120 | message BadRequest { 121 | // A message type used to describe a single bad request field. 122 | message FieldViolation { 123 | // A path leading to a field in the request body. The value will be a 124 | // sequence of dot-separated identifiers that identify a protocol buffer 125 | // field. E.g., "field_violations.field" would identify this field. 126 | string field = 1; 127 | 128 | // A description of why the request element is bad. 129 | string description = 2; 130 | } 131 | 132 | // Describes all violations in a client request. 133 | repeated FieldViolation field_violations = 1; 134 | } 135 | 136 | // Contains metadata about the request that clients can attach when filing a bug 137 | // or providing other forms of feedback. 138 | message RequestInfo { 139 | // An opaque string that should only be interpreted by the service generating 140 | // it. For example, it can be used to identify requests in the service's logs. 141 | string request_id = 1; 142 | 143 | // Any data that was used to serve this request. For example, an encrypted 144 | // stack trace that can be sent back to the service provider for debugging. 145 | string serving_data = 2; 146 | } 147 | 148 | // Describes the resource that is being accessed. 149 | message ResourceInfo { 150 | // A name for the type of resource being accessed, e.g. "sql table", 151 | // "cloud storage bucket", "file", "Google calendar"; or the type URL 152 | // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". 153 | string resource_type = 1; 154 | 155 | // The name of the resource being accessed. For example, a shared calendar 156 | // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current 157 | // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. 158 | string resource_name = 2; 159 | 160 | // The owner of the resource (optional). 161 | // For example, "user:" or "project:". 163 | string owner = 3; 164 | 165 | // Describes what error is encountered when accessing this resource. 166 | // For example, updating a cloud project may require the `writer` permission 167 | // on the developer console project. 168 | string description = 4; 169 | } 170 | 171 | // Provides links to documentation or for performing an out of band action. 172 | // 173 | // For example, if a quota check failed with an error indicating the calling 174 | // project hasn't enabled the accessed service, this can contain a URL pointing 175 | // directly to the right place in the developer console to flip the bit. 176 | message Help { 177 | // Describes a URL link. 178 | message Link { 179 | // Describes what the link offers. 180 | string description = 1; 181 | 182 | // The URL of the link. 183 | string url = 2; 184 | } 185 | 186 | // URL(s) pointing to additional information on handling the current error. 187 | repeated Link links = 1; 188 | } 189 | 190 | // Provides a localized error message that is safe to return to the user 191 | // which can be attached to an RPC error. 192 | message LocalizedMessage { 193 | // The locale used following the specification defined at 194 | // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. 195 | // Examples are: "en-US", "fr-CH", "es-MX" 196 | string locale = 1; 197 | 198 | // The localized error message in the above locale. 199 | string message = 2; 200 | } 201 | -------------------------------------------------------------------------------- /libs/google/rpc/status.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package google.rpc; 18 | 19 | import "google/protobuf/any.proto"; 20 | 21 | option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; 22 | option java_multiple_files = true; 23 | option java_outer_classname = "StatusProto"; 24 | option java_package = "com.google.rpc"; 25 | option objc_class_prefix = "RPC"; 26 | 27 | 28 | // The `Status` type defines a logical error model that is suitable for different 29 | // programming environments, including REST APIs and RPC APIs. It is used by 30 | // [gRPC](https://github.com/grpc). The error model is designed to be: 31 | // 32 | // - Simple to use and understand for most users 33 | // - Flexible enough to meet unexpected needs 34 | // 35 | // # Overview 36 | // 37 | // The `Status` message contains three pieces of data: error code, error message, 38 | // and error details. The error code should be an enum value of 39 | // [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The 40 | // error message should be a developer-facing English message that helps 41 | // developers *understand* and *resolve* the error. If a localized user-facing 42 | // error message is needed, put the localized message in the error details or 43 | // localize it in the client. The optional error details may contain arbitrary 44 | // information about the error. There is a predefined set of error detail types 45 | // in the package `google.rpc` that can be used for common error conditions. 46 | // 47 | // # Language mapping 48 | // 49 | // The `Status` message is the logical representation of the error model, but it 50 | // is not necessarily the actual wire format. When the `Status` message is 51 | // exposed in different client libraries and different wire protocols, it can be 52 | // mapped differently. For example, it will likely be mapped to some exceptions 53 | // in Java, but more likely mapped to some error codes in C. 54 | // 55 | // # Other uses 56 | // 57 | // The error model and the `Status` message can be used in a variety of 58 | // environments, either with or without APIs, to provide a 59 | // consistent developer experience across different environments. 60 | // 61 | // Example uses of this error model include: 62 | // 63 | // - Partial errors. If a service needs to return partial errors to the client, 64 | // it may embed the `Status` in the normal response to indicate the partial 65 | // errors. 66 | // 67 | // - Workflow errors. A typical workflow has multiple steps. Each step may 68 | // have a `Status` message for error reporting. 69 | // 70 | // - Batch operations. If a client uses batch request and batch response, the 71 | // `Status` message should be used directly inside batch response, one for 72 | // each error sub-response. 73 | // 74 | // - Asynchronous operations. If an API call embeds asynchronous operation 75 | // results in its response, the status of those operations should be 76 | // represented directly using the `Status` message. 77 | // 78 | // - Logging. If some API errors are stored in logs, the message `Status` could 79 | // be used directly after any stripping needed for security/privacy reasons. 80 | message Status { 81 | // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. 82 | int32 code = 1; 83 | 84 | // A developer-facing error message, which should be in English. Any 85 | // user-facing error message should be localized and sent in the 86 | // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. 87 | string message = 2; 88 | 89 | // A list of messages that carry the error details. There is a common set of 90 | // message types for APIs to use. 91 | repeated google.protobuf.Any details = 3; 92 | } 93 | -------------------------------------------------------------------------------- /libs/protoc-gen-openapiv2/options/annotations.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package grpc.gateway.protoc_gen_openapiv2.options; 4 | 5 | option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; 6 | 7 | import "google/protobuf/descriptor.proto"; 8 | import "protoc-gen-openapiv2/options/openapiv2.proto"; 9 | 10 | extend google.protobuf.FileOptions { 11 | // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. 12 | // 13 | // All IDs are the same, as assigned. It is okay that they are the same, as they extend 14 | // different descriptor messages. 15 | Swagger openapiv2_swagger = 1042; 16 | } 17 | extend google.protobuf.MethodOptions { 18 | // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. 19 | // 20 | // All IDs are the same, as assigned. It is okay that they are the same, as they extend 21 | // different descriptor messages. 22 | Operation openapiv2_operation = 1042; 23 | } 24 | extend google.protobuf.MessageOptions { 25 | // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. 26 | // 27 | // All IDs are the same, as assigned. It is okay that they are the same, as they extend 28 | // different descriptor messages. 29 | Schema openapiv2_schema = 1042; 30 | } 31 | extend google.protobuf.ServiceOptions { 32 | // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. 33 | // 34 | // All IDs are the same, as assigned. It is okay that they are the same, as they extend 35 | // different descriptor messages. 36 | Tag openapiv2_tag = 1042; 37 | } 38 | extend google.protobuf.FieldOptions { 39 | // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. 40 | // 41 | // All IDs are the same, as assigned. It is okay that they are the same, as they extend 42 | // different descriptor messages. 43 | JSONSchema openapiv2_field = 1042; 44 | } 45 | -------------------------------------------------------------------------------- /libs/protoc-gen-openapiv2/options/openapiv2.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package grpc.gateway.protoc_gen_openapiv2.options; 4 | 5 | option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; 6 | 7 | import "google/protobuf/struct.proto"; 8 | 9 | // Scheme describes the schemes supported by the OpenAPI Swagger 10 | // and Operation objects. 11 | enum Scheme { 12 | UNKNOWN = 0; 13 | HTTP = 1; 14 | HTTPS = 2; 15 | WS = 3; 16 | WSS = 4; 17 | } 18 | 19 | // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. 20 | // 21 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject 22 | // 23 | // Example: 24 | // 25 | // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { 26 | // info: { 27 | // title: "Echo API"; 28 | // version: "1.0"; 29 | // description: "; 30 | // contact: { 31 | // name: "gRPC-Gateway project"; 32 | // url: "https://github.com/grpc-ecosystem/grpc-gateway"; 33 | // email: "none@example.com"; 34 | // }; 35 | // license: { 36 | // name: "BSD 3-Clause License"; 37 | // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt"; 38 | // }; 39 | // }; 40 | // schemes: HTTPS; 41 | // consumes: "application/json"; 42 | // produces: "application/json"; 43 | // }; 44 | // 45 | message Swagger { 46 | // Specifies the OpenAPI Specification version being used. It can be 47 | // used by the OpenAPI UI and other clients to interpret the API listing. The 48 | // value MUST be "2.0". 49 | string swagger = 1; 50 | // Provides metadata about the API. The metadata can be used by the 51 | // clients if needed. 52 | Info info = 2; 53 | // The host (name or ip) serving the API. This MUST be the host only and does 54 | // not include the scheme nor sub-paths. It MAY include a port. If the host is 55 | // not included, the host serving the documentation is to be used (including 56 | // the port). The host does not support path templating. 57 | string host = 3; 58 | // The base path on which the API is served, which is relative to the host. If 59 | // it is not included, the API is served directly under the host. The value 60 | // MUST start with a leading slash (/). The basePath does not support path 61 | // templating. 62 | // Note that using `base_path` does not change the endpoint paths that are 63 | // generated in the resulting OpenAPI file. If you wish to use `base_path` 64 | // with relatively generated OpenAPI paths, the `base_path` prefix must be 65 | // manually removed from your `google.api.http` paths and your code changed to 66 | // serve the API from the `base_path`. 67 | string base_path = 4; 68 | // The transfer protocol of the API. Values MUST be from the list: "http", 69 | // "https", "ws", "wss". If the schemes is not included, the default scheme to 70 | // be used is the one used to access the OpenAPI definition itself. 71 | repeated Scheme schemes = 5; 72 | // A list of MIME types the APIs can consume. This is global to all APIs but 73 | // can be overridden on specific API calls. Value MUST be as described under 74 | // Mime Types. 75 | repeated string consumes = 6; 76 | // A list of MIME types the APIs can produce. This is global to all APIs but 77 | // can be overridden on specific API calls. Value MUST be as described under 78 | // Mime Types. 79 | repeated string produces = 7; 80 | // field 8 is reserved for 'paths'. 81 | reserved 8; 82 | // field 9 is reserved for 'definitions', which at this time are already 83 | // exposed as and customizable as proto messages. 84 | reserved 9; 85 | // An object to hold responses that can be used across operations. This 86 | // property does not define global responses for all operations. 87 | map responses = 10; 88 | // Security scheme definitions that can be used across the specification. 89 | SecurityDefinitions security_definitions = 11; 90 | // A declaration of which security schemes are applied for the API as a whole. 91 | // The list of values describes alternative security schemes that can be used 92 | // (that is, there is a logical OR between the security requirements). 93 | // Individual operations can override this definition. 94 | repeated SecurityRequirement security = 12; 95 | // field 13 is reserved for 'tags', which are supposed to be exposed as and 96 | // customizable as proto services. TODO(ivucica): add processing of proto 97 | // service objects into OpenAPI v2 Tag objects. 98 | reserved 13; 99 | // Additional external documentation. 100 | ExternalDocumentation external_docs = 14; 101 | map extensions = 15; 102 | } 103 | 104 | // `Operation` is a representation of OpenAPI v2 specification's Operation object. 105 | // 106 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject 107 | // 108 | // Example: 109 | // 110 | // service EchoService { 111 | // rpc Echo(SimpleMessage) returns (SimpleMessage) { 112 | // option (google.api.http) = { 113 | // get: "/v1/example/echo/{id}" 114 | // }; 115 | // 116 | // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { 117 | // summary: "Get a message."; 118 | // operation_id: "getMessage"; 119 | // tags: "echo"; 120 | // responses: { 121 | // key: "200" 122 | // value: { 123 | // description: "OK"; 124 | // } 125 | // } 126 | // }; 127 | // } 128 | // } 129 | message Operation { 130 | // A list of tags for API documentation control. Tags can be used for logical 131 | // grouping of operations by resources or any other qualifier. 132 | repeated string tags = 1; 133 | // A short summary of what the operation does. For maximum readability in the 134 | // swagger-ui, this field SHOULD be less than 120 characters. 135 | string summary = 2; 136 | // A verbose explanation of the operation behavior. GFM syntax can be used for 137 | // rich text representation. 138 | string description = 3; 139 | // Additional external documentation for this operation. 140 | ExternalDocumentation external_docs = 4; 141 | // Unique string used to identify the operation. The id MUST be unique among 142 | // all operations described in the API. Tools and libraries MAY use the 143 | // operationId to uniquely identify an operation, therefore, it is recommended 144 | // to follow common programming naming conventions. 145 | string operation_id = 5; 146 | // A list of MIME types the operation can consume. This overrides the consumes 147 | // definition at the OpenAPI Object. An empty value MAY be used to clear the 148 | // global definition. Value MUST be as described under Mime Types. 149 | repeated string consumes = 6; 150 | // A list of MIME types the operation can produce. This overrides the produces 151 | // definition at the OpenAPI Object. An empty value MAY be used to clear the 152 | // global definition. Value MUST be as described under Mime Types. 153 | repeated string produces = 7; 154 | // field 8 is reserved for 'parameters'. 155 | reserved 8; 156 | // The list of possible responses as they are returned from executing this 157 | // operation. 158 | map responses = 9; 159 | // The transfer protocol for the operation. Values MUST be from the list: 160 | // "http", "https", "ws", "wss". The value overrides the OpenAPI Object 161 | // schemes definition. 162 | repeated Scheme schemes = 10; 163 | // Declares this operation to be deprecated. Usage of the declared operation 164 | // should be refrained. Default value is false. 165 | bool deprecated = 11; 166 | // A declaration of which security schemes are applied for this operation. The 167 | // list of values describes alternative security schemes that can be used 168 | // (that is, there is a logical OR between the security requirements). This 169 | // definition overrides any declared top-level security. To remove a top-level 170 | // security declaration, an empty array can be used. 171 | repeated SecurityRequirement security = 12; 172 | map extensions = 13; 173 | } 174 | 175 | // `Header` is a representation of OpenAPI v2 specification's Header object. 176 | // 177 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject 178 | // 179 | message Header { 180 | // `Description` is a short description of the header. 181 | string description = 1; 182 | // The type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported. 183 | string type = 2; 184 | // `Format` The extending format for the previously mentioned type. 185 | string format = 3; 186 | // field 4 is reserved for 'items', but in OpenAPI-specific way. 187 | reserved 4; 188 | // field 5 is reserved `Collection Format` Determines the format of the array if type array is used. 189 | reserved 5; 190 | // `Default` Declares the value of the header that the server will use if none is provided. 191 | // See: https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. 192 | // Unlike JSON Schema this value MUST conform to the defined type for the header. 193 | string default = 6; 194 | // field 7 is reserved for 'maximum'. 195 | reserved 7; 196 | // field 8 is reserved for 'exclusiveMaximum'. 197 | reserved 8; 198 | // field 9 is reserved for 'minimum'. 199 | reserved 9; 200 | // field 10 is reserved for 'exclusiveMinimum'. 201 | reserved 10; 202 | // field 11 is reserved for 'maxLength'. 203 | reserved 11; 204 | // field 12 is reserved for 'minLength'. 205 | reserved 12; 206 | // 'Pattern' See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. 207 | string pattern = 13; 208 | // field 14 is reserved for 'maxItems'. 209 | reserved 14; 210 | // field 15 is reserved for 'minItems'. 211 | reserved 15; 212 | // field 16 is reserved for 'uniqueItems'. 213 | reserved 16; 214 | // field 17 is reserved for 'enum'. 215 | reserved 17; 216 | // field 18 is reserved for 'multipleOf'. 217 | reserved 18; 218 | } 219 | 220 | // `Response` is a representation of OpenAPI v2 specification's Response object. 221 | // 222 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject 223 | // 224 | message Response { 225 | // `Description` is a short description of the response. 226 | // GFM syntax can be used for rich text representation. 227 | string description = 1; 228 | // `Schema` optionally defines the structure of the response. 229 | // If `Schema` is not provided, it means there is no content to the response. 230 | Schema schema = 2; 231 | // `Headers` A list of headers that are sent with the response. 232 | // `Header` name is expected to be a string in the canonical format of the MIME header key 233 | // See: https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey 234 | map headers = 3; 235 | // `Examples` gives per-mimetype response examples. 236 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object 237 | map examples = 4; 238 | map extensions = 5; 239 | } 240 | 241 | // `Info` is a representation of OpenAPI v2 specification's Info object. 242 | // 243 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject 244 | // 245 | // Example: 246 | // 247 | // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { 248 | // info: { 249 | // title: "Echo API"; 250 | // version: "1.0"; 251 | // description: "; 252 | // contact: { 253 | // name: "gRPC-Gateway project"; 254 | // url: "https://github.com/grpc-ecosystem/grpc-gateway"; 255 | // email: "none@example.com"; 256 | // }; 257 | // license: { 258 | // name: "BSD 3-Clause License"; 259 | // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt"; 260 | // }; 261 | // }; 262 | // ... 263 | // }; 264 | // 265 | message Info { 266 | // The title of the application. 267 | string title = 1; 268 | // A short description of the application. GFM syntax can be used for rich 269 | // text representation. 270 | string description = 2; 271 | // The Terms of Service for the API. 272 | string terms_of_service = 3; 273 | // The contact information for the exposed API. 274 | Contact contact = 4; 275 | // The license information for the exposed API. 276 | License license = 5; 277 | // Provides the version of the application API (not to be confused 278 | // with the specification version). 279 | string version = 6; 280 | map extensions = 7; 281 | } 282 | 283 | // `Contact` is a representation of OpenAPI v2 specification's Contact object. 284 | // 285 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject 286 | // 287 | // Example: 288 | // 289 | // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { 290 | // info: { 291 | // ... 292 | // contact: { 293 | // name: "gRPC-Gateway project"; 294 | // url: "https://github.com/grpc-ecosystem/grpc-gateway"; 295 | // email: "none@example.com"; 296 | // }; 297 | // ... 298 | // }; 299 | // ... 300 | // }; 301 | // 302 | message Contact { 303 | // The identifying name of the contact person/organization. 304 | string name = 1; 305 | // The URL pointing to the contact information. MUST be in the format of a 306 | // URL. 307 | string url = 2; 308 | // The email address of the contact person/organization. MUST be in the format 309 | // of an email address. 310 | string email = 3; 311 | } 312 | 313 | // `License` is a representation of OpenAPI v2 specification's License object. 314 | // 315 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject 316 | // 317 | // Example: 318 | // 319 | // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { 320 | // info: { 321 | // ... 322 | // license: { 323 | // name: "BSD 3-Clause License"; 324 | // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt"; 325 | // }; 326 | // ... 327 | // }; 328 | // ... 329 | // }; 330 | // 331 | message License { 332 | // The license name used for the API. 333 | string name = 1; 334 | // A URL to the license used for the API. MUST be in the format of a URL. 335 | string url = 2; 336 | } 337 | 338 | // `ExternalDocumentation` is a representation of OpenAPI v2 specification's 339 | // ExternalDocumentation object. 340 | // 341 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject 342 | // 343 | // Example: 344 | // 345 | // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { 346 | // ... 347 | // external_docs: { 348 | // description: "More about gRPC-Gateway"; 349 | // url: "https://github.com/grpc-ecosystem/grpc-gateway"; 350 | // } 351 | // ... 352 | // }; 353 | // 354 | message ExternalDocumentation { 355 | // A short description of the target documentation. GFM syntax can be used for 356 | // rich text representation. 357 | string description = 1; 358 | // The URL for the target documentation. Value MUST be in the format 359 | // of a URL. 360 | string url = 2; 361 | } 362 | 363 | // `Schema` is a representation of OpenAPI v2 specification's Schema object. 364 | // 365 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject 366 | // 367 | message Schema { 368 | JSONSchema json_schema = 1; 369 | // Adds support for polymorphism. The discriminator is the schema property 370 | // name that is used to differentiate between other schema that inherit this 371 | // schema. The property name used MUST be defined at this schema and it MUST 372 | // be in the required property list. When used, the value MUST be the name of 373 | // this schema or any schema that inherits it. 374 | string discriminator = 2; 375 | // Relevant only for Schema "properties" definitions. Declares the property as 376 | // "read only". This means that it MAY be sent as part of a response but MUST 377 | // NOT be sent as part of the request. Properties marked as readOnly being 378 | // true SHOULD NOT be in the required list of the defined schema. Default 379 | // value is false. 380 | bool read_only = 3; 381 | // field 4 is reserved for 'xml'. 382 | reserved 4; 383 | // Additional external documentation for this schema. 384 | ExternalDocumentation external_docs = 5; 385 | // A free-form property to include an example of an instance for this schema in JSON. 386 | // This is copied verbatim to the output. 387 | string example = 6; 388 | } 389 | 390 | // `JSONSchema` represents properties from JSON Schema taken, and as used, in 391 | // the OpenAPI v2 spec. 392 | // 393 | // This includes changes made by OpenAPI v2. 394 | // 395 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject 396 | // 397 | // See also: https://cswr.github.io/JsonSchema/spec/basic_types/, 398 | // https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json 399 | // 400 | // Example: 401 | // 402 | // message SimpleMessage { 403 | // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { 404 | // json_schema: { 405 | // title: "SimpleMessage" 406 | // description: "A simple message." 407 | // required: ["id"] 408 | // } 409 | // }; 410 | // 411 | // // Id represents the message identifier. 412 | // string id = 1; [ 413 | // (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { 414 | // {description: "The unique identifier of the simple message." 415 | // }]; 416 | // } 417 | // 418 | message JSONSchema { 419 | // field 1 is reserved for '$id', omitted from OpenAPI v2. 420 | reserved 1; 421 | // field 2 is reserved for '$schema', omitted from OpenAPI v2. 422 | reserved 2; 423 | // Ref is used to define an external reference to include in the message. 424 | // This could be a fully qualified proto message reference, and that type must 425 | // be imported into the protofile. If no message is identified, the Ref will 426 | // be used verbatim in the output. 427 | // For example: 428 | // `ref: ".google.protobuf.Timestamp"`. 429 | string ref = 3; 430 | // field 4 is reserved for '$comment', omitted from OpenAPI v2. 431 | reserved 4; 432 | // The title of the schema. 433 | string title = 5; 434 | // A short description of the schema. 435 | string description = 6; 436 | string default = 7; 437 | bool read_only = 8; 438 | // A free-form property to include a JSON example of this field. This is copied 439 | // verbatim to the output swagger.json. Quotes must be escaped. 440 | // This property is the same for 2.0 and 3.0.0 https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#schemaObject https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject 441 | string example = 9; 442 | double multiple_of = 10; 443 | // Maximum represents an inclusive upper limit for a numeric instance. The 444 | // value of MUST be a number, 445 | double maximum = 11; 446 | bool exclusive_maximum = 12; 447 | // minimum represents an inclusive lower limit for a numeric instance. The 448 | // value of MUST be a number, 449 | double minimum = 13; 450 | bool exclusive_minimum = 14; 451 | uint64 max_length = 15; 452 | uint64 min_length = 16; 453 | string pattern = 17; 454 | // field 18 is reserved for 'additionalItems', omitted from OpenAPI v2. 455 | reserved 18; 456 | // field 19 is reserved for 'items', but in OpenAPI-specific way. 457 | // TODO(ivucica): add 'items'? 458 | reserved 19; 459 | uint64 max_items = 20; 460 | uint64 min_items = 21; 461 | bool unique_items = 22; 462 | // field 23 is reserved for 'contains', omitted from OpenAPI v2. 463 | reserved 23; 464 | uint64 max_properties = 24; 465 | uint64 min_properties = 25; 466 | repeated string required = 26; 467 | // field 27 is reserved for 'additionalProperties', but in OpenAPI-specific 468 | // way. TODO(ivucica): add 'additionalProperties'? 469 | reserved 27; 470 | // field 28 is reserved for 'definitions', omitted from OpenAPI v2. 471 | reserved 28; 472 | // field 29 is reserved for 'properties', but in OpenAPI-specific way. 473 | // TODO(ivucica): add 'additionalProperties'? 474 | reserved 29; 475 | // following fields are reserved, as the properties have been omitted from 476 | // OpenAPI v2: 477 | // patternProperties, dependencies, propertyNames, const 478 | reserved 30 to 33; 479 | // Items in 'array' must be unique. 480 | repeated string array = 34; 481 | 482 | enum JSONSchemaSimpleTypes { 483 | UNKNOWN = 0; 484 | ARRAY = 1; 485 | BOOLEAN = 2; 486 | INTEGER = 3; 487 | NULL = 4; 488 | NUMBER = 5; 489 | OBJECT = 6; 490 | STRING = 7; 491 | } 492 | 493 | repeated JSONSchemaSimpleTypes type = 35; 494 | // `Format` 495 | string format = 36; 496 | // following fields are reserved, as the properties have been omitted from 497 | // OpenAPI v2: contentMediaType, contentEncoding, if, then, else 498 | reserved 37 to 41; 499 | // field 42 is reserved for 'allOf', but in OpenAPI-specific way. 500 | // TODO(ivucica): add 'allOf'? 501 | reserved 42; 502 | // following fields are reserved, as the properties have been omitted from 503 | // OpenAPI v2: 504 | // anyOf, oneOf, not 505 | reserved 43 to 45; 506 | // Items in `enum` must be unique https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 507 | repeated string enum = 46; 508 | } 509 | 510 | // `Tag` is a representation of OpenAPI v2 specification's Tag object. 511 | // 512 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject 513 | // 514 | message Tag { 515 | // field 1 is reserved for 'name'. In our generator, this is (to be) extracted 516 | // from the name of proto service, and thus not exposed to the user, as 517 | // changing tag object's name would break the link to the references to the 518 | // tag in individual operation specifications. 519 | // 520 | // TODO(ivucica): Add 'name' property. Use it to allow override of the name of 521 | // global Tag object, then use that name to reference the tag throughout the 522 | // OpenAPI file. 523 | reserved 1; 524 | // A short description for the tag. GFM syntax can be used for rich text 525 | // representation. 526 | string description = 2; 527 | // Additional external documentation for this tag. 528 | ExternalDocumentation external_docs = 3; 529 | } 530 | 531 | // `SecurityDefinitions` is a representation of OpenAPI v2 specification's 532 | // Security Definitions object. 533 | // 534 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject 535 | // 536 | // A declaration of the security schemes available to be used in the 537 | // specification. This does not enforce the security schemes on the operations 538 | // and only serves to provide the relevant details for each scheme. 539 | message SecurityDefinitions { 540 | // A single security scheme definition, mapping a "name" to the scheme it 541 | // defines. 542 | map security = 1; 543 | } 544 | 545 | // `SecurityScheme` is a representation of OpenAPI v2 specification's 546 | // Security Scheme object. 547 | // 548 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject 549 | // 550 | // Allows the definition of a security scheme that can be used by the 551 | // operations. Supported schemes are basic authentication, an API key (either as 552 | // a header or as a query parameter) and OAuth2's common flows (implicit, 553 | // password, application and access code). 554 | message SecurityScheme { 555 | // The type of the security scheme. Valid values are "basic", 556 | // "apiKey" or "oauth2". 557 | enum Type { 558 | TYPE_INVALID = 0; 559 | TYPE_BASIC = 1; 560 | TYPE_API_KEY = 2; 561 | TYPE_OAUTH2 = 3; 562 | } 563 | 564 | // The location of the API key. Valid values are "query" or "header". 565 | enum In { 566 | IN_INVALID = 0; 567 | IN_QUERY = 1; 568 | IN_HEADER = 2; 569 | } 570 | 571 | // The flow used by the OAuth2 security scheme. Valid values are 572 | // "implicit", "password", "application" or "accessCode". 573 | enum Flow { 574 | FLOW_INVALID = 0; 575 | FLOW_IMPLICIT = 1; 576 | FLOW_PASSWORD = 2; 577 | FLOW_APPLICATION = 3; 578 | FLOW_ACCESS_CODE = 4; 579 | } 580 | 581 | // The type of the security scheme. Valid values are "basic", 582 | // "apiKey" or "oauth2". 583 | Type type = 1; 584 | // A short description for security scheme. 585 | string description = 2; 586 | // The name of the header or query parameter to be used. 587 | // Valid for apiKey. 588 | string name = 3; 589 | // The location of the API key. Valid values are "query" or 590 | // "header". 591 | // Valid for apiKey. 592 | In in = 4; 593 | // The flow used by the OAuth2 security scheme. Valid values are 594 | // "implicit", "password", "application" or "accessCode". 595 | // Valid for oauth2. 596 | Flow flow = 5; 597 | // The authorization URL to be used for this flow. This SHOULD be in 598 | // the form of a URL. 599 | // Valid for oauth2/implicit and oauth2/accessCode. 600 | string authorization_url = 6; 601 | // The token URL to be used for this flow. This SHOULD be in the 602 | // form of a URL. 603 | // Valid for oauth2/password, oauth2/application and oauth2/accessCode. 604 | string token_url = 7; 605 | // The available scopes for the OAuth2 security scheme. 606 | // Valid for oauth2. 607 | Scopes scopes = 8; 608 | map extensions = 9; 609 | } 610 | 611 | // `SecurityRequirement` is a representation of OpenAPI v2 specification's 612 | // Security Requirement object. 613 | // 614 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject 615 | // 616 | // Lists the required security schemes to execute this operation. The object can 617 | // have multiple security schemes declared in it which are all required (that 618 | // is, there is a logical AND between the schemes). 619 | // 620 | // The name used for each property MUST correspond to a security scheme 621 | // declared in the Security Definitions. 622 | message SecurityRequirement { 623 | // If the security scheme is of type "oauth2", then the value is a list of 624 | // scope names required for the execution. For other security scheme types, 625 | // the array MUST be empty. 626 | message SecurityRequirementValue { 627 | repeated string scope = 1; 628 | } 629 | // Each name must correspond to a security scheme which is declared in 630 | // the Security Definitions. If the security scheme is of type "oauth2", 631 | // then the value is a list of scope names required for the execution. 632 | // For other security scheme types, the array MUST be empty. 633 | map security_requirement = 1; 634 | } 635 | 636 | // `Scopes` is a representation of OpenAPI v2 specification's Scopes object. 637 | // 638 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject 639 | // 640 | // Lists the available scopes for an OAuth2 security scheme. 641 | message Scopes { 642 | // Maps between a name of a scope to a short description of it (as the value 643 | // of the property). 644 | map scope = 1; 645 | } 646 | -------------------------------------------------------------------------------- /plugins/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/plugins/.gitignore -------------------------------------------------------------------------------- /proto_gen.sh: -------------------------------------------------------------------------------- 1 | protoc -Iprotos -Ilibs --go_out=plugins=grpc:protos/builds protos/*.proto 2 | protoc -Iprotos -Ilibs --grpc-gateway_out=logtostderr=true:protos/builds protos/*.proto 3 | protoc -Iprotos -Ilibs --go_out=plugins=grpc:protos/builds libs/bima/*.proto 4 | protoc -Iprotos -Ilibs --grpc-gateway_out=logtostderr=true:protos/builds libs/bima/*.proto 5 | protoc -Iprotos -Ilibs --openapiv2_out=swaggers protos/*.proto 6 | -------------------------------------------------------------------------------- /protos/builds/pagination.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.25.0 4 | // protoc (unknown) 5 | // source: bima/pagination.proto 6 | 7 | package grpcs 8 | 9 | import ( 10 | proto "github.com/golang/protobuf/proto" 11 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 12 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 13 | reflect "reflect" 14 | sync "sync" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | // This is a compile-time assertion that a sufficiently up-to-date version 25 | // of the legacy proto package is being used. 26 | const _ = proto.ProtoPackageIsVersion4 27 | 28 | type PaginationMetadata struct { 29 | state protoimpl.MessageState 30 | sizeCache protoimpl.SizeCache 31 | unknownFields protoimpl.UnknownFields 32 | 33 | Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` 34 | Previous int32 `protobuf:"varint,2,opt,name=previous,proto3" json:"previous,omitempty"` 35 | Next int32 `protobuf:"varint,3,opt,name=next,proto3" json:"next,omitempty"` 36 | Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` 37 | Record int32 `protobuf:"varint,5,opt,name=record,proto3" json:"record,omitempty"` 38 | Total int32 `protobuf:"varint,6,opt,name=total,proto3" json:"total,omitempty"` 39 | } 40 | 41 | func (x *PaginationMetadata) Reset() { 42 | *x = PaginationMetadata{} 43 | if protoimpl.UnsafeEnabled { 44 | mi := &file_bima_pagination_proto_msgTypes[0] 45 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 46 | ms.StoreMessageInfo(mi) 47 | } 48 | } 49 | 50 | func (x *PaginationMetadata) String() string { 51 | return protoimpl.X.MessageStringOf(x) 52 | } 53 | 54 | func (*PaginationMetadata) ProtoMessage() {} 55 | 56 | func (x *PaginationMetadata) ProtoReflect() protoreflect.Message { 57 | mi := &file_bima_pagination_proto_msgTypes[0] 58 | if protoimpl.UnsafeEnabled && x != nil { 59 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 60 | if ms.LoadMessageInfo() == nil { 61 | ms.StoreMessageInfo(mi) 62 | } 63 | return ms 64 | } 65 | return mi.MessageOf(x) 66 | } 67 | 68 | // Deprecated: Use PaginationMetadata.ProtoReflect.Descriptor instead. 69 | func (*PaginationMetadata) Descriptor() ([]byte, []int) { 70 | return file_bima_pagination_proto_rawDescGZIP(), []int{0} 71 | } 72 | 73 | func (x *PaginationMetadata) GetPage() int32 { 74 | if x != nil { 75 | return x.Page 76 | } 77 | return 0 78 | } 79 | 80 | func (x *PaginationMetadata) GetPrevious() int32 { 81 | if x != nil { 82 | return x.Previous 83 | } 84 | return 0 85 | } 86 | 87 | func (x *PaginationMetadata) GetNext() int32 { 88 | if x != nil { 89 | return x.Next 90 | } 91 | return 0 92 | } 93 | 94 | func (x *PaginationMetadata) GetLimit() int32 { 95 | if x != nil { 96 | return x.Limit 97 | } 98 | return 0 99 | } 100 | 101 | func (x *PaginationMetadata) GetRecord() int32 { 102 | if x != nil { 103 | return x.Record 104 | } 105 | return 0 106 | } 107 | 108 | func (x *PaginationMetadata) GetTotal() int32 { 109 | if x != nil { 110 | return x.Total 111 | } 112 | return 0 113 | } 114 | 115 | type Pagination struct { 116 | state protoimpl.MessageState 117 | sizeCache protoimpl.SizeCache 118 | unknownFields protoimpl.UnknownFields 119 | 120 | Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` 121 | Counter uint64 `protobuf:"varint,2,opt,name=counter,proto3" json:"counter,omitempty"` 122 | Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` 123 | Fields []string `protobuf:"bytes,4,rep,name=fields,proto3" json:"fields,omitempty"` 124 | Values []string `protobuf:"bytes,5,rep,name=values,proto3" json:"values,omitempty"` 125 | } 126 | 127 | func (x *Pagination) Reset() { 128 | *x = Pagination{} 129 | if protoimpl.UnsafeEnabled { 130 | mi := &file_bima_pagination_proto_msgTypes[1] 131 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 132 | ms.StoreMessageInfo(mi) 133 | } 134 | } 135 | 136 | func (x *Pagination) String() string { 137 | return protoimpl.X.MessageStringOf(x) 138 | } 139 | 140 | func (*Pagination) ProtoMessage() {} 141 | 142 | func (x *Pagination) ProtoReflect() protoreflect.Message { 143 | mi := &file_bima_pagination_proto_msgTypes[1] 144 | if protoimpl.UnsafeEnabled && x != nil { 145 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 146 | if ms.LoadMessageInfo() == nil { 147 | ms.StoreMessageInfo(mi) 148 | } 149 | return ms 150 | } 151 | return mi.MessageOf(x) 152 | } 153 | 154 | // Deprecated: Use Pagination.ProtoReflect.Descriptor instead. 155 | func (*Pagination) Descriptor() ([]byte, []int) { 156 | return file_bima_pagination_proto_rawDescGZIP(), []int{1} 157 | } 158 | 159 | func (x *Pagination) GetPage() int32 { 160 | if x != nil { 161 | return x.Page 162 | } 163 | return 0 164 | } 165 | 166 | func (x *Pagination) GetCounter() uint64 { 167 | if x != nil { 168 | return x.Counter 169 | } 170 | return 0 171 | } 172 | 173 | func (x *Pagination) GetLimit() int32 { 174 | if x != nil { 175 | return x.Limit 176 | } 177 | return 0 178 | } 179 | 180 | func (x *Pagination) GetFields() []string { 181 | if x != nil { 182 | return x.Fields 183 | } 184 | return nil 185 | } 186 | 187 | func (x *Pagination) GetValues() []string { 188 | if x != nil { 189 | return x.Values 190 | } 191 | return nil 192 | } 193 | 194 | var File_bima_pagination_proto protoreflect.FileDescriptor 195 | 196 | var file_bima_pagination_proto_rawDesc = []byte{ 197 | 0x0a, 0x15, 0x62, 0x69, 0x6d, 0x61, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 198 | 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x67, 0x72, 0x70, 0x63, 0x73, 0x22, 0x9c, 199 | 0x01, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 200 | 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 201 | 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 202 | 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x72, 0x65, 203 | 0x76, 0x69, 0x6f, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 204 | 0x01, 0x28, 0x05, 0x52, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 205 | 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 206 | 0x16, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 207 | 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 208 | 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x80, 0x01, 209 | 0x0a, 0x0a, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 210 | 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 211 | 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 212 | 0x04, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 213 | 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 214 | 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 215 | 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 216 | 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 217 | 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 218 | 0x74, 0x6f, 0x33, 219 | } 220 | 221 | var ( 222 | file_bima_pagination_proto_rawDescOnce sync.Once 223 | file_bima_pagination_proto_rawDescData = file_bima_pagination_proto_rawDesc 224 | ) 225 | 226 | func file_bima_pagination_proto_rawDescGZIP() []byte { 227 | file_bima_pagination_proto_rawDescOnce.Do(func() { 228 | file_bima_pagination_proto_rawDescData = protoimpl.X.CompressGZIP(file_bima_pagination_proto_rawDescData) 229 | }) 230 | return file_bima_pagination_proto_rawDescData 231 | } 232 | 233 | var file_bima_pagination_proto_msgTypes = make([]protoimpl.MessageInfo, 2) 234 | var file_bima_pagination_proto_goTypes = []interface{}{ 235 | (*PaginationMetadata)(nil), // 0: grpcs.PaginationMetadata 236 | (*Pagination)(nil), // 1: grpcs.Pagination 237 | } 238 | var file_bima_pagination_proto_depIdxs = []int32{ 239 | 0, // [0:0] is the sub-list for method output_type 240 | 0, // [0:0] is the sub-list for method input_type 241 | 0, // [0:0] is the sub-list for extension type_name 242 | 0, // [0:0] is the sub-list for extension extendee 243 | 0, // [0:0] is the sub-list for field type_name 244 | } 245 | 246 | func init() { file_bima_pagination_proto_init() } 247 | func file_bima_pagination_proto_init() { 248 | if File_bima_pagination_proto != nil { 249 | return 250 | } 251 | if !protoimpl.UnsafeEnabled { 252 | file_bima_pagination_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 253 | switch v := v.(*PaginationMetadata); i { 254 | case 0: 255 | return &v.state 256 | case 1: 257 | return &v.sizeCache 258 | case 2: 259 | return &v.unknownFields 260 | default: 261 | return nil 262 | } 263 | } 264 | file_bima_pagination_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 265 | switch v := v.(*Pagination); i { 266 | case 0: 267 | return &v.state 268 | case 1: 269 | return &v.sizeCache 270 | case 2: 271 | return &v.unknownFields 272 | default: 273 | return nil 274 | } 275 | } 276 | } 277 | type x struct{} 278 | out := protoimpl.TypeBuilder{ 279 | File: protoimpl.DescBuilder{ 280 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 281 | RawDescriptor: file_bima_pagination_proto_rawDesc, 282 | NumEnums: 0, 283 | NumMessages: 2, 284 | NumExtensions: 0, 285 | NumServices: 0, 286 | }, 287 | GoTypes: file_bima_pagination_proto_goTypes, 288 | DependencyIndexes: file_bima_pagination_proto_depIdxs, 289 | MessageInfos: file_bima_pagination_proto_msgTypes, 290 | }.Build() 291 | File_bima_pagination_proto = out.File 292 | file_bima_pagination_proto_rawDesc = nil 293 | file_bima_pagination_proto_goTypes = nil 294 | file_bima_pagination_proto_depIdxs = nil 295 | } 296 | -------------------------------------------------------------------------------- /protos/builds/root.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.25.0 4 | // protoc (unknown) 5 | // source: bima/root.proto 6 | 7 | package grpcs 8 | 9 | import ( 10 | proto "github.com/golang/protobuf/proto" 11 | _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" 12 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 13 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 14 | reflect "reflect" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | // This is a compile-time assertion that a sufficiently up-to-date version 25 | // of the legacy proto package is being used. 26 | const _ = proto.ProtoPackageIsVersion4 27 | 28 | var File_bima_root_proto protoreflect.FileDescriptor 29 | 30 | var file_bima_root_proto_rawDesc = []byte{ 31 | 0x0a, 0x0f, 0x62, 0x69, 0x6d, 0x61, 0x2f, 0x72, 0x6f, 0x6f, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 32 | 0x6f, 0x12, 0x05, 0x67, 0x72, 0x70, 0x63, 0x73, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 33 | 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 34 | 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 35 | 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x68, 0x5a, 0x07, 0x2e, 0x3b, 0x67, 0x72, 36 | 0x70, 0x63, 0x73, 0x92, 0x41, 0x5c, 0x12, 0x0f, 0x0a, 0x08, 0x54, 0x6f, 0x64, 0x6f, 0x20, 0x41, 37 | 0x50, 0x49, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x1a, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 38 | 0x73, 0x74, 0x3a, 0x37, 0x37, 0x37, 0x37, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 39 | 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 40 | 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x5a, 41 | 0x11, 0x0a, 0x0f, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x02, 42 | 0x08, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 43 | } 44 | 45 | var file_bima_root_proto_goTypes = []interface{}{} 46 | var file_bima_root_proto_depIdxs = []int32{ 47 | 0, // [0:0] is the sub-list for method output_type 48 | 0, // [0:0] is the sub-list for method input_type 49 | 0, // [0:0] is the sub-list for extension type_name 50 | 0, // [0:0] is the sub-list for extension extendee 51 | 0, // [0:0] is the sub-list for field type_name 52 | } 53 | 54 | func init() { file_bima_root_proto_init() } 55 | func file_bima_root_proto_init() { 56 | if File_bima_root_proto != nil { 57 | return 58 | } 59 | type x struct{} 60 | out := protoimpl.TypeBuilder{ 61 | File: protoimpl.DescBuilder{ 62 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 63 | RawDescriptor: file_bima_root_proto_rawDesc, 64 | NumEnums: 0, 65 | NumMessages: 0, 66 | NumExtensions: 0, 67 | NumServices: 0, 68 | }, 69 | GoTypes: file_bima_root_proto_goTypes, 70 | DependencyIndexes: file_bima_root_proto_depIdxs, 71 | }.Build() 72 | File_bima_root_proto = out.File 73 | file_bima_root_proto_rawDesc = nil 74 | file_bima_root_proto_goTypes = nil 75 | file_bima_root_proto_depIdxs = nil 76 | } 77 | -------------------------------------------------------------------------------- /swaggers/apidocs.swagger.json: -------------------------------------------------------------------------------- 1 | { 2 | "swagger": "2.0", 3 | "info": { 4 | "title": "Crowde Skeleton", 5 | "version": "Bima@v1.6.10" 6 | }, 7 | "consumes": [ 8 | "text/html" 9 | ], 10 | "produces": [ 11 | "text/html" 12 | ], 13 | "paths": { 14 | "/health": { 15 | "get": { 16 | "operationId": "Health_Check", 17 | "responses": { 18 | "200": {}, 19 | "default": {} 20 | }, 21 | "parameters": [], 22 | "tags": [ 23 | "Health" 24 | ] 25 | } 26 | } 27 | }, 28 | "definitions": {}, 29 | "securityDefinitions": {} 30 | } 31 | -------------------------------------------------------------------------------- /swaggers/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/swaggers/favicon-16x16.png -------------------------------------------------------------------------------- /swaggers/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdedev/skeleton/275ead77f3d3f2c6a893555fc7037fb0bf4aba06/swaggers/favicon-32x32.png -------------------------------------------------------------------------------- /swaggers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 31 | 32 | 33 | 34 |
35 | 36 | 37 | 38 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /swaggers/modules.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /swaggers/oauth2-redirect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Swagger UI: OAuth2 Redirect 5 | 6 | 7 | 8 | 9 | 76 | --------------------------------------------------------------------------------