├── README.md ├── generated ├── api.pb.go └── api_grpc.pb.go ├── go.mod ├── go.sum └── proto ├── api.proto ├── google ├── api │ ├── annotations.proto │ ├── field_behavior.proto │ ├── http.proto │ ├── httpbody.proto │ └── visibility.proto └── protobuf │ ├── any.proto │ ├── api.proto │ ├── descriptor.proto │ ├── duration.proto │ ├── empty.proto │ ├── field_mask.proto │ ├── source_context.proto │ ├── struct.proto │ ├── timestamp.proto │ ├── type.proto │ └── wrappers.proto └── protoc-gen-openapiv2 └── options ├── annotations.proto └── openapiv2.proto /README.md: -------------------------------------------------------------------------------- 1 | # NextBlock grpc proto spec 2 | 3 | Use protoc to generate the grpc code from the proto file. 4 | 5 | ```bash 6 | protoc \ 7 | --go_out=./generated \ 8 | --go_opt=paths=source_relative \ 9 | --go-grpc_out=./generated \ 10 | --go-grpc_opt=paths=source_relative \ 11 | --proto_path ./proto/ proto/api.proto 12 | ```` 13 | 14 | ## Setup 15 | 16 | Connection prep to the grpc server with keepalive and credentials. 17 | 18 | ```go 19 | var kacp = keepalive.ClientParameters{ 20 | Time: 10 * time.Second, // send pings every 10 seconds if there is no activity 21 | Timeout: time.Second, // wait 1 second for ping ack before considering the connection dead 22 | PermitWithoutStream: true, // send pings even without active streams 23 | } 24 | 25 | type ApiCredentials struct { 26 | Token string 27 | } 28 | 29 | func (p *ApiCredentials) GetRequestMetadata(_ context.Context, _ ...string) (map[string]string, error) { 30 | return map[string]string{ 31 | "authorization": fmt.Sprintf("%s", p.Token), 32 | }, nil 33 | } 34 | 35 | func (p *ApiCredentials) RequireTransportSecurity() bool { 36 | return false 37 | } 38 | 39 | 40 | func grpcConnect(address string, plaintext bool) *grpc.ClientConn { 41 | var opts []grpc.DialOption 42 | if plaintext { 43 | opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) 44 | } else { 45 | pool, _ := x509.SystemCertPool() 46 | creds := credentials.NewClientTLSFromCert(pool, "") 47 | opts = append(opts, grpc.WithTransportCredentials(creds)) 48 | } 49 | opts = append(opts, grpc.WithKeepaliveParams(kacp)) 50 | opts = append(opts, grpc.WithPerRPCCredentials(&ApiCredentials{Token: ""})) 51 | log.Println("Starting grpc client, connecting to", address) 52 | conn, err := grpc.NewClient(address, opts...) 53 | if err != nil { 54 | log.Fatalf("fail to dial: %v", err) 55 | } 56 | return conn 57 | } 58 | ``` 59 | 60 | ## Usage 61 | 62 | Init the grpc connection and the api client. 63 | Send a sample transaction. 64 | 65 | ```go 66 | var ( 67 | cc = grpcConnect("fra.nextblock.io", false) 68 | apiClient = api.NewApiClient(cc) 69 | ) 70 | 71 | func demo() { 72 | f := false 73 | cli := rpc.New("") 74 | bh, _ := cli.GetLatestBlockhash(context.TODO(), rpc.CommitmentFinalized) 75 | pk := solana.MustPrivateKeyFromBase58("") 76 | txBuilder := solana.NewTransactionBuilder() 77 | txBuilder.SetFeePayer(pk.PublicKey()) 78 | txBuilder.SetRecentBlockHash(bh.Value.Blockhash) 79 | txBuilder.AddInstruction( 80 | system.NewTransferInstruction(1000000, pk.PublicKey(), solana.MustPublicKeyFromBase58("nEXTBLockYgngeRmRrjDV31mGSekVPqZoMGhQEZtPVG")).Build(), 81 | ) 82 | tx, err := txBuilder.Build() 83 | if err != nil { 84 | log.Println(err) 85 | return 86 | } 87 | tx.Sign(func(key solana.PublicKey) *solana.PrivateKey { 88 | return &pk 89 | }) 90 | tb64, _ := tx.ToBase64() 91 | response, err := apiClient.PostSubmitV2(context.TODO(), &api.PostSubmitRequest{ 92 | Transaction: &api.TransactionMessage{Content: tb64}, 93 | SkipPreFlight: true, 94 | UseStakedRPCs: &f, 95 | FrontRunningProtection: &f, 96 | FastBestEffort: &f, 97 | }) 98 | if err != nil { 99 | return 100 | } 101 | log.Println(response) 102 | } 103 | ``` 104 | 105 | ## Randomize wallet selection 106 | 107 | We recommend to ranomize the wallet selection to avoid spamming the same wallet and potentially 108 | hitting per slot wallet limits. 109 | 110 | ```go 111 | var NextblockTipWallets = []string{ 112 | "NEXTbLoCkB51HpLBLojQfpyVAMorm3zzKg7w9NFdqid", 113 | "nextBLoCkPMgmG8ZgJtABeScP35qLa2AMCNKntAP7Xc", 114 | "NextbLoCkVtMGcV47JzewQdvBpLqT9TxQFozQkN98pE", 115 | "NexTbLoCkWykbLuB1NkjXgFWkX9oAtcoagQegygXXA2", 116 | "NeXTBLoCKs9F1y5PJS9CKrFNNLU1keHW71rfh7KgA1X", 117 | "NexTBLockJYZ7QD7p2byrUa6df8ndV2WSd8GkbWqfbb", 118 | "neXtBLock1LeC67jYd1QdAa32kbVeubsfPNTJC1V5At", 119 | "nEXTBLockYgngeRmRrjDV31mGSekVPqZoMGhQEZtPVG", 120 | } 121 | 122 | func RandomWallet() string { 123 | r := rand.New(rand.NewSource(time.Now().UnixNano())), 124 | return NextblockTipWallets[rand.Intn(len(NextblockTipWallets))] 125 | } 126 | ``` 127 | 128 | ## Priority fees 129 | 130 | The minimum priority fee is `0.001` SOL or `1000000` lamports. 131 | Higher tip will result in higher priority and better landing times. -------------------------------------------------------------------------------- /generated/api.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.6 4 | // protoc v5.29.3 5 | // source: api.proto 6 | 7 | package api 8 | 9 | import ( 10 | _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" 11 | _ "google.golang.org/genproto/googleapis/api/annotations" 12 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 13 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 14 | reflect "reflect" 15 | sync "sync" 16 | unsafe "unsafe" 17 | ) 18 | 19 | const ( 20 | // Verify that this generated code is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 22 | // Verify that runtime/protoimpl is sufficiently up-to-date. 23 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 24 | ) 25 | 26 | type TipFloorRequest struct { 27 | state protoimpl.MessageState `protogen:"open.v1"` 28 | unknownFields protoimpl.UnknownFields 29 | sizeCache protoimpl.SizeCache 30 | } 31 | 32 | func (x *TipFloorRequest) Reset() { 33 | *x = TipFloorRequest{} 34 | mi := &file_api_proto_msgTypes[0] 35 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 36 | ms.StoreMessageInfo(mi) 37 | } 38 | 39 | func (x *TipFloorRequest) String() string { 40 | return protoimpl.X.MessageStringOf(x) 41 | } 42 | 43 | func (*TipFloorRequest) ProtoMessage() {} 44 | 45 | func (x *TipFloorRequest) ProtoReflect() protoreflect.Message { 46 | mi := &file_api_proto_msgTypes[0] 47 | if x != nil { 48 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 49 | if ms.LoadMessageInfo() == nil { 50 | ms.StoreMessageInfo(mi) 51 | } 52 | return ms 53 | } 54 | return mi.MessageOf(x) 55 | } 56 | 57 | // Deprecated: Use TipFloorRequest.ProtoReflect.Descriptor instead. 58 | func (*TipFloorRequest) Descriptor() ([]byte, []int) { 59 | return file_api_proto_rawDescGZIP(), []int{0} 60 | } 61 | 62 | type TipFloorStreamRequest struct { 63 | state protoimpl.MessageState `protogen:"open.v1"` 64 | UpdateFrequency string `protobuf:"bytes,1,opt,name=update_frequency,json=updateFrequency,proto3" json:"update_frequency,omitempty"` // e.g. "1m", "5m", "10m" 65 | unknownFields protoimpl.UnknownFields 66 | sizeCache protoimpl.SizeCache 67 | } 68 | 69 | func (x *TipFloorStreamRequest) Reset() { 70 | *x = TipFloorStreamRequest{} 71 | mi := &file_api_proto_msgTypes[1] 72 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 73 | ms.StoreMessageInfo(mi) 74 | } 75 | 76 | func (x *TipFloorStreamRequest) String() string { 77 | return protoimpl.X.MessageStringOf(x) 78 | } 79 | 80 | func (*TipFloorStreamRequest) ProtoMessage() {} 81 | 82 | func (x *TipFloorStreamRequest) ProtoReflect() protoreflect.Message { 83 | mi := &file_api_proto_msgTypes[1] 84 | if x != nil { 85 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 86 | if ms.LoadMessageInfo() == nil { 87 | ms.StoreMessageInfo(mi) 88 | } 89 | return ms 90 | } 91 | return mi.MessageOf(x) 92 | } 93 | 94 | // Deprecated: Use TipFloorStreamRequest.ProtoReflect.Descriptor instead. 95 | func (*TipFloorStreamRequest) Descriptor() ([]byte, []int) { 96 | return file_api_proto_rawDescGZIP(), []int{1} 97 | } 98 | 99 | func (x *TipFloorStreamRequest) GetUpdateFrequency() string { 100 | if x != nil { 101 | return x.UpdateFrequency 102 | } 103 | return "" 104 | } 105 | 106 | type TipStats struct { 107 | state protoimpl.MessageState `protogen:"open.v1"` 108 | Time string `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"` 109 | LandedTips_25ThPercentile float64 `protobuf:"fixed64,2,opt,name=landed_tips_25th_percentile,json=landedTips25thPercentile,proto3" json:"landed_tips_25th_percentile,omitempty"` 110 | LandedTips_50ThPercentile float64 `protobuf:"fixed64,3,opt,name=landed_tips_50th_percentile,json=landedTips50thPercentile,proto3" json:"landed_tips_50th_percentile,omitempty"` 111 | LandedTips_75ThPercentile float64 `protobuf:"fixed64,4,opt,name=landed_tips_75th_percentile,json=landedTips75thPercentile,proto3" json:"landed_tips_75th_percentile,omitempty"` 112 | LandedTips_95ThPercentile float64 `protobuf:"fixed64,5,opt,name=landed_tips_95th_percentile,json=landedTips95thPercentile,proto3" json:"landed_tips_95th_percentile,omitempty"` 113 | LandedTips_99ThPercentile float64 `protobuf:"fixed64,6,opt,name=landed_tips_99th_percentile,json=landedTips99thPercentile,proto3" json:"landed_tips_99th_percentile,omitempty"` 114 | EmaLandedTips_50ThPercentile float64 `protobuf:"fixed64,7,opt,name=ema_landed_tips_50th_percentile,json=emaLandedTips50thPercentile,proto3" json:"ema_landed_tips_50th_percentile,omitempty"` 115 | unknownFields protoimpl.UnknownFields 116 | sizeCache protoimpl.SizeCache 117 | } 118 | 119 | func (x *TipStats) Reset() { 120 | *x = TipStats{} 121 | mi := &file_api_proto_msgTypes[2] 122 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 123 | ms.StoreMessageInfo(mi) 124 | } 125 | 126 | func (x *TipStats) String() string { 127 | return protoimpl.X.MessageStringOf(x) 128 | } 129 | 130 | func (*TipStats) ProtoMessage() {} 131 | 132 | func (x *TipStats) ProtoReflect() protoreflect.Message { 133 | mi := &file_api_proto_msgTypes[2] 134 | if x != nil { 135 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 136 | if ms.LoadMessageInfo() == nil { 137 | ms.StoreMessageInfo(mi) 138 | } 139 | return ms 140 | } 141 | return mi.MessageOf(x) 142 | } 143 | 144 | // Deprecated: Use TipStats.ProtoReflect.Descriptor instead. 145 | func (*TipStats) Descriptor() ([]byte, []int) { 146 | return file_api_proto_rawDescGZIP(), []int{2} 147 | } 148 | 149 | func (x *TipStats) GetTime() string { 150 | if x != nil { 151 | return x.Time 152 | } 153 | return "" 154 | } 155 | 156 | func (x *TipStats) GetLandedTips_25ThPercentile() float64 { 157 | if x != nil { 158 | return x.LandedTips_25ThPercentile 159 | } 160 | return 0 161 | } 162 | 163 | func (x *TipStats) GetLandedTips_50ThPercentile() float64 { 164 | if x != nil { 165 | return x.LandedTips_50ThPercentile 166 | } 167 | return 0 168 | } 169 | 170 | func (x *TipStats) GetLandedTips_75ThPercentile() float64 { 171 | if x != nil { 172 | return x.LandedTips_75ThPercentile 173 | } 174 | return 0 175 | } 176 | 177 | func (x *TipStats) GetLandedTips_95ThPercentile() float64 { 178 | if x != nil { 179 | return x.LandedTips_95ThPercentile 180 | } 181 | return 0 182 | } 183 | 184 | func (x *TipStats) GetLandedTips_99ThPercentile() float64 { 185 | if x != nil { 186 | return x.LandedTips_99ThPercentile 187 | } 188 | return 0 189 | } 190 | 191 | func (x *TipStats) GetEmaLandedTips_50ThPercentile() float64 { 192 | if x != nil { 193 | return x.EmaLandedTips_50ThPercentile 194 | } 195 | return 0 196 | } 197 | 198 | type TipFloorResponse struct { 199 | state protoimpl.MessageState `protogen:"open.v1"` 200 | Stats []*TipStats `protobuf:"bytes,1,rep,name=stats,proto3" json:"stats,omitempty"` 201 | unknownFields protoimpl.UnknownFields 202 | sizeCache protoimpl.SizeCache 203 | } 204 | 205 | func (x *TipFloorResponse) Reset() { 206 | *x = TipFloorResponse{} 207 | mi := &file_api_proto_msgTypes[3] 208 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 209 | ms.StoreMessageInfo(mi) 210 | } 211 | 212 | func (x *TipFloorResponse) String() string { 213 | return protoimpl.X.MessageStringOf(x) 214 | } 215 | 216 | func (*TipFloorResponse) ProtoMessage() {} 217 | 218 | func (x *TipFloorResponse) ProtoReflect() protoreflect.Message { 219 | mi := &file_api_proto_msgTypes[3] 220 | if x != nil { 221 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 222 | if ms.LoadMessageInfo() == nil { 223 | ms.StoreMessageInfo(mi) 224 | } 225 | return ms 226 | } 227 | return mi.MessageOf(x) 228 | } 229 | 230 | // Deprecated: Use TipFloorResponse.ProtoReflect.Descriptor instead. 231 | func (*TipFloorResponse) Descriptor() ([]byte, []int) { 232 | return file_api_proto_rawDescGZIP(), []int{3} 233 | } 234 | 235 | func (x *TipFloorResponse) GetStats() []*TipStats { 236 | if x != nil { 237 | return x.Stats 238 | } 239 | return nil 240 | } 241 | 242 | // Add these message definitions 243 | type PingRequest struct { 244 | state protoimpl.MessageState `protogen:"open.v1"` 245 | unknownFields protoimpl.UnknownFields 246 | sizeCache protoimpl.SizeCache 247 | } 248 | 249 | func (x *PingRequest) Reset() { 250 | *x = PingRequest{} 251 | mi := &file_api_proto_msgTypes[4] 252 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 253 | ms.StoreMessageInfo(mi) 254 | } 255 | 256 | func (x *PingRequest) String() string { 257 | return protoimpl.X.MessageStringOf(x) 258 | } 259 | 260 | func (*PingRequest) ProtoMessage() {} 261 | 262 | func (x *PingRequest) ProtoReflect() protoreflect.Message { 263 | mi := &file_api_proto_msgTypes[4] 264 | if x != nil { 265 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 266 | if ms.LoadMessageInfo() == nil { 267 | ms.StoreMessageInfo(mi) 268 | } 269 | return ms 270 | } 271 | return mi.MessageOf(x) 272 | } 273 | 274 | // Deprecated: Use PingRequest.ProtoReflect.Descriptor instead. 275 | func (*PingRequest) Descriptor() ([]byte, []int) { 276 | return file_api_proto_rawDescGZIP(), []int{4} 277 | } 278 | 279 | type PongResponse struct { 280 | state protoimpl.MessageState `protogen:"open.v1"` 281 | unknownFields protoimpl.UnknownFields 282 | sizeCache protoimpl.SizeCache 283 | } 284 | 285 | func (x *PongResponse) Reset() { 286 | *x = PongResponse{} 287 | mi := &file_api_proto_msgTypes[5] 288 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 289 | ms.StoreMessageInfo(mi) 290 | } 291 | 292 | func (x *PongResponse) String() string { 293 | return protoimpl.X.MessageStringOf(x) 294 | } 295 | 296 | func (*PongResponse) ProtoMessage() {} 297 | 298 | func (x *PongResponse) ProtoReflect() protoreflect.Message { 299 | mi := &file_api_proto_msgTypes[5] 300 | if x != nil { 301 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 302 | if ms.LoadMessageInfo() == nil { 303 | ms.StoreMessageInfo(mi) 304 | } 305 | return ms 306 | } 307 | return mi.MessageOf(x) 308 | } 309 | 310 | // Deprecated: Use PongResponse.ProtoReflect.Descriptor instead. 311 | func (*PongResponse) Descriptor() ([]byte, []int) { 312 | return file_api_proto_rawDescGZIP(), []int{5} 313 | } 314 | 315 | type PostSubmitRequest struct { 316 | state protoimpl.MessageState `protogen:"open.v1"` 317 | Transaction *TransactionMessage `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"` 318 | SkipPreFlight bool `protobuf:"varint,2,opt,name=skipPreFlight,proto3" json:"skipPreFlight,omitempty"` 319 | FrontRunningProtection *bool `protobuf:"varint,3,opt,name=frontRunningProtection,proto3,oneof" json:"frontRunningProtection,omitempty"` 320 | ExperimentalFrontRunningProtection *bool `protobuf:"varint,8,opt,name=experimentalFrontRunningProtection,proto3,oneof" json:"experimentalFrontRunningProtection,omitempty"` 321 | SnipeTransaction *bool `protobuf:"varint,9,opt,name=snipeTransaction,proto3,oneof" json:"snipeTransaction,omitempty"` 322 | DisableRetries *bool `protobuf:"varint,10,opt,name=disableRetries,proto3,oneof" json:"disableRetries,omitempty"` 323 | RevertOnFail *bool `protobuf:"varint,11,opt,name=revertOnFail,proto3,oneof" json:"revertOnFail,omitempty"` 324 | unknownFields protoimpl.UnknownFields 325 | sizeCache protoimpl.SizeCache 326 | } 327 | 328 | func (x *PostSubmitRequest) Reset() { 329 | *x = PostSubmitRequest{} 330 | mi := &file_api_proto_msgTypes[6] 331 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 332 | ms.StoreMessageInfo(mi) 333 | } 334 | 335 | func (x *PostSubmitRequest) String() string { 336 | return protoimpl.X.MessageStringOf(x) 337 | } 338 | 339 | func (*PostSubmitRequest) ProtoMessage() {} 340 | 341 | func (x *PostSubmitRequest) ProtoReflect() protoreflect.Message { 342 | mi := &file_api_proto_msgTypes[6] 343 | if x != nil { 344 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 345 | if ms.LoadMessageInfo() == nil { 346 | ms.StoreMessageInfo(mi) 347 | } 348 | return ms 349 | } 350 | return mi.MessageOf(x) 351 | } 352 | 353 | // Deprecated: Use PostSubmitRequest.ProtoReflect.Descriptor instead. 354 | func (*PostSubmitRequest) Descriptor() ([]byte, []int) { 355 | return file_api_proto_rawDescGZIP(), []int{6} 356 | } 357 | 358 | func (x *PostSubmitRequest) GetTransaction() *TransactionMessage { 359 | if x != nil { 360 | return x.Transaction 361 | } 362 | return nil 363 | } 364 | 365 | func (x *PostSubmitRequest) GetSkipPreFlight() bool { 366 | if x != nil { 367 | return x.SkipPreFlight 368 | } 369 | return false 370 | } 371 | 372 | func (x *PostSubmitRequest) GetFrontRunningProtection() bool { 373 | if x != nil && x.FrontRunningProtection != nil { 374 | return *x.FrontRunningProtection 375 | } 376 | return false 377 | } 378 | 379 | func (x *PostSubmitRequest) GetExperimentalFrontRunningProtection() bool { 380 | if x != nil && x.ExperimentalFrontRunningProtection != nil { 381 | return *x.ExperimentalFrontRunningProtection 382 | } 383 | return false 384 | } 385 | 386 | func (x *PostSubmitRequest) GetSnipeTransaction() bool { 387 | if x != nil && x.SnipeTransaction != nil { 388 | return *x.SnipeTransaction 389 | } 390 | return false 391 | } 392 | 393 | func (x *PostSubmitRequest) GetDisableRetries() bool { 394 | if x != nil && x.DisableRetries != nil { 395 | return *x.DisableRetries 396 | } 397 | return false 398 | } 399 | 400 | func (x *PostSubmitRequest) GetRevertOnFail() bool { 401 | if x != nil && x.RevertOnFail != nil { 402 | return *x.RevertOnFail 403 | } 404 | return false 405 | } 406 | 407 | type PostSubmitRequestEntry struct { 408 | state protoimpl.MessageState `protogen:"open.v1"` 409 | Transaction *TransactionMessage `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"` 410 | unknownFields protoimpl.UnknownFields 411 | sizeCache protoimpl.SizeCache 412 | } 413 | 414 | func (x *PostSubmitRequestEntry) Reset() { 415 | *x = PostSubmitRequestEntry{} 416 | mi := &file_api_proto_msgTypes[7] 417 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 418 | ms.StoreMessageInfo(mi) 419 | } 420 | 421 | func (x *PostSubmitRequestEntry) String() string { 422 | return protoimpl.X.MessageStringOf(x) 423 | } 424 | 425 | func (*PostSubmitRequestEntry) ProtoMessage() {} 426 | 427 | func (x *PostSubmitRequestEntry) ProtoReflect() protoreflect.Message { 428 | mi := &file_api_proto_msgTypes[7] 429 | if x != nil { 430 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 431 | if ms.LoadMessageInfo() == nil { 432 | ms.StoreMessageInfo(mi) 433 | } 434 | return ms 435 | } 436 | return mi.MessageOf(x) 437 | } 438 | 439 | // Deprecated: Use PostSubmitRequestEntry.ProtoReflect.Descriptor instead. 440 | func (*PostSubmitRequestEntry) Descriptor() ([]byte, []int) { 441 | return file_api_proto_rawDescGZIP(), []int{7} 442 | } 443 | 444 | func (x *PostSubmitRequestEntry) GetTransaction() *TransactionMessage { 445 | if x != nil { 446 | return x.Transaction 447 | } 448 | return nil 449 | } 450 | 451 | type PostSubmitBatchRequest struct { 452 | state protoimpl.MessageState `protogen:"open.v1"` 453 | Entries []*PostSubmitRequestEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` 454 | unknownFields protoimpl.UnknownFields 455 | sizeCache protoimpl.SizeCache 456 | } 457 | 458 | func (x *PostSubmitBatchRequest) Reset() { 459 | *x = PostSubmitBatchRequest{} 460 | mi := &file_api_proto_msgTypes[8] 461 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 462 | ms.StoreMessageInfo(mi) 463 | } 464 | 465 | func (x *PostSubmitBatchRequest) String() string { 466 | return protoimpl.X.MessageStringOf(x) 467 | } 468 | 469 | func (*PostSubmitBatchRequest) ProtoMessage() {} 470 | 471 | func (x *PostSubmitBatchRequest) ProtoReflect() protoreflect.Message { 472 | mi := &file_api_proto_msgTypes[8] 473 | if x != nil { 474 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 475 | if ms.LoadMessageInfo() == nil { 476 | ms.StoreMessageInfo(mi) 477 | } 478 | return ms 479 | } 480 | return mi.MessageOf(x) 481 | } 482 | 483 | // Deprecated: Use PostSubmitBatchRequest.ProtoReflect.Descriptor instead. 484 | func (*PostSubmitBatchRequest) Descriptor() ([]byte, []int) { 485 | return file_api_proto_rawDescGZIP(), []int{8} 486 | } 487 | 488 | func (x *PostSubmitBatchRequest) GetEntries() []*PostSubmitRequestEntry { 489 | if x != nil { 490 | return x.Entries 491 | } 492 | return nil 493 | } 494 | 495 | type PostSubmitResponse struct { 496 | state protoimpl.MessageState `protogen:"open.v1"` 497 | Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` 498 | unknownFields protoimpl.UnknownFields 499 | sizeCache protoimpl.SizeCache 500 | } 501 | 502 | func (x *PostSubmitResponse) Reset() { 503 | *x = PostSubmitResponse{} 504 | mi := &file_api_proto_msgTypes[9] 505 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 506 | ms.StoreMessageInfo(mi) 507 | } 508 | 509 | func (x *PostSubmitResponse) String() string { 510 | return protoimpl.X.MessageStringOf(x) 511 | } 512 | 513 | func (*PostSubmitResponse) ProtoMessage() {} 514 | 515 | func (x *PostSubmitResponse) ProtoReflect() protoreflect.Message { 516 | mi := &file_api_proto_msgTypes[9] 517 | if x != nil { 518 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 519 | if ms.LoadMessageInfo() == nil { 520 | ms.StoreMessageInfo(mi) 521 | } 522 | return ms 523 | } 524 | return mi.MessageOf(x) 525 | } 526 | 527 | // Deprecated: Use PostSubmitResponse.ProtoReflect.Descriptor instead. 528 | func (*PostSubmitResponse) Descriptor() ([]byte, []int) { 529 | return file_api_proto_rawDescGZIP(), []int{9} 530 | } 531 | 532 | func (x *PostSubmitResponse) GetSignature() string { 533 | if x != nil { 534 | return x.Signature 535 | } 536 | return "" 537 | } 538 | 539 | type TransactionMessage struct { 540 | state protoimpl.MessageState `protogen:"open.v1"` 541 | Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` 542 | IsCleanup bool `protobuf:"varint,2,opt,name=isCleanup,proto3" json:"isCleanup,omitempty"` 543 | unknownFields protoimpl.UnknownFields 544 | sizeCache protoimpl.SizeCache 545 | } 546 | 547 | func (x *TransactionMessage) Reset() { 548 | *x = TransactionMessage{} 549 | mi := &file_api_proto_msgTypes[10] 550 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 551 | ms.StoreMessageInfo(mi) 552 | } 553 | 554 | func (x *TransactionMessage) String() string { 555 | return protoimpl.X.MessageStringOf(x) 556 | } 557 | 558 | func (*TransactionMessage) ProtoMessage() {} 559 | 560 | func (x *TransactionMessage) ProtoReflect() protoreflect.Message { 561 | mi := &file_api_proto_msgTypes[10] 562 | if x != nil { 563 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 564 | if ms.LoadMessageInfo() == nil { 565 | ms.StoreMessageInfo(mi) 566 | } 567 | return ms 568 | } 569 | return mi.MessageOf(x) 570 | } 571 | 572 | // Deprecated: Use TransactionMessage.ProtoReflect.Descriptor instead. 573 | func (*TransactionMessage) Descriptor() ([]byte, []int) { 574 | return file_api_proto_rawDescGZIP(), []int{10} 575 | } 576 | 577 | func (x *TransactionMessage) GetContent() string { 578 | if x != nil { 579 | return x.Content 580 | } 581 | return "" 582 | } 583 | 584 | func (x *TransactionMessage) GetIsCleanup() bool { 585 | if x != nil { 586 | return x.IsCleanup 587 | } 588 | return false 589 | } 590 | 591 | type TransactionMessageV2 struct { 592 | state protoimpl.MessageState `protogen:"open.v1"` 593 | Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` 594 | unknownFields protoimpl.UnknownFields 595 | sizeCache protoimpl.SizeCache 596 | } 597 | 598 | func (x *TransactionMessageV2) Reset() { 599 | *x = TransactionMessageV2{} 600 | mi := &file_api_proto_msgTypes[11] 601 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 602 | ms.StoreMessageInfo(mi) 603 | } 604 | 605 | func (x *TransactionMessageV2) String() string { 606 | return protoimpl.X.MessageStringOf(x) 607 | } 608 | 609 | func (*TransactionMessageV2) ProtoMessage() {} 610 | 611 | func (x *TransactionMessageV2) ProtoReflect() protoreflect.Message { 612 | mi := &file_api_proto_msgTypes[11] 613 | if x != nil { 614 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 615 | if ms.LoadMessageInfo() == nil { 616 | ms.StoreMessageInfo(mi) 617 | } 618 | return ms 619 | } 620 | return mi.MessageOf(x) 621 | } 622 | 623 | // Deprecated: Use TransactionMessageV2.ProtoReflect.Descriptor instead. 624 | func (*TransactionMessageV2) Descriptor() ([]byte, []int) { 625 | return file_api_proto_rawDescGZIP(), []int{11} 626 | } 627 | 628 | func (x *TransactionMessageV2) GetContent() string { 629 | if x != nil { 630 | return x.Content 631 | } 632 | return "" 633 | } 634 | 635 | var File_api_proto protoreflect.FileDescriptor 636 | 637 | const file_api_proto_rawDesc = "" + 638 | "\n" + 639 | "\tapi.proto\x12\x03api\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a.protoc-gen-openapiv2/options/annotations.proto\"\x11\n" + 640 | "\x0fTipFloorRequest\"B\n" + 641 | "\x15TipFloorStreamRequest\x12)\n" + 642 | "\x10update_frequency\x18\x01 \x01(\tR\x0fupdateFrequency\"\x9f\x03\n" + 643 | "\bTipStats\x12\x12\n" + 644 | "\x04time\x18\x01 \x01(\tR\x04time\x12=\n" + 645 | "\x1blanded_tips_25th_percentile\x18\x02 \x01(\x01R\x18landedTips25thPercentile\x12=\n" + 646 | "\x1blanded_tips_50th_percentile\x18\x03 \x01(\x01R\x18landedTips50thPercentile\x12=\n" + 647 | "\x1blanded_tips_75th_percentile\x18\x04 \x01(\x01R\x18landedTips75thPercentile\x12=\n" + 648 | "\x1blanded_tips_95th_percentile\x18\x05 \x01(\x01R\x18landedTips95thPercentile\x12=\n" + 649 | "\x1blanded_tips_99th_percentile\x18\x06 \x01(\x01R\x18landedTips99thPercentile\x12D\n" + 650 | "\x1fema_landed_tips_50th_percentile\x18\a \x01(\x01R\x1bemaLandedTips50thPercentile\"7\n" + 651 | "\x10TipFloorResponse\x12#\n" + 652 | "\x05stats\x18\x01 \x03(\v2\r.api.TipStatsR\x05stats\"\r\n" + 653 | "\vPingRequest\"\x0e\n" + 654 | "\fPongResponse\"\xc4\x04\n" + 655 | "\x11PostSubmitRequest\x12?\n" + 656 | "\vtransaction\x18\x01 \x01(\v2\x17.api.TransactionMessageB\x04\xe2A\x01\x02R\vtransaction\x12$\n" + 657 | "\rskipPreFlight\x18\x02 \x01(\bR\rskipPreFlight\x12;\n" + 658 | "\x16frontRunningProtection\x18\x03 \x01(\bH\x00R\x16frontRunningProtection\x88\x01\x01\x12S\n" + 659 | "\"experimentalFrontRunningProtection\x18\b \x01(\bH\x01R\"experimentalFrontRunningProtection\x88\x01\x01\x12/\n" + 660 | "\x10snipeTransaction\x18\t \x01(\bH\x02R\x10snipeTransaction\x88\x01\x01\x12+\n" + 661 | "\x0edisableRetries\x18\n" + 662 | " \x01(\bH\x03R\x0edisableRetries\x88\x01\x01\x12'\n" + 663 | "\frevertOnFail\x18\v \x01(\bH\x04R\frevertOnFail\x88\x01\x01B\x19\n" + 664 | "\x17_frontRunningProtectionB%\n" + 665 | "#_experimentalFrontRunningProtectionB\x13\n" + 666 | "\x11_snipeTransactionB\x11\n" + 667 | "\x0f_disableRetriesB\x0f\n" + 668 | "\r_revertOnFailJ\x04\b\x04\x10\x05J\x04\b\x06\x10\aJ\x04\b\a\x10\bR\x03tipR\ruseStakedRPCsR\x0efastBestEffort\"Y\n" + 669 | "\x16PostSubmitRequestEntry\x12?\n" + 670 | "\vtransaction\x18\x01 \x01(\v2\x17.api.TransactionMessageB\x04\xe2A\x01\x02R\vtransaction\"O\n" + 671 | "\x16PostSubmitBatchRequest\x125\n" + 672 | "\aentries\x18\x01 \x03(\v2\x1b.api.PostSubmitRequestEntryR\aentries\"2\n" + 673 | "\x12PostSubmitResponse\x12\x1c\n" + 674 | "\tsignature\x18\x01 \x01(\tR\tsignature\"L\n" + 675 | "\x12TransactionMessage\x12\x18\n" + 676 | "\acontent\x18\x01 \x01(\tR\acontent\x12\x1c\n" + 677 | "\tisCleanup\x18\x02 \x01(\bR\tisCleanup\"0\n" + 678 | "\x14TransactionMessageV2\x12\x18\n" + 679 | "\acontent\x18\x01 \x01(\tR\acontent2\xb6\x06\n" + 680 | "\x03Api\x12\x98\x01\n" + 681 | "\fPostSubmitV2\x12\x16.api.PostSubmitRequest\x1a\x17.api.PostSubmitResponse\"W\x92A;\n" + 682 | "\aGeneric\x12\x12Transaction submit\x1a\x1cSubmits a signed transaction\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/api/v2/submit\x12\xb8\x01\n" + 683 | "\x11PostSubmitBatchV2\x12\x1b.api.PostSubmitBatchRequest\x1a\x17.api.PostSubmitResponse\"m\x92AK\n" + 684 | "\aGeneric\x12\x18Transaction batch submit\x1a&Submits a batch of signed transactions\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/api/v2/submit-batch\x12\xa7\x01\n" + 685 | "\x04Ping\x12\x10.api.PingRequest\x1a\x11.api.PongResponse\"z\x92Ac\n" + 686 | "\aUtility\x12\x13Ping the API server\x1aCSimple ping endpoint to check API health and keep connections alive\x82\xd3\xe4\x93\x02\x0e\x12\f/api/v2/ping\x12\xa8\x01\n" + 687 | "\vGetTipFloor\x12\x14.api.TipFloorRequest\x1a\x15.api.TipFloorResponse\"l\x92AQ\n" + 688 | "\aUtility\x12\x11Get the tip floor\x1a3Endpoint to get the last 5 minutes tip distribution\x82\xd3\xe4\x93\x02\x12\x12\x10/api/v2/tipfloor\x12E\n" + 689 | "\x0eStreamTipFloor\x12\x1a.api.TipFloorStreamRequest\x1a\x15.api.TipFloorResponse0\x01\x1a=\x92A:\x1a8\n" + 690 | "\x1aDetailed API documentation\x12\x1ahttps://docs.nextblock.io/B\x9c\x02\x92A\xfe\x01\x12\x9e\x01\n" + 691 | "\x14NextBlock Solana API\x12-API for fastest tx delivery in all of solana.\"R\n" + 692 | "\x1eNextBlock.IO API Documentation\x12\x1ahttps://docs.nextblock.io/\x1a\x14support@nextblock.io2\x031.02\x10application/json:\x10application/jsonZ$\n" + 693 | "\"\n" + 694 | "\vAuth Header\x12\x13\b\x02\x1a\rAuthorization \x02b\x11\n" + 695 | "\x0f\n" + 696 | "\vAuth Header\x12\x00Z\x18github.com/nextblock/apib\x06proto3" 697 | 698 | var ( 699 | file_api_proto_rawDescOnce sync.Once 700 | file_api_proto_rawDescData []byte 701 | ) 702 | 703 | func file_api_proto_rawDescGZIP() []byte { 704 | file_api_proto_rawDescOnce.Do(func() { 705 | file_api_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_proto_rawDesc), len(file_api_proto_rawDesc))) 706 | }) 707 | return file_api_proto_rawDescData 708 | } 709 | 710 | var file_api_proto_msgTypes = make([]protoimpl.MessageInfo, 12) 711 | var file_api_proto_goTypes = []any{ 712 | (*TipFloorRequest)(nil), // 0: api.TipFloorRequest 713 | (*TipFloorStreamRequest)(nil), // 1: api.TipFloorStreamRequest 714 | (*TipStats)(nil), // 2: api.TipStats 715 | (*TipFloorResponse)(nil), // 3: api.TipFloorResponse 716 | (*PingRequest)(nil), // 4: api.PingRequest 717 | (*PongResponse)(nil), // 5: api.PongResponse 718 | (*PostSubmitRequest)(nil), // 6: api.PostSubmitRequest 719 | (*PostSubmitRequestEntry)(nil), // 7: api.PostSubmitRequestEntry 720 | (*PostSubmitBatchRequest)(nil), // 8: api.PostSubmitBatchRequest 721 | (*PostSubmitResponse)(nil), // 9: api.PostSubmitResponse 722 | (*TransactionMessage)(nil), // 10: api.TransactionMessage 723 | (*TransactionMessageV2)(nil), // 11: api.TransactionMessageV2 724 | } 725 | var file_api_proto_depIdxs = []int32{ 726 | 2, // 0: api.TipFloorResponse.stats:type_name -> api.TipStats 727 | 10, // 1: api.PostSubmitRequest.transaction:type_name -> api.TransactionMessage 728 | 10, // 2: api.PostSubmitRequestEntry.transaction:type_name -> api.TransactionMessage 729 | 7, // 3: api.PostSubmitBatchRequest.entries:type_name -> api.PostSubmitRequestEntry 730 | 6, // 4: api.Api.PostSubmitV2:input_type -> api.PostSubmitRequest 731 | 8, // 5: api.Api.PostSubmitBatchV2:input_type -> api.PostSubmitBatchRequest 732 | 4, // 6: api.Api.Ping:input_type -> api.PingRequest 733 | 0, // 7: api.Api.GetTipFloor:input_type -> api.TipFloorRequest 734 | 1, // 8: api.Api.StreamTipFloor:input_type -> api.TipFloorStreamRequest 735 | 9, // 9: api.Api.PostSubmitV2:output_type -> api.PostSubmitResponse 736 | 9, // 10: api.Api.PostSubmitBatchV2:output_type -> api.PostSubmitResponse 737 | 5, // 11: api.Api.Ping:output_type -> api.PongResponse 738 | 3, // 12: api.Api.GetTipFloor:output_type -> api.TipFloorResponse 739 | 3, // 13: api.Api.StreamTipFloor:output_type -> api.TipFloorResponse 740 | 9, // [9:14] is the sub-list for method output_type 741 | 4, // [4:9] is the sub-list for method input_type 742 | 4, // [4:4] is the sub-list for extension type_name 743 | 4, // [4:4] is the sub-list for extension extendee 744 | 0, // [0:4] is the sub-list for field type_name 745 | } 746 | 747 | func init() { file_api_proto_init() } 748 | func file_api_proto_init() { 749 | if File_api_proto != nil { 750 | return 751 | } 752 | file_api_proto_msgTypes[6].OneofWrappers = []any{} 753 | type x struct{} 754 | out := protoimpl.TypeBuilder{ 755 | File: protoimpl.DescBuilder{ 756 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 757 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_proto_rawDesc), len(file_api_proto_rawDesc)), 758 | NumEnums: 0, 759 | NumMessages: 12, 760 | NumExtensions: 0, 761 | NumServices: 1, 762 | }, 763 | GoTypes: file_api_proto_goTypes, 764 | DependencyIndexes: file_api_proto_depIdxs, 765 | MessageInfos: file_api_proto_msgTypes, 766 | }.Build() 767 | File_api_proto = out.File 768 | file_api_proto_goTypes = nil 769 | file_api_proto_depIdxs = nil 770 | } 771 | -------------------------------------------------------------------------------- /generated/api_grpc.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 | // versions: 3 | // - protoc-gen-go-grpc v1.3.0 4 | // - protoc v5.29.3 5 | // source: api.proto 6 | 7 | package api 8 | 9 | import ( 10 | context "context" 11 | grpc "google.golang.org/grpc" 12 | codes "google.golang.org/grpc/codes" 13 | status "google.golang.org/grpc/status" 14 | ) 15 | 16 | // This is a compile-time assertion to ensure that this generated file 17 | // is compatible with the grpc package it is being compiled against. 18 | // Requires gRPC-Go v1.32.0 or later. 19 | const _ = grpc.SupportPackageIsVersion7 20 | 21 | const ( 22 | Api_PostSubmitV2_FullMethodName = "/api.Api/PostSubmitV2" 23 | Api_PostSubmitBatchV2_FullMethodName = "/api.Api/PostSubmitBatchV2" 24 | Api_Ping_FullMethodName = "/api.Api/Ping" 25 | Api_GetTipFloor_FullMethodName = "/api.Api/GetTipFloor" 26 | Api_StreamTipFloor_FullMethodName = "/api.Api/StreamTipFloor" 27 | ) 28 | 29 | // ApiClient is the client API for Api service. 30 | // 31 | // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 32 | type ApiClient interface { 33 | PostSubmitV2(ctx context.Context, in *PostSubmitRequest, opts ...grpc.CallOption) (*PostSubmitResponse, error) 34 | PostSubmitBatchV2(ctx context.Context, in *PostSubmitBatchRequest, opts ...grpc.CallOption) (*PostSubmitResponse, error) 35 | Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) 36 | GetTipFloor(ctx context.Context, in *TipFloorRequest, opts ...grpc.CallOption) (*TipFloorResponse, error) 37 | StreamTipFloor(ctx context.Context, in *TipFloorStreamRequest, opts ...grpc.CallOption) (Api_StreamTipFloorClient, error) 38 | } 39 | 40 | type apiClient struct { 41 | cc grpc.ClientConnInterface 42 | } 43 | 44 | func NewApiClient(cc grpc.ClientConnInterface) ApiClient { 45 | return &apiClient{cc} 46 | } 47 | 48 | func (c *apiClient) PostSubmitV2(ctx context.Context, in *PostSubmitRequest, opts ...grpc.CallOption) (*PostSubmitResponse, error) { 49 | out := new(PostSubmitResponse) 50 | err := c.cc.Invoke(ctx, Api_PostSubmitV2_FullMethodName, in, out, opts...) 51 | if err != nil { 52 | return nil, err 53 | } 54 | return out, nil 55 | } 56 | 57 | func (c *apiClient) PostSubmitBatchV2(ctx context.Context, in *PostSubmitBatchRequest, opts ...grpc.CallOption) (*PostSubmitResponse, error) { 58 | out := new(PostSubmitResponse) 59 | err := c.cc.Invoke(ctx, Api_PostSubmitBatchV2_FullMethodName, in, out, opts...) 60 | if err != nil { 61 | return nil, err 62 | } 63 | return out, nil 64 | } 65 | 66 | func (c *apiClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) { 67 | out := new(PongResponse) 68 | err := c.cc.Invoke(ctx, Api_Ping_FullMethodName, in, out, opts...) 69 | if err != nil { 70 | return nil, err 71 | } 72 | return out, nil 73 | } 74 | 75 | func (c *apiClient) GetTipFloor(ctx context.Context, in *TipFloorRequest, opts ...grpc.CallOption) (*TipFloorResponse, error) { 76 | out := new(TipFloorResponse) 77 | err := c.cc.Invoke(ctx, Api_GetTipFloor_FullMethodName, in, out, opts...) 78 | if err != nil { 79 | return nil, err 80 | } 81 | return out, nil 82 | } 83 | 84 | func (c *apiClient) StreamTipFloor(ctx context.Context, in *TipFloorStreamRequest, opts ...grpc.CallOption) (Api_StreamTipFloorClient, error) { 85 | stream, err := c.cc.NewStream(ctx, &Api_ServiceDesc.Streams[0], Api_StreamTipFloor_FullMethodName, opts...) 86 | if err != nil { 87 | return nil, err 88 | } 89 | x := &apiStreamTipFloorClient{stream} 90 | if err := x.ClientStream.SendMsg(in); err != nil { 91 | return nil, err 92 | } 93 | if err := x.ClientStream.CloseSend(); err != nil { 94 | return nil, err 95 | } 96 | return x, nil 97 | } 98 | 99 | type Api_StreamTipFloorClient interface { 100 | Recv() (*TipFloorResponse, error) 101 | grpc.ClientStream 102 | } 103 | 104 | type apiStreamTipFloorClient struct { 105 | grpc.ClientStream 106 | } 107 | 108 | func (x *apiStreamTipFloorClient) Recv() (*TipFloorResponse, error) { 109 | m := new(TipFloorResponse) 110 | if err := x.ClientStream.RecvMsg(m); err != nil { 111 | return nil, err 112 | } 113 | return m, nil 114 | } 115 | 116 | // ApiServer is the server API for Api service. 117 | // All implementations must embed UnimplementedApiServer 118 | // for forward compatibility 119 | type ApiServer interface { 120 | PostSubmitV2(context.Context, *PostSubmitRequest) (*PostSubmitResponse, error) 121 | PostSubmitBatchV2(context.Context, *PostSubmitBatchRequest) (*PostSubmitResponse, error) 122 | Ping(context.Context, *PingRequest) (*PongResponse, error) 123 | GetTipFloor(context.Context, *TipFloorRequest) (*TipFloorResponse, error) 124 | StreamTipFloor(*TipFloorStreamRequest, Api_StreamTipFloorServer) error 125 | mustEmbedUnimplementedApiServer() 126 | } 127 | 128 | // UnimplementedApiServer must be embedded to have forward compatible implementations. 129 | type UnimplementedApiServer struct { 130 | } 131 | 132 | func (UnimplementedApiServer) PostSubmitV2(context.Context, *PostSubmitRequest) (*PostSubmitResponse, error) { 133 | return nil, status.Errorf(codes.Unimplemented, "method PostSubmitV2 not implemented") 134 | } 135 | func (UnimplementedApiServer) PostSubmitBatchV2(context.Context, *PostSubmitBatchRequest) (*PostSubmitResponse, error) { 136 | return nil, status.Errorf(codes.Unimplemented, "method PostSubmitBatchV2 not implemented") 137 | } 138 | func (UnimplementedApiServer) Ping(context.Context, *PingRequest) (*PongResponse, error) { 139 | return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") 140 | } 141 | func (UnimplementedApiServer) GetTipFloor(context.Context, *TipFloorRequest) (*TipFloorResponse, error) { 142 | return nil, status.Errorf(codes.Unimplemented, "method GetTipFloor not implemented") 143 | } 144 | func (UnimplementedApiServer) StreamTipFloor(*TipFloorStreamRequest, Api_StreamTipFloorServer) error { 145 | return status.Errorf(codes.Unimplemented, "method StreamTipFloor not implemented") 146 | } 147 | func (UnimplementedApiServer) mustEmbedUnimplementedApiServer() {} 148 | 149 | // UnsafeApiServer may be embedded to opt out of forward compatibility for this service. 150 | // Use of this interface is not recommended, as added methods to ApiServer will 151 | // result in compilation errors. 152 | type UnsafeApiServer interface { 153 | mustEmbedUnimplementedApiServer() 154 | } 155 | 156 | func RegisterApiServer(s grpc.ServiceRegistrar, srv ApiServer) { 157 | s.RegisterService(&Api_ServiceDesc, srv) 158 | } 159 | 160 | func _Api_PostSubmitV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 161 | in := new(PostSubmitRequest) 162 | if err := dec(in); err != nil { 163 | return nil, err 164 | } 165 | if interceptor == nil { 166 | return srv.(ApiServer).PostSubmitV2(ctx, in) 167 | } 168 | info := &grpc.UnaryServerInfo{ 169 | Server: srv, 170 | FullMethod: Api_PostSubmitV2_FullMethodName, 171 | } 172 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 173 | return srv.(ApiServer).PostSubmitV2(ctx, req.(*PostSubmitRequest)) 174 | } 175 | return interceptor(ctx, in, info, handler) 176 | } 177 | 178 | func _Api_PostSubmitBatchV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 179 | in := new(PostSubmitBatchRequest) 180 | if err := dec(in); err != nil { 181 | return nil, err 182 | } 183 | if interceptor == nil { 184 | return srv.(ApiServer).PostSubmitBatchV2(ctx, in) 185 | } 186 | info := &grpc.UnaryServerInfo{ 187 | Server: srv, 188 | FullMethod: Api_PostSubmitBatchV2_FullMethodName, 189 | } 190 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 191 | return srv.(ApiServer).PostSubmitBatchV2(ctx, req.(*PostSubmitBatchRequest)) 192 | } 193 | return interceptor(ctx, in, info, handler) 194 | } 195 | 196 | func _Api_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 197 | in := new(PingRequest) 198 | if err := dec(in); err != nil { 199 | return nil, err 200 | } 201 | if interceptor == nil { 202 | return srv.(ApiServer).Ping(ctx, in) 203 | } 204 | info := &grpc.UnaryServerInfo{ 205 | Server: srv, 206 | FullMethod: Api_Ping_FullMethodName, 207 | } 208 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 209 | return srv.(ApiServer).Ping(ctx, req.(*PingRequest)) 210 | } 211 | return interceptor(ctx, in, info, handler) 212 | } 213 | 214 | func _Api_GetTipFloor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 215 | in := new(TipFloorRequest) 216 | if err := dec(in); err != nil { 217 | return nil, err 218 | } 219 | if interceptor == nil { 220 | return srv.(ApiServer).GetTipFloor(ctx, in) 221 | } 222 | info := &grpc.UnaryServerInfo{ 223 | Server: srv, 224 | FullMethod: Api_GetTipFloor_FullMethodName, 225 | } 226 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 227 | return srv.(ApiServer).GetTipFloor(ctx, req.(*TipFloorRequest)) 228 | } 229 | return interceptor(ctx, in, info, handler) 230 | } 231 | 232 | func _Api_StreamTipFloor_Handler(srv interface{}, stream grpc.ServerStream) error { 233 | m := new(TipFloorStreamRequest) 234 | if err := stream.RecvMsg(m); err != nil { 235 | return err 236 | } 237 | return srv.(ApiServer).StreamTipFloor(m, &apiStreamTipFloorServer{stream}) 238 | } 239 | 240 | type Api_StreamTipFloorServer interface { 241 | Send(*TipFloorResponse) error 242 | grpc.ServerStream 243 | } 244 | 245 | type apiStreamTipFloorServer struct { 246 | grpc.ServerStream 247 | } 248 | 249 | func (x *apiStreamTipFloorServer) Send(m *TipFloorResponse) error { 250 | return x.ServerStream.SendMsg(m) 251 | } 252 | 253 | // Api_ServiceDesc is the grpc.ServiceDesc for Api service. 254 | // It's only intended for direct use with grpc.RegisterService, 255 | // and not to be introspected or modified (even as a copy) 256 | var Api_ServiceDesc = grpc.ServiceDesc{ 257 | ServiceName: "api.Api", 258 | HandlerType: (*ApiServer)(nil), 259 | Methods: []grpc.MethodDesc{ 260 | { 261 | MethodName: "PostSubmitV2", 262 | Handler: _Api_PostSubmitV2_Handler, 263 | }, 264 | { 265 | MethodName: "PostSubmitBatchV2", 266 | Handler: _Api_PostSubmitBatchV2_Handler, 267 | }, 268 | { 269 | MethodName: "Ping", 270 | Handler: _Api_Ping_Handler, 271 | }, 272 | { 273 | MethodName: "GetTipFloor", 274 | Handler: _Api_GetTipFloor_Handler, 275 | }, 276 | }, 277 | Streams: []grpc.StreamDesc{ 278 | { 279 | StreamName: "StreamTipFloor", 280 | Handler: _Api_StreamTipFloor_Handler, 281 | ServerStreams: true, 282 | }, 283 | }, 284 | Metadata: "api.proto", 285 | } 286 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module nextblock-proto 2 | 3 | go 1.24.2 4 | 5 | require ( 6 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 7 | google.golang.org/genproto/googleapis/api v0.0.0-20250422160041-2d3770c4ea7f 8 | google.golang.org/grpc v1.72.0 9 | google.golang.org/protobuf v1.36.6 10 | ) 11 | 12 | require ( 13 | golang.org/x/net v0.39.0 // indirect 14 | golang.org/x/sys v0.32.0 // indirect 15 | golang.org/x/text v0.24.0 // indirect 16 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f // indirect 17 | ) 18 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 2 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 3 | github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= 4 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 h1:ad0vkEBuk23VJzZR9nkLVG0YAoN9coASF1GusYX6AlU= 5 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0/go.mod h1:igFoXX2ELCW06bol23DWPB5BEWfZISOzSP5K2sbLea0= 6 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= 7 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= 8 | golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= 9 | golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= 10 | golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= 11 | golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 12 | golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= 13 | golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= 14 | golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= 15 | golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= 16 | golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= 17 | golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= 18 | golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= 19 | golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 20 | golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 21 | golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= 22 | golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 23 | golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= 24 | golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 25 | golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= 26 | golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 27 | golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= 28 | golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= 29 | golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= 30 | golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= 31 | golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= 32 | golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= 33 | golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= 34 | golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= 35 | google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= 36 | google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= 37 | google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= 38 | google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= 39 | google.golang.org/genproto/googleapis/api v0.0.0-20250313205543-e70fdf4c4cb4 h1:IFnXJq3UPB3oBREOodn1v1aGQeZYQclEmvWRMN0PSsY= 40 | google.golang.org/genproto/googleapis/api v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:c8q6Z6OCqnfVIqUFJkCzKcrj8eCvUrz+K4KRzSTuANg= 41 | google.golang.org/genproto/googleapis/api v0.0.0-20250422160041-2d3770c4ea7f h1:tjZsroqekhC63+WMqzmWyW5Twj/ZfR5HAlpd5YQ1Vs0= 42 | google.golang.org/genproto/googleapis/api v0.0.0-20250422160041-2d3770c4ea7f/go.mod h1:Cd8IzgPo5Akum2c9R6FsXNaZbH3Jpa2gpHlW89FqlyQ= 43 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI= 44 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= 45 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= 46 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= 47 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4= 48 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I= 49 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 h1:iK2jbkWL86DXjEx0qiHcRE9dE4/Ahua5k6V8OWFb//c= 50 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I= 51 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= 52 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f h1:N/PrbTw4kdkqNRzVfWPrBekzLuarFREcbFOiOLkXon4= 53 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= 54 | google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= 55 | google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= 56 | google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw= 57 | google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg= 58 | google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= 59 | google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= 60 | google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= 61 | google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= 62 | google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 63 | google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= 64 | google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 65 | google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= 66 | google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= 67 | -------------------------------------------------------------------------------- /proto/api.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package api; 3 | option go_package = "github.com/nextblock/api"; 4 | 5 | import "google/api/annotations.proto"; 6 | import "google/api/field_behavior.proto"; 7 | import "protoc-gen-openapiv2/options/annotations.proto"; 8 | 9 | option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { 10 | security: { 11 | security_requirement: { 12 | key: "Auth Header"; 13 | value: { 14 | scope: [] 15 | } 16 | } 17 | } 18 | security_definitions: { 19 | security: { 20 | key: "Auth Header"; 21 | value: { 22 | type: TYPE_API_KEY; 23 | in: IN_HEADER; 24 | name: "Authorization"; 25 | }; 26 | } 27 | }; 28 | info: { 29 | title: "NextBlock Solana API"; 30 | version: "1.0"; 31 | description: "API for fastest tx delivery in all of solana."; 32 | contact: { 33 | name: "NextBlock.IO API Documentation"; 34 | url: "https://docs.nextblock.io/"; 35 | email: "support@nextblock.io"; 36 | }; 37 | }; 38 | 39 | consumes: "application/json"; 40 | produces: "application/json"; 41 | }; 42 | 43 | service Api { 44 | option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = { 45 | external_docs: { 46 | description: "Detailed API documentation"; 47 | url: "https://docs.nextblock.io/" 48 | } 49 | }; 50 | 51 | rpc PostSubmitV2(PostSubmitRequest) returns (PostSubmitResponse) { 52 | option (google.api.http) = { 53 | post: "/api/v2/submit" 54 | body: "*" 55 | }; 56 | option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { 57 | description: "Submits a signed transaction"; 58 | summary: "Transaction submit"; 59 | tags: ["Generic"]; 60 | }; 61 | } 62 | 63 | rpc PostSubmitBatchV2(PostSubmitBatchRequest) returns (PostSubmitResponse) { 64 | option (google.api.http) = { 65 | post: "/api/v2/submit-batch" 66 | body: "*" 67 | }; 68 | option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { 69 | description: "Submits a batch of signed transactions"; 70 | summary: "Transaction batch submit"; 71 | tags: ["Generic"]; 72 | }; 73 | } 74 | 75 | rpc Ping(PingRequest) returns (PongResponse) { 76 | option (google.api.http) = { 77 | get: "/api/v2/ping" 78 | }; 79 | option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { 80 | description: "Simple ping endpoint to check API health and keep connections alive"; 81 | summary: "Ping the API server"; 82 | tags: ["Utility"]; 83 | }; 84 | } 85 | 86 | rpc GetTipFloor(TipFloorRequest) returns (TipFloorResponse) { 87 | option (google.api.http) = { 88 | get: "/api/v2/tipfloor" 89 | }; 90 | option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { 91 | description: "Endpoint to get the last 5 minutes tip distribution"; 92 | summary: "Get the tip floor"; 93 | tags: ["Utility"]; 94 | }; 95 | } 96 | 97 | rpc StreamTipFloor(TipFloorStreamRequest) returns (stream TipFloorResponse); 98 | } 99 | 100 | message TipFloorRequest {} 101 | 102 | message TipFloorStreamRequest { 103 | string update_frequency = 1; // e.g. "1m", "5m", "10m" 104 | } 105 | 106 | message TipStats { 107 | string time = 1; 108 | double landed_tips_25th_percentile = 2; 109 | double landed_tips_50th_percentile = 3; 110 | double landed_tips_75th_percentile = 4; 111 | double landed_tips_95th_percentile = 5; 112 | double landed_tips_99th_percentile = 6; 113 | double ema_landed_tips_50th_percentile = 7; 114 | } 115 | 116 | message TipFloorResponse { 117 | repeated TipStats stats = 1; 118 | } 119 | 120 | // Add these message definitions 121 | message PingRequest {} 122 | 123 | message PongResponse {} 124 | 125 | message PostSubmitRequest { 126 | TransactionMessage transaction = 1 [(google.api.field_behavior) = REQUIRED]; 127 | bool skipPreFlight = 2; 128 | optional bool frontRunningProtection = 3; 129 | reserved 4, 6, 7; 130 | reserved "tip", "useStakedRPCs", "fastBestEffort"; 131 | optional bool experimentalFrontRunningProtection = 8; 132 | optional bool snipeTransaction = 9; 133 | optional bool disableRetries = 10; 134 | optional bool revertOnFail = 11; 135 | } 136 | 137 | message PostSubmitRequestEntry { 138 | TransactionMessage transaction = 1 [(google.api.field_behavior) = REQUIRED]; 139 | } 140 | 141 | message PostSubmitBatchRequest { 142 | repeated PostSubmitRequestEntry entries = 1; 143 | } 144 | 145 | message PostSubmitResponse { 146 | string signature = 1; 147 | } 148 | 149 | message TransactionMessage { 150 | string content = 1; 151 | bool isCleanup = 2; 152 | } 153 | 154 | message TransactionMessageV2 { 155 | string content = 1; 156 | } -------------------------------------------------------------------------------- /proto/google/api/annotations.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | 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 | } -------------------------------------------------------------------------------- /proto/google/api/field_behavior.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 | import "google/protobuf/descriptor.proto"; 20 | 21 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; 22 | option java_multiple_files = true; 23 | option java_outer_classname = "FieldBehaviorProto"; 24 | option java_package = "com.google.api"; 25 | option objc_class_prefix = "GAPI"; 26 | 27 | extend google.protobuf.FieldOptions { 28 | // A designation of a specific field behavior (required, output only, etc.) 29 | // in protobuf messages. 30 | // 31 | // Examples: 32 | // 33 | // string name = 1 [(google.api.field_behavior) = REQUIRED]; 34 | // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 35 | // google.protobuf.Duration ttl = 1 36 | // [(google.api.field_behavior) = INPUT_ONLY]; 37 | // google.protobuf.Timestamp expire_time = 1 38 | // [(google.api.field_behavior) = OUTPUT_ONLY, 39 | // (google.api.field_behavior) = IMMUTABLE]; 40 | repeated google.api.FieldBehavior field_behavior = 1052; 41 | } 42 | 43 | // An indicator of the behavior of a given field (for example, that a field 44 | // is required in requests, or given as output but ignored as input). 45 | // This **does not** change the behavior in protocol buffers itself; it only 46 | // denotes the behavior and may affect how API tooling handles the field. 47 | // 48 | // Note: This enum **may** receive new values in the future. 49 | enum FieldBehavior { 50 | // Conventional default for enums. Do not use this. 51 | FIELD_BEHAVIOR_UNSPECIFIED = 0; 52 | 53 | // Specifically denotes a field as optional. 54 | // While all fields in protocol buffers are optional, this may be specified 55 | // for emphasis if appropriate. 56 | OPTIONAL = 1; 57 | 58 | // Denotes a field as required. 59 | // This indicates that the field **must** be provided as part of the request, 60 | // and failure to do so will cause an error (usually `INVALID_ARGUMENT`). 61 | REQUIRED = 2; 62 | 63 | // Denotes a field as output only. 64 | // This indicates that the field is provided in responses, but including the 65 | // field in a request does nothing (the server *must* ignore it and 66 | // *must not* throw an error as a result of the field's presence). 67 | OUTPUT_ONLY = 3; 68 | 69 | // Denotes a field as input only. 70 | // This indicates that the field is provided in requests, and the 71 | // corresponding field is not included in output. 72 | INPUT_ONLY = 4; 73 | 74 | // Denotes a field as immutable. 75 | // This indicates that the field may be set once in a request to create a 76 | // resource, but may not be changed thereafter. 77 | IMMUTABLE = 5; 78 | 79 | // Denotes that a (repeated) field is an unordered list. 80 | // This indicates that the service may provide the elements of the list 81 | // in any arbitrary order, rather than the order the user originally 82 | // provided. Additionally, the list's order may or may not be stable. 83 | UNORDERED_LIST = 6; 84 | 85 | // Denotes that this field returns a non-empty default value if not set. 86 | // This indicates that if the user provides the empty value in a request, 87 | // a non-empty value will be returned. The user will not be aware of what 88 | // non-empty value to expect. 89 | NON_EMPTY_DEFAULT = 7; 90 | } -------------------------------------------------------------------------------- /proto/google/api/http.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // Defines the HTTP configuration for an API service. It contains a list of 27 | // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method 28 | // to one or more HTTP REST API methods. 29 | message Http { 30 | // A list of HTTP configuration rules that apply to individual API methods. 31 | // 32 | // **NOTE:** All service configuration rules follow "last one wins" order. 33 | repeated HttpRule rules = 1; 34 | 35 | // When set to true, URL path parameters will be fully URI-decoded except in 36 | // cases of single segment matches in reserved expansion, where "%2F" will be 37 | // left encoded. 38 | // 39 | // The default behavior is to not decode RFC 6570 reserved characters in multi 40 | // segment matches. 41 | bool fully_decode_reserved_expansion = 2; 42 | } 43 | 44 | // # gRPC Transcoding 45 | // 46 | // gRPC Transcoding is a feature for mapping between a gRPC method and one or 47 | // more HTTP REST endpoints. It allows developers to build a single API service 48 | // that supports both gRPC APIs and REST APIs. Many systems, including [Google 49 | // APIs](https://github.com/googleapis/googleapis), 50 | // [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC 51 | // Gateway](https://github.com/grpc-ecosystem/grpc-gateway), 52 | // and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature 53 | // and use it for large scale production services. 54 | // 55 | // `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies 56 | // how different portions of the gRPC request message are mapped to the URL 57 | // path, URL query parameters, and HTTP request body. It also controls how the 58 | // gRPC response message is mapped to the HTTP response body. `HttpRule` is 59 | // typically specified as an `google.api.http` annotation on the gRPC method. 60 | // 61 | // Each mapping specifies a URL path template and an HTTP method. The path 62 | // template may refer to one or more fields in the gRPC request message, as long 63 | // as each field is a non-repeated field with a primitive (non-message) type. 64 | // The path template controls how fields of the request message are mapped to 65 | // the URL path. 66 | // 67 | // Example: 68 | // 69 | // service Messaging { 70 | // rpc GetMessage(GetMessageRequest) returns (Message) { 71 | // option (google.api.http) = { 72 | // get: "/v1/{name=messages/*}" 73 | // }; 74 | // } 75 | // } 76 | // message GetMessageRequest { 77 | // string name = 1; // Mapped to URL path. 78 | // } 79 | // message Message { 80 | // string text = 1; // The resource content. 81 | // } 82 | // 83 | // This enables an HTTP REST to gRPC mapping as below: 84 | // 85 | // HTTP | gRPC 86 | // -----|----- 87 | // `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` 88 | // 89 | // Any fields in the request message which are not bound by the path template 90 | // automatically become HTTP query parameters if there is no HTTP request body. 91 | // For example: 92 | // 93 | // service Messaging { 94 | // rpc GetMessage(GetMessageRequest) returns (Message) { 95 | // option (google.api.http) = { 96 | // get:"/v1/messages/{message_id}" 97 | // }; 98 | // } 99 | // } 100 | // message GetMessageRequest { 101 | // message SubMessage { 102 | // string subfield = 1; 103 | // } 104 | // string message_id = 1; // Mapped to URL path. 105 | // int64 revision = 2; // Mapped to URL query parameter `revision`. 106 | // SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. 107 | // } 108 | // 109 | // This enables a HTTP JSON to RPC mapping as below: 110 | // 111 | // HTTP | gRPC 112 | // -----|----- 113 | // `GET /v1/messages/123456?revision=2&sub.subfield=foo` | 114 | // `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: 115 | // "foo"))` 116 | // 117 | // Note that fields which are mapped to URL query parameters must have a 118 | // primitive type or a repeated primitive type or a non-repeated message type. 119 | // In the case of a repeated type, the parameter can be repeated in the URL 120 | // as `...?param=A¶m=B`. In the case of a message type, each field of the 121 | // message is mapped to a separate parameter, such as 122 | // `...?foo.a=A&foo.b=B&foo.c=C`. 123 | // 124 | // For HTTP methods that allow a request body, the `body` field 125 | // specifies the mapping. Consider a REST update method on the 126 | // message resource collection: 127 | // 128 | // service Messaging { 129 | // rpc UpdateMessage(UpdateMessageRequest) returns (Message) { 130 | // option (google.api.http) = { 131 | // patch: "/v1/messages/{message_id}" 132 | // body: "message" 133 | // }; 134 | // } 135 | // } 136 | // message UpdateMessageRequest { 137 | // string message_id = 1; // mapped to the URL 138 | // Message message = 2; // mapped to the body 139 | // } 140 | // 141 | // The following HTTP JSON to RPC mapping is enabled, where the 142 | // representation of the JSON in the request body is determined by 143 | // protos JSON encoding: 144 | // 145 | // HTTP | gRPC 146 | // -----|----- 147 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: 148 | // "123456" message { text: "Hi!" })` 149 | // 150 | // The special name `*` can be used in the body mapping to define that 151 | // every field not bound by the path template should be mapped to the 152 | // request body. This enables the following alternative definition of 153 | // the update method: 154 | // 155 | // service Messaging { 156 | // rpc UpdateMessage(Message) returns (Message) { 157 | // option (google.api.http) = { 158 | // patch: "/v1/messages/{message_id}" 159 | // body: "*" 160 | // }; 161 | // } 162 | // } 163 | // message Message { 164 | // string message_id = 1; 165 | // string text = 2; 166 | // } 167 | // 168 | // 169 | // The following HTTP JSON to RPC mapping is enabled: 170 | // 171 | // HTTP | gRPC 172 | // -----|----- 173 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: 174 | // "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 when 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 | // This enables the following two alternative HTTP JSON to RPC mappings: 201 | // 202 | // HTTP | gRPC 203 | // -----|----- 204 | // `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` 205 | // `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: 206 | // "123456")` 207 | // 208 | // ## Rules for HTTP mapping 209 | // 210 | // 1. Leaf request fields (recursive expansion nested messages in the request 211 | // message) are classified into three categories: 212 | // - Fields referred by the path template. They are passed via the URL path. 213 | // - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP 214 | // request body. 215 | // - All other fields are passed via the URL query parameters, and the 216 | // parameter name is the field path in the request message. A repeated 217 | // field can be represented as multiple query parameters under the same 218 | // name. 219 | // 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields 220 | // are passed via URL path and HTTP request body. 221 | // 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all 222 | // fields are passed via URL path and URL query parameters. 223 | // 224 | // ### Path template syntax 225 | // 226 | // Template = "/" Segments [ Verb ] ; 227 | // Segments = Segment { "/" Segment } ; 228 | // Segment = "*" | "**" | LITERAL | Variable ; 229 | // Variable = "{" FieldPath [ "=" Segments ] "}" ; 230 | // FieldPath = IDENT { "." IDENT } ; 231 | // Verb = ":" LITERAL ; 232 | // 233 | // The syntax `*` matches a single URL path segment. The syntax `**` matches 234 | // zero or more URL path segments, which must be the last part of the URL path 235 | // except the `Verb`. 236 | // 237 | // The syntax `Variable` matches part of the URL path as specified by its 238 | // template. A variable template must not contain other variables. If a variable 239 | // matches a single path segment, its template may be omitted, e.g. `{var}` 240 | // is equivalent to `{var=*}`. 241 | // 242 | // The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` 243 | // contains any reserved character, such characters should be percent-encoded 244 | // before the matching. 245 | // 246 | // If a variable contains exactly one path segment, such as `"{var}"` or 247 | // `"{var=*}"`, when such a variable is expanded into a URL path on the client 248 | // side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The 249 | // server side does the reverse decoding. Such variables show up in the 250 | // [Discovery 251 | // Document](https://developers.google.com/discovery/v1/reference/apis) as 252 | // `{var}`. 253 | // 254 | // If a variable contains multiple path segments, such as `"{var=foo/*}"` 255 | // or `"{var=**}"`, when such a variable is expanded into a URL path on the 256 | // client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. 257 | // The server side does the reverse decoding, except "%2F" and "%2f" are left 258 | // unchanged. Such variables show up in the 259 | // [Discovery 260 | // Document](https://developers.google.com/discovery/v1/reference/apis) as 261 | // `{+var}`. 262 | // 263 | // ## Using gRPC API Service Configuration 264 | // 265 | // gRPC API Service Configuration (service config) is a configuration language 266 | // for configuring a gRPC service to become a user-facing product. The 267 | // service config is simply the YAML representation of the `google.api.Service` 268 | // proto message. 269 | // 270 | // As an alternative to annotating your proto file, you can configure gRPC 271 | // transcoding in your service config YAML files. You do this by specifying a 272 | // `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same 273 | // effect as the proto annotation. This can be particularly useful if you 274 | // have a proto that is reused in multiple services. Note that any transcoding 275 | // specified in the service config will override any matching transcoding 276 | // configuration in the proto. 277 | // 278 | // Example: 279 | // 280 | // http: 281 | // rules: 282 | // # Selects a gRPC method and applies HttpRule to it. 283 | // - selector: example.v1.Messaging.GetMessage 284 | // get: /v1/messages/{message_id}/{sub.subfield} 285 | // 286 | // ## Special notes 287 | // 288 | // When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the 289 | // proto to JSON conversion must follow the [proto3 290 | // specification](https://developers.google.com/protocol-buffers/docs/proto3#json). 291 | // 292 | // While the single segment variable follows the semantics of 293 | // [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String 294 | // Expansion, the multi segment variable **does not** follow RFC 6570 Section 295 | // 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion 296 | // does not expand special characters like `?` and `#`, which would lead 297 | // to invalid URLs. As the result, gRPC Transcoding uses a custom encoding 298 | // for multi segment variables. 299 | // 300 | // The path variables **must not** refer to any repeated or mapped field, 301 | // because client libraries are not capable of handling such variable expansion. 302 | // 303 | // The path variables **must not** capture the leading "/" character. The reason 304 | // is that the most common use case "{var}" does not capture the leading "/" 305 | // character. For consistency, all path variables must share the same behavior. 306 | // 307 | // Repeated message fields must not be mapped to URL query parameters, because 308 | // no client library can support such complicated mapping. 309 | // 310 | // If an API needs to use a JSON array for request or response body, it can map 311 | // the request or response body to a repeated field. However, some gRPC 312 | // Transcoding implementations may not support this feature. 313 | message HttpRule { 314 | // Selects a method to which this rule applies. 315 | // 316 | // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. 317 | string selector = 1; 318 | 319 | // Determines the URL pattern is matched by this rules. This pattern can be 320 | // used with any of the {get|put|post|delete|patch} methods. A custom method 321 | // can be defined using the 'custom' field. 322 | oneof pattern { 323 | // Maps to HTTP GET. Used for listing and getting information about 324 | // resources. 325 | string get = 2; 326 | 327 | // Maps to HTTP PUT. Used for replacing a resource. 328 | string put = 3; 329 | 330 | // Maps to HTTP POST. Used for creating a resource or performing an action. 331 | string post = 4; 332 | 333 | // Maps to HTTP DELETE. Used for deleting a resource. 334 | string delete = 5; 335 | 336 | // Maps to HTTP PATCH. Used for updating a resource. 337 | string patch = 6; 338 | 339 | // The custom pattern is used for specifying an HTTP method that is not 340 | // included in the `pattern` field, such as HEAD, or "*" to leave the 341 | // HTTP method unspecified for this rule. The wild-card rule is useful 342 | // for services that provide content to Web (HTML) clients. 343 | CustomHttpPattern custom = 8; 344 | } 345 | 346 | // The name of the request field whose value is mapped to the HTTP request 347 | // body, or `*` for mapping all request fields not captured by the path 348 | // pattern to the HTTP body, or omitted for not having any HTTP request body. 349 | // 350 | // NOTE: the referred field must be present at the top-level of the request 351 | // message type. 352 | string body = 7; 353 | 354 | // Optional. The name of the response field whose value is mapped to the HTTP 355 | // response body. When omitted, the entire response message will be used 356 | // as the HTTP response body. 357 | // 358 | // NOTE: The referred field must be present at the top-level of the response 359 | // message type. 360 | string response_body = 12; 361 | 362 | // Additional HTTP bindings for the selector. Nested bindings must 363 | // not contain an `additional_bindings` field themselves (that is, 364 | // the nesting may only be one level deep). 365 | repeated HttpRule additional_bindings = 11; 366 | } 367 | 368 | // A custom pattern is used for defining custom HTTP verb. 369 | message CustomHttpPattern { 370 | // The name of this custom HTTP verb. 371 | string kind = 1; 372 | 373 | // The path matched by this custom verb. 374 | string path = 2; 375 | } -------------------------------------------------------------------------------- /proto/google/api/httpbody.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | import "google/protobuf/any.proto"; 20 | 21 | option cc_enable_arenas = true; 22 | option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; 23 | option java_multiple_files = true; 24 | option java_outer_classname = "HttpBodyProto"; 25 | option java_package = "com.google.api"; 26 | option objc_class_prefix = "GAPI"; 27 | 28 | // Message that represents an arbitrary HTTP body. It should only be used for 29 | // payload formats that can't be represented as JSON, such as raw binary or 30 | // an HTML page. 31 | // 32 | // 33 | // This message can be used both in streaming and non-streaming API methods in 34 | // the request as well as the response. 35 | // 36 | // It can be used as a top-level request field, which is convenient if one 37 | // wants to extract parameters from either the URL or HTTP template into the 38 | // request fields and also want access to the raw HTTP body. 39 | // 40 | // Example: 41 | // 42 | // message GetResourceRequest { 43 | // // A unique request id. 44 | // string request_id = 1; 45 | // 46 | // // The raw HTTP body is bound to this field. 47 | // google.api.HttpBody http_body = 2; 48 | // 49 | // } 50 | // 51 | // service ResourceService { 52 | // rpc GetResource(GetResourceRequest) 53 | // returns (google.api.HttpBody); 54 | // rpc UpdateResource(google.api.HttpBody) 55 | // returns (google.protobuf.Empty); 56 | // 57 | // } 58 | // 59 | // Example with streaming methods: 60 | // 61 | // service CaldavService { 62 | // rpc GetCalendar(stream google.api.HttpBody) 63 | // returns (stream google.api.HttpBody); 64 | // rpc UpdateCalendar(stream google.api.HttpBody) 65 | // returns (stream google.api.HttpBody); 66 | // 67 | // } 68 | // 69 | // Use of this type only changes how the request and response bodies are 70 | // handled, all other features will continue to work unchanged. 71 | message HttpBody { 72 | // The HTTP Content-Type header value specifying the content type of the body. 73 | string content_type = 1; 74 | 75 | // The HTTP request/response body as raw binary. 76 | bytes data = 2; 77 | 78 | // Application specific response metadata. Must be set in the first response 79 | // for streaming APIs. 80 | repeated google.protobuf.Any extensions = 3; 81 | } -------------------------------------------------------------------------------- /proto/google/api/visibility.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2021 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 | import "google/protobuf/descriptor.proto"; 20 | 21 | option cc_enable_arenas = true; 22 | option go_package = "google.golang.org/genproto/googleapis/api/visibility;visibility"; 23 | option java_multiple_files = true; 24 | option java_outer_classname = "VisibilityProto"; 25 | option java_package = "com.google.api"; 26 | option objc_class_prefix = "GAPI"; 27 | 28 | extend google.protobuf.EnumOptions { 29 | // See `VisibilityRule`. 30 | google.api.VisibilityRule enum_visibility = 72295727; 31 | } 32 | 33 | extend google.protobuf.EnumValueOptions { 34 | // See `VisibilityRule`. 35 | google.api.VisibilityRule value_visibility = 72295727; 36 | } 37 | 38 | extend google.protobuf.FieldOptions { 39 | // See `VisibilityRule`. 40 | google.api.VisibilityRule field_visibility = 72295727; 41 | } 42 | 43 | extend google.protobuf.MessageOptions { 44 | // See `VisibilityRule`. 45 | google.api.VisibilityRule message_visibility = 72295727; 46 | } 47 | 48 | extend google.protobuf.MethodOptions { 49 | // See `VisibilityRule`. 50 | google.api.VisibilityRule method_visibility = 72295727; 51 | } 52 | 53 | extend google.protobuf.ServiceOptions { 54 | // See `VisibilityRule`. 55 | google.api.VisibilityRule api_visibility = 72295727; 56 | } 57 | 58 | // `Visibility` defines restrictions for the visibility of service 59 | // elements. Restrictions are specified using visibility labels 60 | // (e.g., PREVIEW) that are elsewhere linked to users and projects. 61 | // 62 | // Users and projects can have access to more than one visibility label. The 63 | // effective visibility for multiple labels is the union of each label's 64 | // elements, plus any unrestricted elements. 65 | // 66 | // If an element and its parents have no restrictions, visibility is 67 | // unconditionally granted. 68 | // 69 | // Example: 70 | // 71 | // visibility: 72 | // rules: 73 | // - selector: google.calendar.Calendar.EnhancedSearch 74 | // restriction: PREVIEW 75 | // - selector: google.calendar.Calendar.Delegate 76 | // restriction: INTERNAL 77 | // 78 | // Here, all methods are publicly visible except for the restricted methods 79 | // EnhancedSearch and Delegate. 80 | message Visibility { 81 | // A list of visibility rules that apply to individual API elements. 82 | // 83 | // **NOTE:** All service configuration rules follow "last one wins" order. 84 | repeated VisibilityRule rules = 1; 85 | } 86 | 87 | // A visibility rule provides visibility configuration for an individual API 88 | // element. 89 | message VisibilityRule { 90 | // Selects methods, messages, fields, enums, etc. to which this rule applies. 91 | // 92 | // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. 93 | string selector = 1; 94 | 95 | // A comma-separated list of visibility labels that apply to the `selector`. 96 | // Any of the listed labels can be used to grant the visibility. 97 | // 98 | // If a rule has multiple labels, removing one of the labels but not all of 99 | // them can break clients. 100 | // 101 | // Example: 102 | // 103 | // visibility: 104 | // rules: 105 | // - selector: google.calendar.Calendar.EnhancedSearch 106 | // restriction: INTERNAL, PREVIEW 107 | // 108 | // Removing INTERNAL from this restriction will break clients that rely on 109 | // this method and only had access to it through INTERNAL. 110 | string restriction = 2; 111 | } -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | // Clients can define custom options in extensions of this message. See above. 133 | extensions 1000 to max; 134 | } 135 | 136 | // Describes a field within a message. 137 | message FieldDescriptorProto { 138 | enum Type { 139 | // 0 is reserved for errors. 140 | // Order is weird for historical reasons. 141 | TYPE_DOUBLE = 1; 142 | TYPE_FLOAT = 2; 143 | // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if 144 | // negative values are likely. 145 | TYPE_INT64 = 3; 146 | TYPE_UINT64 = 4; 147 | // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if 148 | // negative values are likely. 149 | TYPE_INT32 = 5; 150 | TYPE_FIXED64 = 6; 151 | TYPE_FIXED32 = 7; 152 | TYPE_BOOL = 8; 153 | TYPE_STRING = 9; 154 | // Tag-delimited aggregate. 155 | // Group type is deprecated and not supported in proto3. However, Proto3 156 | // implementations should still be able to parse the group wire format and 157 | // treat group fields as unknown fields. 158 | TYPE_GROUP = 10; 159 | TYPE_MESSAGE = 11; // Length-delimited aggregate. 160 | 161 | // New in version 2. 162 | TYPE_BYTES = 12; 163 | TYPE_UINT32 = 13; 164 | TYPE_ENUM = 14; 165 | TYPE_SFIXED32 = 15; 166 | TYPE_SFIXED64 = 16; 167 | TYPE_SINT32 = 17; // Uses ZigZag encoding. 168 | TYPE_SINT64 = 18; // Uses ZigZag encoding. 169 | } 170 | 171 | enum Label { 172 | // 0 is reserved for errors 173 | LABEL_OPTIONAL = 1; 174 | LABEL_REQUIRED = 2; 175 | LABEL_REPEATED = 3; 176 | } 177 | 178 | optional string name = 1; 179 | optional int32 number = 3; 180 | optional Label label = 4; 181 | 182 | // If type_name is set, this need not be set. If both this and type_name 183 | // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. 184 | optional Type type = 5; 185 | 186 | // For message and enum types, this is the name of the type. If the name 187 | // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping 188 | // rules are used to find the type (i.e. first the nested types within this 189 | // message are searched, then within the parent, on up to the root 190 | // namespace). 191 | optional string type_name = 6; 192 | 193 | // For extensions, this is the name of the type being extended. It is 194 | // resolved in the same manner as type_name. 195 | optional string extendee = 2; 196 | 197 | // For numeric types, contains the original text representation of the value. 198 | // For booleans, "true" or "false". 199 | // For strings, contains the default text contents (not escaped in any way). 200 | // For bytes, contains the C escaped value. All bytes >= 128 are escaped. 201 | // TODO(kenton): Base-64 encode? 202 | optional string default_value = 7; 203 | 204 | // If set, gives the index of a oneof in the containing type's oneof_decl 205 | // list. This field is a member of that oneof. 206 | optional int32 oneof_index = 9; 207 | 208 | // JSON name of this field. The value is set by protocol compiler. If the 209 | // user has set a "json_name" option on this field, that option's value 210 | // will be used. Otherwise, it's deduced from the field's name by converting 211 | // it to camelCase. 212 | optional string json_name = 10; 213 | 214 | optional FieldOptions options = 8; 215 | } 216 | 217 | // Describes a oneof. 218 | message OneofDescriptorProto { 219 | optional string name = 1; 220 | optional OneofOptions options = 2; 221 | } 222 | 223 | // Describes an enum type. 224 | message EnumDescriptorProto { 225 | optional string name = 1; 226 | 227 | repeated EnumValueDescriptorProto value = 2; 228 | 229 | optional EnumOptions options = 3; 230 | 231 | // Range of reserved numeric values. Reserved values may not be used by 232 | // entries in the same enum. Reserved ranges may not overlap. 233 | // 234 | // Note that this is distinct from DescriptorProto.ReservedRange in that it 235 | // is inclusive such that it can appropriately represent the entire int32 236 | // domain. 237 | message EnumReservedRange { 238 | optional int32 start = 1; // Inclusive. 239 | optional int32 end = 2; // Inclusive. 240 | } 241 | 242 | // Range of reserved numeric values. Reserved numeric values may not be used 243 | // by enum values in the same enum declaration. Reserved ranges may not 244 | // overlap. 245 | repeated EnumReservedRange reserved_range = 4; 246 | 247 | // Reserved enum value names, which may not be reused. A given name may only 248 | // be reserved once. 249 | repeated string reserved_name = 5; 250 | } 251 | 252 | // Describes a value within an enum. 253 | message EnumValueDescriptorProto { 254 | optional string name = 1; 255 | optional int32 number = 2; 256 | 257 | optional EnumValueOptions options = 3; 258 | } 259 | 260 | // Describes a service. 261 | message ServiceDescriptorProto { 262 | optional string name = 1; 263 | repeated MethodDescriptorProto method = 2; 264 | 265 | optional ServiceOptions options = 3; 266 | } 267 | 268 | // Describes a method of a service. 269 | message MethodDescriptorProto { 270 | optional string name = 1; 271 | 272 | // Input and output type names. These are resolved in the same way as 273 | // FieldDescriptorProto.type_name, but must refer to a message type. 274 | optional string input_type = 2; 275 | optional string output_type = 3; 276 | 277 | optional MethodOptions options = 4; 278 | 279 | // Identifies if client streams multiple client messages 280 | optional bool client_streaming = 5 [default = false]; 281 | // Identifies if server streams multiple server messages 282 | optional bool server_streaming = 6 [default = false]; 283 | } 284 | 285 | 286 | // =================================================================== 287 | // Options 288 | 289 | // Each of the definitions above may have "options" attached. These are 290 | // just annotations which may cause code to be generated slightly differently 291 | // or may contain hints for code that manipulates protocol messages. 292 | // 293 | // Clients may define custom options as extensions of the *Options messages. 294 | // These extensions may not yet be known at parsing time, so the parser cannot 295 | // store the values in them. Instead it stores them in a field in the *Options 296 | // message called uninterpreted_option. This field must have the same name 297 | // across all *Options messages. We then use this field to populate the 298 | // extensions when we build a descriptor, at which point all protos have been 299 | // parsed and so all extensions are known. 300 | // 301 | // Extension numbers for custom options may be chosen as follows: 302 | // * For options which will only be used within a single application or 303 | // organization, or for experimental options, use field numbers 50000 304 | // through 99999. It is up to you to ensure that you do not use the 305 | // same number for multiple options. 306 | // * For options which will be published and used publicly by multiple 307 | // independent entities, e-mail protobuf-global-extension-registry@google.com 308 | // to reserve extension numbers. Simply provide your project name (e.g. 309 | // Objective-C plugin) and your project website (if available) -- there's no 310 | // need to explain how you intend to use them. Usually you only need one 311 | // extension number. You can declare multiple options with only one extension 312 | // number by putting them in a sub-message. See the Custom Options section of 313 | // the docs for examples: 314 | // https://developers.google.com/protocol-buffers/docs/proto#options 315 | // If this turns out to be popular, a web service will be set up 316 | // to automatically assign option numbers. 317 | 318 | message FileOptions { 319 | 320 | // Sets the Java package where classes generated from this .proto will be 321 | // placed. By default, the proto package is used, but this is often 322 | // inappropriate because proto packages do not normally start with backwards 323 | // domain names. 324 | optional string java_package = 1; 325 | 326 | 327 | // If set, all the classes from the .proto file are wrapped in a single 328 | // outer class with the given name. This applies to both Proto1 329 | // (equivalent to the old "--one_java_file" option) and Proto2 (where 330 | // a .proto always translates to a single class, but you may want to 331 | // explicitly choose the class name). 332 | optional string java_outer_classname = 8; 333 | 334 | // If set true, then the Java code generator will generate a separate .java 335 | // file for each top-level message, enum, and service defined in the .proto 336 | // file. Thus, these types will *not* be nested inside the outer class 337 | // named by java_outer_classname. However, the outer class will still be 338 | // generated to contain the file's getDescriptor() method as well as any 339 | // top-level extensions defined in the file. 340 | optional bool java_multiple_files = 10 [default = false]; 341 | 342 | // This option does nothing. 343 | optional bool java_generate_equals_and_hash = 20 [deprecated=true]; 344 | 345 | // If set true, then the Java2 code generator will generate code that 346 | // throws an exception whenever an attempt is made to assign a non-UTF-8 347 | // byte sequence to a string field. 348 | // Message reflection will do the same. 349 | // However, an extension field still accepts non-UTF-8 byte sequences. 350 | // This option has no effect on when used with the lite runtime. 351 | optional bool java_string_check_utf8 = 27 [default = false]; 352 | 353 | 354 | // Generated classes can be optimized for speed or code size. 355 | enum OptimizeMode { 356 | SPEED = 1; // Generate complete code for parsing, serialization, 357 | // etc. 358 | CODE_SIZE = 2; // Use ReflectionOps to implement these methods. 359 | LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. 360 | } 361 | optional OptimizeMode optimize_for = 9 [default = SPEED]; 362 | 363 | // Sets the Go package where structs generated from this .proto will be 364 | // placed. If omitted, the Go package will be derived from the following: 365 | // - The basename of the package import path, if provided. 366 | // - Otherwise, the package statement in the .proto file, if present. 367 | // - Otherwise, the basename of the .proto file, without extension. 368 | optional string go_package = 11; 369 | 370 | 371 | 372 | 373 | // Should generic services be generated in each language? "Generic" services 374 | // are not specific to any particular RPC system. They are generated by the 375 | // main code generators in each language (without additional plugins). 376 | // Generic services were the only kind of service generation supported by 377 | // early versions of google.protobuf. 378 | // 379 | // Generic services are now considered deprecated in favor of using plugins 380 | // that generate code specific to your particular RPC system. Therefore, 381 | // these default to false. Old code which depends on generic services should 382 | // explicitly set them to true. 383 | optional bool cc_generic_services = 16 [default = false]; 384 | optional bool java_generic_services = 17 [default = false]; 385 | optional bool py_generic_services = 18 [default = false]; 386 | optional bool php_generic_services = 42 [default = false]; 387 | 388 | // Is this file deprecated? 389 | // Depending on the target platform, this can emit Deprecated annotations 390 | // for everything in the file, or it will be completely ignored; in the very 391 | // least, this is a formalization for deprecating files. 392 | optional bool deprecated = 23 [default = false]; 393 | 394 | // Enables the use of arenas for the proto messages in this file. This applies 395 | // only to generated classes for C++. 396 | optional bool cc_enable_arenas = 31 [default = false]; 397 | 398 | 399 | // Sets the objective c class prefix which is prepended to all objective c 400 | // generated classes from this .proto. There is no default. 401 | optional string objc_class_prefix = 36; 402 | 403 | // Namespace for generated classes; defaults to the package. 404 | optional string csharp_namespace = 37; 405 | 406 | // By default Swift generators will take the proto package and CamelCase it 407 | // replacing '.' with underscore and use that to prefix the types/symbols 408 | // defined. When this options is provided, they will use this value instead 409 | // to prefix the types/symbols defined. 410 | optional string swift_prefix = 39; 411 | 412 | // Sets the php class prefix which is prepended to all php generated classes 413 | // from this .proto. Default is empty. 414 | optional string php_class_prefix = 40; 415 | 416 | // Use this option to change the namespace of php generated classes. Default 417 | // is empty. When this option is empty, the package name will be used for 418 | // determining the namespace. 419 | optional string php_namespace = 41; 420 | 421 | // Use this option to change the namespace of php generated metadata classes. 422 | // Default is empty. When this option is empty, the proto file name will be 423 | // used for determining the namespace. 424 | optional string php_metadata_namespace = 44; 425 | 426 | // Use this option to change the package of ruby generated classes. Default 427 | // is empty. When this option is not set, the package name will be used for 428 | // determining the ruby package. 429 | optional string ruby_package = 45; 430 | 431 | 432 | // The parser stores options it doesn't recognize here. 433 | // See the documentation for the "Options" section above. 434 | repeated UninterpretedOption uninterpreted_option = 999; 435 | 436 | // Clients can define custom options in extensions of this message. 437 | // See the documentation for the "Options" section above. 438 | extensions 1000 to max; 439 | 440 | reserved 38; 441 | } 442 | 443 | message MessageOptions { 444 | // Set true to use the old proto1 MessageSet wire format for extensions. 445 | // This is provided for backwards-compatibility with the MessageSet wire 446 | // format. You should not use this for any other reason: It's less 447 | // efficient, has fewer features, and is more complicated. 448 | // 449 | // The message must be defined exactly as follows: 450 | // message Foo { 451 | // option message_set_wire_format = true; 452 | // extensions 4 to max; 453 | // } 454 | // Note that the message cannot have any defined fields; MessageSets only 455 | // have extensions. 456 | // 457 | // All extensions of your type must be singular messages; e.g. they cannot 458 | // be int32s, enums, or repeated messages. 459 | // 460 | // Because this is an option, the above two restrictions are not enforced by 461 | // the protocol compiler. 462 | optional bool message_set_wire_format = 1 [default = false]; 463 | 464 | // Disables the generation of the standard "descriptor()" accessor, which can 465 | // conflict with a field of the same name. This is meant to make migration 466 | // from proto1 easier; new code should avoid fields named "descriptor". 467 | optional bool no_standard_descriptor_accessor = 2 [default = false]; 468 | 469 | // Is this message deprecated? 470 | // Depending on the target platform, this can emit Deprecated annotations 471 | // for the message, or it will be completely ignored; in the very least, 472 | // this is a formalization for deprecating messages. 473 | optional bool deprecated = 3 [default = false]; 474 | 475 | // Whether the message is an automatically generated map entry type for the 476 | // maps field. 477 | // 478 | // For maps fields: 479 | // map map_field = 1; 480 | // The parsed descriptor looks like: 481 | // message MapFieldEntry { 482 | // option map_entry = true; 483 | // optional KeyType key = 1; 484 | // optional ValueType value = 2; 485 | // } 486 | // repeated MapFieldEntry map_field = 1; 487 | // 488 | // Implementations may choose not to generate the map_entry=true message, but 489 | // use a native map in the target language to hold the keys and values. 490 | // The reflection APIs in such implementations still need to work as 491 | // if the field is a repeated message field. 492 | // 493 | // NOTE: Do not set the option in .proto files. Always use the maps syntax 494 | // instead. The option should only be implicitly set by the proto compiler 495 | // parser. 496 | optional bool map_entry = 7; 497 | 498 | reserved 8; // javalite_serializable 499 | reserved 9; // javanano_as_lite 500 | 501 | 502 | // The parser stores options it doesn't recognize here. See above. 503 | repeated UninterpretedOption uninterpreted_option = 999; 504 | 505 | // Clients can define custom options in extensions of this message. See above. 506 | extensions 1000 to max; 507 | } 508 | 509 | message FieldOptions { 510 | // The ctype option instructs the C++ code generator to use a different 511 | // representation of the field than it normally would. See the specific 512 | // options below. This option is not yet implemented in the open source 513 | // release -- sorry, we'll try to include it in a future version! 514 | optional CType ctype = 1 [default = STRING]; 515 | enum CType { 516 | // Default mode. 517 | STRING = 0; 518 | 519 | CORD = 1; 520 | 521 | STRING_PIECE = 2; 522 | } 523 | // The packed option can be enabled for repeated primitive fields to enable 524 | // a more efficient representation on the wire. Rather than repeatedly 525 | // writing the tag and type for each element, the entire array is encoded as 526 | // a single length-delimited blob. In proto3, only explicit setting it to 527 | // false will avoid using packed encoding. 528 | optional bool packed = 2; 529 | 530 | // The jstype option determines the JavaScript type used for values of the 531 | // field. The option is permitted only for 64 bit integral and fixed types 532 | // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING 533 | // is represented as JavaScript string, which avoids loss of precision that 534 | // can happen when a large value is converted to a floating point JavaScript. 535 | // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to 536 | // use the JavaScript "number" type. The behavior of the default option 537 | // JS_NORMAL is implementation dependent. 538 | // 539 | // This option is an enum to permit additional types to be added, e.g. 540 | // goog.math.Integer. 541 | optional JSType jstype = 6 [default = JS_NORMAL]; 542 | enum JSType { 543 | // Use the default type. 544 | JS_NORMAL = 0; 545 | 546 | // Use JavaScript strings. 547 | JS_STRING = 1; 548 | 549 | // Use JavaScript numbers. 550 | JS_NUMBER = 2; 551 | } 552 | 553 | // Should this field be parsed lazily? Lazy applies only to message-type 554 | // fields. It means that when the outer message is initially parsed, the 555 | // inner message's contents will not be parsed but instead stored in encoded 556 | // form. The inner message will actually be parsed when it is first accessed. 557 | // 558 | // This is only a hint. Implementations are free to choose whether to use 559 | // eager or lazy parsing regardless of the value of this option. However, 560 | // setting this option true suggests that the protocol author believes that 561 | // using lazy parsing on this field is worth the additional bookkeeping 562 | // overhead typically needed to implement it. 563 | // 564 | // This option does not affect the public interface of any generated code; 565 | // all method signatures remain the same. Furthermore, thread-safety of the 566 | // interface is not affected by this option; const methods remain safe to 567 | // call from multiple threads concurrently, while non-const methods continue 568 | // to require exclusive access. 569 | // 570 | // 571 | // Note that implementations may choose not to check required fields within 572 | // a lazy sub-message. That is, calling IsInitialized() on the outer message 573 | // may return true even if the inner message has missing required fields. 574 | // This is necessary because otherwise the inner message would have to be 575 | // parsed in order to perform the check, defeating the purpose of lazy 576 | // parsing. An implementation which chooses not to check required fields 577 | // must be consistent about it. That is, for any particular sub-message, the 578 | // implementation must either *always* check its required fields, or *never* 579 | // check its required fields, regardless of whether or not the message has 580 | // been parsed. 581 | optional bool lazy = 5 [default = false]; 582 | 583 | // Is this field deprecated? 584 | // Depending on the target platform, this can emit Deprecated annotations 585 | // for accessors, or it will be completely ignored; in the very least, this 586 | // is a formalization for deprecating fields. 587 | optional bool deprecated = 3 [default = false]; 588 | 589 | // For Google-internal migration only. Do not use. 590 | optional bool weak = 10 [default = false]; 591 | 592 | 593 | // The parser stores options it doesn't recognize here. See above. 594 | repeated UninterpretedOption uninterpreted_option = 999; 595 | 596 | // Clients can define custom options in extensions of this message. See above. 597 | extensions 1000 to max; 598 | 599 | reserved 4; // removed jtype 600 | } 601 | 602 | message OneofOptions { 603 | // The parser stores options it doesn't recognize here. See above. 604 | repeated UninterpretedOption uninterpreted_option = 999; 605 | 606 | // Clients can define custom options in extensions of this message. See above. 607 | extensions 1000 to max; 608 | } 609 | 610 | message EnumOptions { 611 | 612 | // Set this option to true to allow mapping different tag names to the same 613 | // value. 614 | optional bool allow_alias = 2; 615 | 616 | // Is this enum deprecated? 617 | // Depending on the target platform, this can emit Deprecated annotations 618 | // for the enum, or it will be completely ignored; in the very least, this 619 | // is a formalization for deprecating enums. 620 | optional bool deprecated = 3 [default = false]; 621 | 622 | reserved 5; // javanano_as_lite 623 | 624 | // The parser stores options it doesn't recognize here. See above. 625 | repeated UninterpretedOption uninterpreted_option = 999; 626 | 627 | // Clients can define custom options in extensions of this message. See above. 628 | extensions 1000 to max; 629 | } 630 | 631 | message EnumValueOptions { 632 | // Is this enum value deprecated? 633 | // Depending on the target platform, this can emit Deprecated annotations 634 | // for the enum value, or it will be completely ignored; in the very least, 635 | // this is a formalization for deprecating enum values. 636 | optional bool deprecated = 1 [default = false]; 637 | 638 | // The parser stores options it doesn't recognize here. See above. 639 | repeated UninterpretedOption uninterpreted_option = 999; 640 | 641 | // Clients can define custom options in extensions of this message. See above. 642 | extensions 1000 to max; 643 | } 644 | 645 | message ServiceOptions { 646 | 647 | // Note: Field numbers 1 through 32 are reserved for Google's internal RPC 648 | // framework. We apologize for hoarding these numbers to ourselves, but 649 | // we were already using them long before we decided to release Protocol 650 | // Buffers. 651 | 652 | // Is this service deprecated? 653 | // Depending on the target platform, this can emit Deprecated annotations 654 | // for the service, or it will be completely ignored; in the very least, 655 | // this is a formalization for deprecating services. 656 | optional bool deprecated = 33 [default = false]; 657 | 658 | // The parser stores options it doesn't recognize here. See above. 659 | repeated UninterpretedOption uninterpreted_option = 999; 660 | 661 | // Clients can define custom options in extensions of this message. See above. 662 | extensions 1000 to max; 663 | } 664 | 665 | message MethodOptions { 666 | 667 | // Note: Field numbers 1 through 32 are reserved for Google's internal RPC 668 | // framework. We apologize for hoarding these numbers to ourselves, but 669 | // we were already using them long before we decided to release Protocol 670 | // Buffers. 671 | 672 | // Is this method deprecated? 673 | // Depending on the target platform, this can emit Deprecated annotations 674 | // for the method, or it will be completely ignored; in the very least, 675 | // this is a formalization for deprecating methods. 676 | optional bool deprecated = 33 [default = false]; 677 | 678 | // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, 679 | // or neither? HTTP based RPC implementation may choose GET verb for safe 680 | // methods, and PUT verb for idempotent methods instead of the default POST. 681 | enum IdempotencyLevel { 682 | IDEMPOTENCY_UNKNOWN = 0; 683 | NO_SIDE_EFFECTS = 1; // implies idempotent 684 | IDEMPOTENT = 2; // idempotent, but may have side effects 685 | } 686 | optional IdempotencyLevel idempotency_level = 34 687 | [default = IDEMPOTENCY_UNKNOWN]; 688 | 689 | // The parser stores options it doesn't recognize here. See above. 690 | repeated UninterpretedOption uninterpreted_option = 999; 691 | 692 | // Clients can define custom options in extensions of this message. See above. 693 | extensions 1000 to max; 694 | } 695 | 696 | 697 | // A message representing a option the parser does not recognize. This only 698 | // appears in options protos created by the compiler::Parser class. 699 | // DescriptorPool resolves these when building Descriptor objects. Therefore, 700 | // options protos in descriptor objects (e.g. returned by Descriptor::options(), 701 | // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions 702 | // in them. 703 | message UninterpretedOption { 704 | // The name of the uninterpreted option. Each string represents a segment in 705 | // a dot-separated name. is_extension is true iff a segment represents an 706 | // extension (denoted with parentheses in options specs in .proto files). 707 | // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents 708 | // "foo.(bar.baz).qux". 709 | message NamePart { 710 | required string name_part = 1; 711 | required bool is_extension = 2; 712 | } 713 | repeated NamePart name = 2; 714 | 715 | // The value of the uninterpreted option, in whatever type the tokenizer 716 | // identified it as during parsing. Exactly one of these should be set. 717 | optional string identifier_value = 3; 718 | optional uint64 positive_int_value = 4; 719 | optional int64 negative_int_value = 5; 720 | optional double double_value = 6; 721 | optional bytes string_value = 7; 722 | optional string aggregate_value = 8; 723 | } 724 | 725 | // =================================================================== 726 | // Optional source code info 727 | 728 | // Encapsulates information about the original source file from which a 729 | // FileDescriptorProto was generated. 730 | message SourceCodeInfo { 731 | // A Location identifies a piece of source code in a .proto file which 732 | // corresponds to a particular definition. This information is intended 733 | // to be useful to IDEs, code indexers, documentation generators, and similar 734 | // tools. 735 | // 736 | // For example, say we have a file like: 737 | // message Foo { 738 | // optional string foo = 1; 739 | // } 740 | // Let's look at just the field definition: 741 | // optional string foo = 1; 742 | // ^ ^^ ^^ ^ ^^^ 743 | // a bc de f ghi 744 | // We have the following locations: 745 | // span path represents 746 | // [a,i) [ 4, 0, 2, 0 ] The whole field definition. 747 | // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). 748 | // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). 749 | // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). 750 | // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). 751 | // 752 | // Notes: 753 | // - A location may refer to a repeated field itself (i.e. not to any 754 | // particular index within it). This is used whenever a set of elements are 755 | // logically enclosed in a single code segment. For example, an entire 756 | // extend block (possibly containing multiple extension definitions) will 757 | // have an outer location whose path refers to the "extensions" repeated 758 | // field without an index. 759 | // - Multiple locations may have the same path. This happens when a single 760 | // logical declaration is spread out across multiple places. The most 761 | // obvious example is the "extend" block again -- there may be multiple 762 | // extend blocks in the same scope, each of which will have the same path. 763 | // - A location's span is not always a subset of its parent's span. For 764 | // example, the "extendee" of an extension declaration appears at the 765 | // beginning of the "extend" block and is shared by all extensions within 766 | // the block. 767 | // - Just because a location's span is a subset of some other location's span 768 | // does not mean that it is a descendant. For example, a "group" defines 769 | // both a type and a field in a single declaration. Thus, the locations 770 | // corresponding to the type and field and their components will overlap. 771 | // - Code which tries to interpret locations should probably be designed to 772 | // ignore those that it doesn't understand, as more types of locations could 773 | // be recorded in the future. 774 | repeated Location location = 1; 775 | message Location { 776 | // Identifies which part of the FileDescriptorProto was defined at this 777 | // location. 778 | // 779 | // Each element is a field number or an index. They form a path from 780 | // the root FileDescriptorProto to the place where the definition. For 781 | // example, this path: 782 | // [ 4, 3, 2, 7, 1 ] 783 | // refers to: 784 | // file.message_type(3) // 4, 3 785 | // .field(7) // 2, 7 786 | // .name() // 1 787 | // This is because FileDescriptorProto.message_type has field number 4: 788 | // repeated DescriptorProto message_type = 4; 789 | // and DescriptorProto.field has field number 2: 790 | // repeated FieldDescriptorProto field = 2; 791 | // and FieldDescriptorProto.name has field number 1: 792 | // optional string name = 1; 793 | // 794 | // Thus, the above path gives the location of a field name. If we removed 795 | // the last element: 796 | // [ 4, 3, 2, 7 ] 797 | // this path refers to the whole field declaration (from the beginning 798 | // of the label to the terminating semicolon). 799 | repeated int32 path = 1 [packed = true]; 800 | 801 | // Always has exactly three or four elements: start line, start column, 802 | // end line (optional, otherwise assumed same as start line), end column. 803 | // These are packed into a single field for efficiency. Note that line 804 | // and column numbers are zero-based -- typically you will want to add 805 | // 1 to each before displaying to a user. 806 | repeated int32 span = 2 [packed = true]; 807 | 808 | // If this SourceCodeInfo represents a complete declaration, these are any 809 | // comments appearing before and after the declaration which appear to be 810 | // attached to the declaration. 811 | // 812 | // A series of line comments appearing on consecutive lines, with no other 813 | // tokens appearing on those lines, will be treated as a single comment. 814 | // 815 | // leading_detached_comments will keep paragraphs of comments that appear 816 | // before (but not connected to) the current element. Each paragraph, 817 | // separated by empty lines, will be one comment element in the repeated 818 | // field. 819 | // 820 | // Only the comment content is provided; comment markers (e.g. //) are 821 | // stripped out. For block comments, leading whitespace and an asterisk 822 | // will be stripped from the beginning of each line other than the first. 823 | // Newlines are included in the output. 824 | // 825 | // Examples: 826 | // 827 | // optional int32 foo = 1; // Comment attached to foo. 828 | // // Comment attached to bar. 829 | // optional int32 bar = 2; 830 | // 831 | // optional string baz = 3; 832 | // // Comment attached to baz. 833 | // // Another line attached to baz. 834 | // 835 | // // Comment attached to qux. 836 | // // 837 | // // Another line attached to qux. 838 | // optional double qux = 4; 839 | // 840 | // // Detached comment for corge. This is not leading or trailing comments 841 | // // to qux or corge because there are blank lines separating it from 842 | // // both. 843 | // 844 | // // Detached comment for corge paragraph 2. 845 | // 846 | // optional string corge = 5; 847 | // /* Block comment attached 848 | // * to corge. Leading asterisks 849 | // * will be removed. */ 850 | // /* Block comment attached to 851 | // * grault. */ 852 | // optional int32 grault = 6; 853 | // 854 | // // ignored detached comments. 855 | optional string leading_comments = 3; 856 | optional string trailing_comments = 4; 857 | repeated string leading_detached_comments = 6; 858 | } 859 | } 860 | 861 | // Describes the relationship between generated code and its original source 862 | // file. A GeneratedCodeInfo message is associated with only one generated 863 | // source file, but may contain references to different source .proto files. 864 | message GeneratedCodeInfo { 865 | // An Annotation connects some span of text in generated code to an element 866 | // of its generating .proto file. 867 | repeated Annotation annotation = 1; 868 | message Annotation { 869 | // Identifies the element in the original source .proto file. This field 870 | // is formatted the same as SourceCodeInfo.Location.path. 871 | repeated int32 path = 1 [packed = true]; 872 | 873 | // Identifies the filesystem path to the original source .proto. 874 | optional string source_file = 2; 875 | 876 | // Identifies the starting offset in bytes in the generated code 877 | // that relates to the identified object. 878 | optional int32 begin = 3; 879 | 880 | // Identifies the ending offset in bytes in the generated code that 881 | // relates to the identified offset. The end offset should be one past 882 | // the last relevant byte (so the length of the text = end - begin). 883 | optional int32 end = 4; 884 | } 885 | } 886 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/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 | -------------------------------------------------------------------------------- /proto/protoc-gen-openapiv2/options/annotations.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package grpc.gateway.protoc_gen_openapiv2.options; 4 | 5 | import "google/protobuf/descriptor.proto"; 6 | import "protoc-gen-openapiv2/options/openapiv2.proto"; 7 | 8 | option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; 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 | } -------------------------------------------------------------------------------- /proto/protoc-gen-openapiv2/options/openapiv2.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package grpc.gateway.protoc_gen_openapiv2.options; 4 | 5 | import "google/protobuf/struct.proto"; 6 | 7 | option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; 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 | // Additional field level properties used when generating the OpenAPI v2 file. 510 | FieldConfiguration field_configuration = 1001; 511 | 512 | // 'FieldConfiguration' provides additional field level properties used when generating the OpenAPI v2 file. 513 | // These properties are not defined by OpenAPIv2, but they are used to control the generation. 514 | message FieldConfiguration { 515 | // Alternative parameter name when used as path parameter. If set, this will 516 | // be used as the complete parameter name when this field is used as a path 517 | // parameter. Use this to avoid having auto generated path parameter names 518 | // for overlapping paths. 519 | string path_param_name = 47; 520 | } 521 | map extensions = 48; 522 | } 523 | 524 | // `Tag` is a representation of OpenAPI v2 specification's Tag object. 525 | // 526 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject 527 | // 528 | message Tag { 529 | // field 1 is reserved for 'name'. In our generator, this is (to be) extracted 530 | // from the name of proto service, and thus not exposed to the user, as 531 | // changing tag object's name would break the link to the references to the 532 | // tag in individual operation specifications. 533 | // 534 | // TODO(ivucica): Add 'name' property. Use it to allow override of the name of 535 | // global Tag object, then use that name to reference the tag throughout the 536 | // OpenAPI file. 537 | reserved 1; 538 | // A short description for the tag. GFM syntax can be used for rich text 539 | // representation. 540 | string description = 2; 541 | // Additional external documentation for this tag. 542 | ExternalDocumentation external_docs = 3; 543 | string name = 4; 544 | } 545 | 546 | // `SecurityDefinitions` is a representation of OpenAPI v2 specification's 547 | // Security Definitions object. 548 | // 549 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject 550 | // 551 | // A declaration of the security schemes available to be used in the 552 | // specification. This does not enforce the security schemes on the operations 553 | // and only serves to provide the relevant details for each scheme. 554 | message SecurityDefinitions { 555 | // A single security scheme definition, mapping a "name" to the scheme it 556 | // defines. 557 | map security = 1; 558 | } 559 | 560 | // `SecurityScheme` is a representation of OpenAPI v2 specification's 561 | // Security Scheme object. 562 | // 563 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject 564 | // 565 | // Allows the definition of a security scheme that can be used by the 566 | // operations. Supported schemes are basic authentication, an API key (either as 567 | // a header or as a query parameter) and OAuth2's common flows (implicit, 568 | // password, application and access code). 569 | message SecurityScheme { 570 | // The type of the security scheme. Valid values are "basic", 571 | // "apiKey" or "oauth2". 572 | enum Type { 573 | TYPE_INVALID = 0; 574 | TYPE_BASIC = 1; 575 | TYPE_API_KEY = 2; 576 | TYPE_OAUTH2 = 3; 577 | } 578 | 579 | // The location of the API key. Valid values are "query" or "header". 580 | enum In { 581 | IN_INVALID = 0; 582 | IN_QUERY = 1; 583 | IN_HEADER = 2; 584 | } 585 | 586 | // The flow used by the OAuth2 security scheme. Valid values are 587 | // "implicit", "password", "application" or "accessCode". 588 | enum Flow { 589 | FLOW_INVALID = 0; 590 | FLOW_IMPLICIT = 1; 591 | FLOW_PASSWORD = 2; 592 | FLOW_APPLICATION = 3; 593 | FLOW_ACCESS_CODE = 4; 594 | } 595 | 596 | // The type of the security scheme. Valid values are "basic", 597 | // "apiKey" or "oauth2". 598 | Type type = 1; 599 | // A short description for security scheme. 600 | string description = 2; 601 | // The name of the header or query parameter to be used. 602 | // Valid for apiKey. 603 | string name = 3; 604 | // The location of the API key. Valid values are "query" or 605 | // "header". 606 | // Valid for apiKey. 607 | In in = 4; 608 | // The flow used by the OAuth2 security scheme. Valid values are 609 | // "implicit", "password", "application" or "accessCode". 610 | // Valid for oauth2. 611 | Flow flow = 5; 612 | // The authorization URL to be used for this flow. This SHOULD be in 613 | // the form of a URL. 614 | // Valid for oauth2/implicit and oauth2/accessCode. 615 | string authorization_url = 6; 616 | // The token URL to be used for this flow. This SHOULD be in the 617 | // form of a URL. 618 | // Valid for oauth2/password, oauth2/application and oauth2/accessCode. 619 | string token_url = 7; 620 | // The available scopes for the OAuth2 security scheme. 621 | // Valid for oauth2. 622 | Scopes scopes = 8; 623 | map extensions = 9; 624 | } 625 | 626 | // `SecurityRequirement` is a representation of OpenAPI v2 specification's 627 | // Security Requirement object. 628 | // 629 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject 630 | // 631 | // Lists the required security schemes to execute this operation. The object can 632 | // have multiple security schemes declared in it which are all required (that 633 | // is, there is a logical AND between the schemes). 634 | // 635 | // The name used for each property MUST correspond to a security scheme 636 | // declared in the Security Definitions. 637 | message SecurityRequirement { 638 | // If the security scheme is of type "oauth2", then the value is a list of 639 | // scope names required for the execution. For other security scheme types, 640 | // the array MUST be empty. 641 | message SecurityRequirementValue { 642 | repeated string scope = 1; 643 | } 644 | // Each name must correspond to a security scheme which is declared in 645 | // the Security Definitions. If the security scheme is of type "oauth2", 646 | // then the value is a list of scope names required for the execution. 647 | // For other security scheme types, the array MUST be empty. 648 | map security_requirement = 1; 649 | } 650 | 651 | // `Scopes` is a representation of OpenAPI v2 specification's Scopes object. 652 | // 653 | // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject 654 | // 655 | // Lists the available scopes for an OAuth2 security scheme. 656 | message Scopes { 657 | // Maps between a name of a scope to a short description of it (as the value 658 | // of the property). 659 | map scope = 1; 660 | } --------------------------------------------------------------------------------