@ark-us/wasmxjs 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -0
- package/README.md +280 -0
- package/main/codegen/cosmos/base/abci/v1beta1/abci.js +887 -0
- package/main/codegen/cosmos/base/kv/v1beta1/kv.js +139 -0
- package/main/codegen/cosmos/base/query/v1beta1/pagination.js +157 -0
- package/main/codegen/cosmos/base/reflection/v1beta1/reflection.js +231 -0
- package/main/codegen/cosmos/base/reflection/v2alpha1/reflection.js +1479 -0
- package/main/codegen/cosmos/base/snapshots/v1beta1/snapshot.js +478 -0
- package/main/codegen/cosmos/base/store/v1beta1/commit_info.js +207 -0
- package/main/codegen/cosmos/base/store/v1beta1/listening.js +89 -0
- package/main/codegen/cosmos/base/tendermint/v1beta1/query.js +951 -0
- package/main/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.js +117 -0
- package/main/codegen/cosmos/base/v1beta1/coin.js +223 -0
- package/main/codegen/cosmos/bundle.js +63 -0
- package/main/codegen/cosmos/rpc.query.js +55 -0
- package/main/codegen/extern.js +66 -0
- package/main/codegen/gogoproto/bundle.js +16 -0
- package/main/codegen/gogoproto/gogo.js +5 -0
- package/main/codegen/google/api/annotations.js +5 -0
- package/main/codegen/google/api/http.js +306 -0
- package/main/codegen/google/api/httpbody.js +102 -0
- package/main/codegen/google/bundle.js +26 -0
- package/main/codegen/google/protobuf/any.js +69 -0
- package/main/codegen/google/protobuf/descriptor.js +3429 -0
- package/main/codegen/google/protobuf/duration.js +69 -0
- package/main/codegen/google/protobuf/timestamp.js +69 -0
- package/main/codegen/helpers.js +170 -0
- package/main/codegen/index.js +93 -0
- package/main/codegen/tendermint/abci/types.js +3616 -0
- package/main/codegen/tendermint/bundle.js +37 -0
- package/main/codegen/tendermint/crypto/keys.js +69 -0
- package/main/codegen/tendermint/crypto/proof.js +372 -0
- package/main/codegen/tendermint/libs/bits/types.js +100 -0
- package/main/codegen/tendermint/p2p/types.js +322 -0
- package/main/codegen/tendermint/types/block.js +90 -0
- package/main/codegen/tendermint/types/evidence.js +335 -0
- package/main/codegen/tendermint/types/params.js +397 -0
- package/main/codegen/tendermint/types/types.js +1223 -0
- package/main/codegen/tendermint/types/validator.js +237 -0
- package/main/codegen/tendermint/version/types.js +126 -0
- package/main/codegen/wasmx/bundle.js +30 -0
- package/main/codegen/wasmx/client.js +65 -0
- package/main/codegen/wasmx/index.js +126 -0
- package/main/codegen/wasmx/rpc.query.js +65 -0
- package/main/codegen/wasmx/rpc.tx.js +44 -0
- package/main/codegen/wasmx/wasmx/contract.js +324 -0
- package/main/codegen/wasmx/wasmx/genesis.js +481 -0
- package/main/codegen/wasmx/wasmx/params.js +45 -0
- package/main/codegen/wasmx/wasmx/query.js +1187 -0
- package/main/codegen/wasmx/wasmx/query.rpc.Query.js +154 -0
- package/main/codegen/wasmx/wasmx/tx.amino.js +251 -0
- package/main/codegen/wasmx/wasmx/tx.js +937 -0
- package/main/codegen/wasmx/wasmx/tx.registry.js +213 -0
- package/main/codegen/wasmx/wasmx/tx.rpc.msg.js +85 -0
- package/main/index.js +16 -0
- package/module/codegen/cosmos/base/abci/v1beta1/abci.js +755 -0
- package/module/codegen/cosmos/base/kv/v1beta1/kv.js +110 -0
- package/module/codegen/cosmos/base/query/v1beta1/pagination.js +154 -0
- package/module/codegen/cosmos/base/reflection/v1beta1/reflection.js +183 -0
- package/module/codegen/cosmos/base/reflection/v2alpha1/reflection.js +1297 -0
- package/module/codegen/cosmos/base/snapshots/v1beta1/snapshot.js +439 -0
- package/module/codegen/cosmos/base/store/v1beta1/commit_info.js +179 -0
- package/module/codegen/cosmos/base/store/v1beta1/listening.js +86 -0
- package/module/codegen/cosmos/base/tendermint/v1beta1/query.js +866 -0
- package/module/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.js +74 -0
- package/module/codegen/cosmos/base/v1beta1/coin.js +213 -0
- package/module/codegen/cosmos/bundle.js +52 -0
- package/module/codegen/cosmos/rpc.query.js +17 -0
- package/module/codegen/extern.js +30 -0
- package/module/codegen/gogoproto/bundle.js +5 -0
- package/module/codegen/gogoproto/gogo.js +1 -0
- package/module/codegen/google/api/annotations.js +1 -0
- package/module/codegen/google/api/http.js +264 -0
- package/module/codegen/google/api/httpbody.js +115 -0
- package/module/codegen/google/bundle.js +15 -0
- package/module/codegen/google/protobuf/any.js +140 -0
- package/module/codegen/google/protobuf/descriptor.js +2801 -0
- package/module/codegen/google/protobuf/duration.js +119 -0
- package/module/codegen/google/protobuf/timestamp.js +143 -0
- package/module/codegen/helpers.js +140 -0
- package/module/codegen/index.js +14 -0
- package/module/codegen/tendermint/abci/types.js +3305 -0
- package/module/codegen/tendermint/bundle.js +26 -0
- package/module/codegen/tendermint/crypto/keys.js +60 -0
- package/module/codegen/tendermint/crypto/proof.js +320 -0
- package/module/codegen/tendermint/libs/bits/types.js +71 -0
- package/module/codegen/tendermint/p2p/types.js +305 -0
- package/module/codegen/tendermint/types/block.js +79 -0
- package/module/codegen/tendermint/types/evidence.js +285 -0
- package/module/codegen/tendermint/types/params.js +363 -0
- package/module/codegen/tendermint/types/types.js +1149 -0
- package/module/codegen/tendermint/types/validator.js +204 -0
- package/module/codegen/tendermint/version/types.js +119 -0
- package/module/codegen/wasmx/bundle.js +19 -0
- package/module/codegen/wasmx/client.js +36 -0
- package/module/codegen/wasmx/index.js +11 -0
- package/module/codegen/wasmx/rpc.query.js +20 -0
- package/module/codegen/wasmx/rpc.tx.js +7 -0
- package/module/codegen/wasmx/wasmx/contract.js +291 -0
- package/module/codegen/wasmx/wasmx/genesis.js +386 -0
- package/module/codegen/wasmx/wasmx/params.js +36 -0
- package/module/codegen/wasmx/wasmx/query.js +1052 -0
- package/module/codegen/wasmx/wasmx/query.rpc.Query.js +101 -0
- package/module/codegen/wasmx/wasmx/tx.amino.js +236 -0
- package/module/codegen/wasmx/wasmx/tx.js +815 -0
- package/module/codegen/wasmx/wasmx/tx.registry.js +199 -0
- package/module/codegen/wasmx/wasmx/tx.rpc.msg.js +47 -0
- package/module/index.js +1 -0
- package/package.json +88 -0
- package/src/codegen/cosmos/base/abci/v1beta1/abci.ts +1254 -0
- package/src/codegen/cosmos/base/kv/v1beta1/kv.ts +156 -0
- package/src/codegen/cosmos/base/query/v1beta1/pagination.ts +314 -0
- package/src/codegen/cosmos/base/reflection/v1beta1/reflection.ts +280 -0
- package/src/codegen/cosmos/base/reflection/v2alpha1/reflection.ts +2079 -0
- package/src/codegen/cosmos/base/snapshots/v1beta1/snapshot.ts +641 -0
- package/src/codegen/cosmos/base/store/v1beta1/commit_info.ts +269 -0
- package/src/codegen/cosmos/base/store/v1beta1/listening.ts +129 -0
- package/src/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts +107 -0
- package/src/codegen/cosmos/base/tendermint/v1beta1/query.ts +1284 -0
- package/src/codegen/cosmos/base/v1beta1/coin.ts +318 -0
- package/src/codegen/cosmos/bundle.ts +52 -0
- package/src/codegen/cosmos/rpc.query.ts +19 -0
- package/src/codegen/extern.ts +33 -0
- package/src/codegen/gogoproto/bundle.ts +3 -0
- package/src/codegen/gogoproto/gogo.ts +1 -0
- package/src/codegen/google/api/annotations.ts +1 -0
- package/src/codegen/google/api/http.ts +945 -0
- package/src/codegen/google/api/httpbody.ts +200 -0
- package/src/codegen/google/bundle.ts +18 -0
- package/src/codegen/google/protobuf/any.ts +305 -0
- package/src/codegen/google/protobuf/descriptor.ts +5113 -0
- package/src/codegen/google/protobuf/duration.ts +229 -0
- package/src/codegen/google/protobuf/timestamp.ts +273 -0
- package/src/codegen/helpers.ts +240 -0
- package/src/codegen/index.ts +14 -0
- package/src/codegen/tendermint/abci/types.ts +4754 -0
- package/src/codegen/tendermint/bundle.ts +32 -0
- package/src/codegen/tendermint/crypto/keys.ts +83 -0
- package/src/codegen/tendermint/crypto/proof.ts +465 -0
- package/src/codegen/tendermint/libs/bits/types.ts +97 -0
- package/src/codegen/tendermint/p2p/types.ts +422 -0
- package/src/codegen/tendermint/types/block.ts +109 -0
- package/src/codegen/tendermint/types/evidence.ts +415 -0
- package/src/codegen/tendermint/types/params.ts +615 -0
- package/src/codegen/tendermint/types/types.ts +1663 -0
- package/src/codegen/tendermint/types/validator.ts +282 -0
- package/src/codegen/tendermint/version/types.ts +180 -0
- package/src/codegen/wasmx/bundle.ts +26 -0
- package/src/codegen/wasmx/client.ts +45 -0
- package/src/codegen/wasmx/index.ts +11 -0
- package/src/codegen/wasmx/rpc.query.ts +22 -0
- package/src/codegen/wasmx/rpc.tx.ts +10 -0
- package/src/codegen/wasmx/wasmx/contract.ts +470 -0
- package/src/codegen/wasmx/wasmx/genesis.ts +552 -0
- package/src/codegen/wasmx/wasmx/params.ts +50 -0
- package/src/codegen/wasmx/wasmx/query.rpc.Query.ts +149 -0
- package/src/codegen/wasmx/wasmx/query.ts +1668 -0
- package/src/codegen/wasmx/wasmx/tx.amino.ts +314 -0
- package/src/codegen/wasmx/wasmx/tx.registry.ts +230 -0
- package/src/codegen/wasmx/wasmx/tx.rpc.msg.ts +80 -0
- package/src/codegen/wasmx/wasmx/tx.ts +1331 -0
- package/src/index.ts +1 -0
- package/types/codegen/cosmos/base/abci/v1beta1/abci.d.ts +338 -0
- package/types/codegen/cosmos/base/kv/v1beta1/kv.d.ts +33 -0
- package/types/codegen/cosmos/base/query/v1beta1/pagination.d.ts +140 -0
- package/types/codegen/cosmos/base/reflection/v1beta1/reflection.d.ts +75 -0
- package/types/codegen/cosmos/base/reflection/v2alpha1/reflection.d.ts +565 -0
- package/types/codegen/cosmos/base/snapshots/v1beta1/snapshot.d.ts +135 -0
- package/types/codegen/cosmos/base/store/v1beta1/commit_info.d.ts +71 -0
- package/types/codegen/cosmos/base/store/v1beta1/listening.d.ts +38 -0
- package/types/codegen/cosmos/base/tendermint/v1beta1/query.d.ts +282 -0
- package/types/codegen/cosmos/base/tendermint/v1beta1/query.lcd.d.ts +14 -0
- package/types/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.d.ts +36 -0
- package/types/codegen/cosmos/base/v1beta1/coin.d.ts +85 -0
- package/types/codegen/cosmos/bundle.d.ts +594 -0
- package/types/codegen/cosmos/lcd.d.ts +11 -0
- package/types/codegen/cosmos/rpc.query.d.ts +19 -0
- package/types/codegen/extern.d.ts +9 -0
- package/types/codegen/gogoproto/bundle.d.ts +1 -0
- package/types/codegen/gogoproto/gogo.d.ts +1 -0
- package/types/codegen/google/api/annotations.d.ts +1 -0
- package/types/codegen/google/api/http.d.ts +622 -0
- package/types/codegen/google/api/httpbody.d.ts +113 -0
- package/types/codegen/google/bundle.d.ts +274 -0
- package/types/codegen/google/protobuf/any.d.ts +238 -0
- package/types/codegen/google/protobuf/descriptor.d.ts +1835 -0
- package/types/codegen/google/protobuf/duration.d.ts +163 -0
- package/types/codegen/google/protobuf/timestamp.d.ts +207 -0
- package/types/codegen/helpers.d.ts +82 -0
- package/types/codegen/index.d.ts +13 -0
- package/types/codegen/tendermint/abci/types.d.ts +993 -0
- package/types/codegen/tendermint/bundle.d.ts +639 -0
- package/types/codegen/tendermint/crypto/keys.d.ts +18 -0
- package/types/codegen/tendermint/crypto/proof.d.ts +101 -0
- package/types/codegen/tendermint/libs/bits/types.d.ts +17 -0
- package/types/codegen/tendermint/p2p/types.d.ts +78 -0
- package/types/codegen/tendermint/types/block.d.ts +22 -0
- package/types/codegen/tendermint/types/evidence.d.ts +91 -0
- package/types/codegen/tendermint/types/params.d.ts +193 -0
- package/types/codegen/tendermint/types/types.d.ts +363 -0
- package/types/codegen/tendermint/types/validator.d.ts +54 -0
- package/types/codegen/tendermint/version/types.d.ts +52 -0
- package/types/codegen/wasmx/bundle.d.ts +614 -0
- package/types/codegen/wasmx/client.d.ts +151 -0
- package/types/codegen/wasmx/index.d.ts +11 -0
- package/types/codegen/wasmx/lcd.d.ts +14 -0
- package/types/codegen/wasmx/rpc.query.d.ts +32 -0
- package/types/codegen/wasmx/rpc.tx.d.ts +8 -0
- package/types/codegen/wasmx/wasmx/contract.d.ts +122 -0
- package/types/codegen/wasmx/wasmx/genesis.d.ts +107 -0
- package/types/codegen/wasmx/wasmx/params.d.ts +14 -0
- package/types/codegen/wasmx/wasmx/query.d.ts +451 -0
- package/types/codegen/wasmx/wasmx/query.lcd.d.ts +17 -0
- package/types/codegen/wasmx/wasmx/query.rpc.Query.d.ts +48 -0
- package/types/codegen/wasmx/wasmx/tx.amino.d.ts +110 -0
- package/types/codegen/wasmx/wasmx/tx.d.ts +332 -0
- package/types/codegen/wasmx/wasmx/tx.registry.d.ts +136 -0
- package/types/codegen/wasmx/wasmx/tx.rpc.msg.d.ts +33 -0
- package/types/index.d.ts +1 -0
|
@@ -0,0 +1,945 @@
|
|
|
1
|
+
import * as _m0 from "protobufjs/minimal";
|
|
2
|
+
import { isSet } from "../../helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Defines the HTTP configuration for an API service. It contains a list of
|
|
5
|
+
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
|
6
|
+
* to one or more HTTP REST API methods.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface Http {
|
|
10
|
+
/**
|
|
11
|
+
* A list of HTTP configuration rules that apply to individual API methods.
|
|
12
|
+
*
|
|
13
|
+
* **NOTE:** All service configuration rules follow "last one wins" order.
|
|
14
|
+
*/
|
|
15
|
+
rules: HttpRule[];
|
|
16
|
+
/**
|
|
17
|
+
* When set to true, URL path parmeters will be fully URI-decoded except in
|
|
18
|
+
* cases of single segment matches in reserved expansion, where "%2F" will be
|
|
19
|
+
* left encoded.
|
|
20
|
+
*
|
|
21
|
+
* The default behavior is to not decode RFC 6570 reserved characters in multi
|
|
22
|
+
* segment matches.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
fullyDecodeReservedExpansion: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Defines the HTTP configuration for an API service. It contains a list of
|
|
29
|
+
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
|
30
|
+
* to one or more HTTP REST API methods.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export interface HttpSDKType {
|
|
34
|
+
/**
|
|
35
|
+
* A list of HTTP configuration rules that apply to individual API methods.
|
|
36
|
+
*
|
|
37
|
+
* **NOTE:** All service configuration rules follow "last one wins" order.
|
|
38
|
+
*/
|
|
39
|
+
rules: HttpRuleSDKType[];
|
|
40
|
+
/**
|
|
41
|
+
* When set to true, URL path parmeters will be fully URI-decoded except in
|
|
42
|
+
* cases of single segment matches in reserved expansion, where "%2F" will be
|
|
43
|
+
* left encoded.
|
|
44
|
+
*
|
|
45
|
+
* The default behavior is to not decode RFC 6570 reserved characters in multi
|
|
46
|
+
* segment matches.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
fully_decode_reserved_expansion: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
|
53
|
+
* REST API methods. The mapping specifies how different portions of the RPC
|
|
54
|
+
* request message are mapped to URL path, URL query parameters, and
|
|
55
|
+
* HTTP request body. The mapping is typically specified as an
|
|
56
|
+
* `google.api.http` annotation on the RPC method,
|
|
57
|
+
* see "google/api/annotations.proto" for details.
|
|
58
|
+
*
|
|
59
|
+
* The mapping consists of a field specifying the path template and
|
|
60
|
+
* method kind. The path template can refer to fields in the request
|
|
61
|
+
* message, as in the example below which describes a REST GET
|
|
62
|
+
* operation on a resource collection of messages:
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
* service Messaging {
|
|
66
|
+
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
67
|
+
* option (google.api.http).get =
|
|
68
|
+
* "/v1/messages/{message_id}/{sub.subfield}";
|
|
69
|
+
* }
|
|
70
|
+
* }
|
|
71
|
+
* message GetMessageRequest {
|
|
72
|
+
* message SubMessage {
|
|
73
|
+
* string subfield = 1;
|
|
74
|
+
* }
|
|
75
|
+
* string message_id = 1; // mapped to the URL
|
|
76
|
+
* SubMessage sub = 2; // `sub.subfield` is url-mapped
|
|
77
|
+
* }
|
|
78
|
+
* message Message {
|
|
79
|
+
* string text = 1; // content of the resource
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* The same http annotation can alternatively be expressed inside the
|
|
83
|
+
* `GRPC API Configuration` YAML file.
|
|
84
|
+
*
|
|
85
|
+
* http:
|
|
86
|
+
* rules:
|
|
87
|
+
* - selector: <proto_package_name>.Messaging.GetMessage
|
|
88
|
+
* get: /v1/messages/{message_id}/{sub.subfield}
|
|
89
|
+
*
|
|
90
|
+
* This definition enables an automatic, bidrectional mapping of HTTP
|
|
91
|
+
* JSON to RPC. Example:
|
|
92
|
+
*
|
|
93
|
+
* HTTP | RPC
|
|
94
|
+
* -----|-----
|
|
95
|
+
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub:
|
|
96
|
+
* SubMessage(subfield: "foo"))`
|
|
97
|
+
*
|
|
98
|
+
* In general, not only fields but also field paths can be referenced
|
|
99
|
+
* from a path pattern. Fields mapped to the path pattern cannot be
|
|
100
|
+
* repeated and must have a primitive (non-message) type.
|
|
101
|
+
*
|
|
102
|
+
* Any fields in the request message which are not bound by the path
|
|
103
|
+
* pattern automatically become (optional) HTTP query
|
|
104
|
+
* parameters. Assume the following definition of the request message:
|
|
105
|
+
*
|
|
106
|
+
*
|
|
107
|
+
* service Messaging {
|
|
108
|
+
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
109
|
+
* option (google.api.http).get = "/v1/messages/{message_id}";
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
* message GetMessageRequest {
|
|
113
|
+
* message SubMessage {
|
|
114
|
+
* string subfield = 1;
|
|
115
|
+
* }
|
|
116
|
+
* string message_id = 1; // mapped to the URL
|
|
117
|
+
* int64 revision = 2; // becomes a parameter
|
|
118
|
+
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
|
119
|
+
* }
|
|
120
|
+
*
|
|
121
|
+
*
|
|
122
|
+
* This enables a HTTP JSON to RPC mapping as below:
|
|
123
|
+
*
|
|
124
|
+
* HTTP | RPC
|
|
125
|
+
* -----|-----
|
|
126
|
+
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
|
|
127
|
+
* `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
|
|
128
|
+
* "foo"))`
|
|
129
|
+
*
|
|
130
|
+
* Note that fields which are mapped to HTTP parameters must have a
|
|
131
|
+
* primitive type or a repeated primitive type. Message types are not
|
|
132
|
+
* allowed. In the case of a repeated type, the parameter can be
|
|
133
|
+
* repeated in the URL, as in `...?param=A¶m=B`.
|
|
134
|
+
*
|
|
135
|
+
* For HTTP method kinds which allow a request body, the `body` field
|
|
136
|
+
* specifies the mapping. Consider a REST update method on the
|
|
137
|
+
* message resource collection:
|
|
138
|
+
*
|
|
139
|
+
*
|
|
140
|
+
* service Messaging {
|
|
141
|
+
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
|
142
|
+
* option (google.api.http) = {
|
|
143
|
+
* put: "/v1/messages/{message_id}"
|
|
144
|
+
* body: "message"
|
|
145
|
+
* };
|
|
146
|
+
* }
|
|
147
|
+
* }
|
|
148
|
+
* message UpdateMessageRequest {
|
|
149
|
+
* string message_id = 1; // mapped to the URL
|
|
150
|
+
* Message message = 2; // mapped to the body
|
|
151
|
+
* }
|
|
152
|
+
*
|
|
153
|
+
*
|
|
154
|
+
* The following HTTP JSON to RPC mapping is enabled, where the
|
|
155
|
+
* representation of the JSON in the request body is determined by
|
|
156
|
+
* protos JSON encoding:
|
|
157
|
+
*
|
|
158
|
+
* HTTP | RPC
|
|
159
|
+
* -----|-----
|
|
160
|
+
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
|
161
|
+
* "123456" message { text: "Hi!" })`
|
|
162
|
+
*
|
|
163
|
+
* The special name `*` can be used in the body mapping to define that
|
|
164
|
+
* every field not bound by the path template should be mapped to the
|
|
165
|
+
* request body. This enables the following alternative definition of
|
|
166
|
+
* the update method:
|
|
167
|
+
*
|
|
168
|
+
* service Messaging {
|
|
169
|
+
* rpc UpdateMessage(Message) returns (Message) {
|
|
170
|
+
* option (google.api.http) = {
|
|
171
|
+
* put: "/v1/messages/{message_id}"
|
|
172
|
+
* body: "*"
|
|
173
|
+
* };
|
|
174
|
+
* }
|
|
175
|
+
* }
|
|
176
|
+
* message Message {
|
|
177
|
+
* string message_id = 1;
|
|
178
|
+
* string text = 2;
|
|
179
|
+
* }
|
|
180
|
+
*
|
|
181
|
+
*
|
|
182
|
+
* The following HTTP JSON to RPC mapping is enabled:
|
|
183
|
+
*
|
|
184
|
+
* HTTP | RPC
|
|
185
|
+
* -----|-----
|
|
186
|
+
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
|
187
|
+
* "123456" text: "Hi!")`
|
|
188
|
+
*
|
|
189
|
+
* Note that when using `*` in the body mapping, it is not possible to
|
|
190
|
+
* have HTTP parameters, as all fields not bound by the path end in
|
|
191
|
+
* the body. This makes this option more rarely used in practice of
|
|
192
|
+
* defining REST APIs. The common usage of `*` is in custom methods
|
|
193
|
+
* which don't use the URL at all for transferring data.
|
|
194
|
+
*
|
|
195
|
+
* It is possible to define multiple HTTP methods for one RPC by using
|
|
196
|
+
* the `additional_bindings` option. Example:
|
|
197
|
+
*
|
|
198
|
+
* service Messaging {
|
|
199
|
+
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
200
|
+
* option (google.api.http) = {
|
|
201
|
+
* get: "/v1/messages/{message_id}"
|
|
202
|
+
* additional_bindings {
|
|
203
|
+
* get: "/v1/users/{user_id}/messages/{message_id}"
|
|
204
|
+
* }
|
|
205
|
+
* };
|
|
206
|
+
* }
|
|
207
|
+
* }
|
|
208
|
+
* message GetMessageRequest {
|
|
209
|
+
* string message_id = 1;
|
|
210
|
+
* string user_id = 2;
|
|
211
|
+
* }
|
|
212
|
+
*
|
|
213
|
+
*
|
|
214
|
+
* This enables the following two alternative HTTP JSON to RPC
|
|
215
|
+
* mappings:
|
|
216
|
+
*
|
|
217
|
+
* HTTP | RPC
|
|
218
|
+
* -----|-----
|
|
219
|
+
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
|
220
|
+
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
|
|
221
|
+
* "123456")`
|
|
222
|
+
*
|
|
223
|
+
* # Rules for HTTP mapping
|
|
224
|
+
*
|
|
225
|
+
* The rules for mapping HTTP path, query parameters, and body fields
|
|
226
|
+
* to the request message are as follows:
|
|
227
|
+
*
|
|
228
|
+
* 1. The `body` field specifies either `*` or a field path, or is
|
|
229
|
+
* omitted. If omitted, it indicates there is no HTTP request body.
|
|
230
|
+
* 2. Leaf fields (recursive expansion of nested messages in the
|
|
231
|
+
* request) can be classified into three types:
|
|
232
|
+
* (a) Matched in the URL template.
|
|
233
|
+
* (b) Covered by body (if body is `*`, everything except (a) fields;
|
|
234
|
+
* else everything under the body field)
|
|
235
|
+
* (c) All other fields.
|
|
236
|
+
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
|
237
|
+
* 4. Any body sent with an HTTP request can contain only (b) fields.
|
|
238
|
+
*
|
|
239
|
+
* The syntax of the path template is as follows:
|
|
240
|
+
*
|
|
241
|
+
* Template = "/" Segments [ Verb ] ;
|
|
242
|
+
* Segments = Segment { "/" Segment } ;
|
|
243
|
+
* Segment = "*" | "**" | LITERAL | Variable ;
|
|
244
|
+
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
|
245
|
+
* FieldPath = IDENT { "." IDENT } ;
|
|
246
|
+
* Verb = ":" LITERAL ;
|
|
247
|
+
*
|
|
248
|
+
* The syntax `*` matches a single path segment. The syntax `**` matches zero
|
|
249
|
+
* or more path segments, which must be the last part of the path except the
|
|
250
|
+
* `Verb`. The syntax `LITERAL` matches literal text in the path.
|
|
251
|
+
*
|
|
252
|
+
* The syntax `Variable` matches part of the URL path as specified by its
|
|
253
|
+
* template. A variable template must not contain other variables. If a variable
|
|
254
|
+
* matches a single path segment, its template may be omitted, e.g. `{var}`
|
|
255
|
+
* is equivalent to `{var=*}`.
|
|
256
|
+
*
|
|
257
|
+
* If a variable contains exactly one path segment, such as `"{var}"` or
|
|
258
|
+
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
|
|
259
|
+
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
|
|
260
|
+
* Discovery Document as `{var}`.
|
|
261
|
+
*
|
|
262
|
+
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
|
|
263
|
+
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
|
|
264
|
+
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
|
|
265
|
+
* show up in the Discovery Document as `{+var}`.
|
|
266
|
+
*
|
|
267
|
+
* NOTE: While the single segment variable matches the semantics of
|
|
268
|
+
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
|
|
269
|
+
* Simple String Expansion, the multi segment variable **does not** match
|
|
270
|
+
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
|
|
271
|
+
* does not expand special characters like `?` and `#`, which would lead
|
|
272
|
+
* to invalid URLs.
|
|
273
|
+
*
|
|
274
|
+
* NOTE: the field paths in variables and in the `body` must not refer to
|
|
275
|
+
* repeated fields or map fields.
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
export interface HttpRule {
|
|
279
|
+
/**
|
|
280
|
+
* Selects methods to which this rule applies.
|
|
281
|
+
*
|
|
282
|
+
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
|
|
283
|
+
* details.
|
|
284
|
+
*/
|
|
285
|
+
selector: string;
|
|
286
|
+
/** Used for listing and getting information about resources. */
|
|
287
|
+
|
|
288
|
+
get?: string;
|
|
289
|
+
/** Used for updating a resource. */
|
|
290
|
+
|
|
291
|
+
put?: string;
|
|
292
|
+
/** Used for creating a resource. */
|
|
293
|
+
|
|
294
|
+
post?: string;
|
|
295
|
+
/** Used for deleting a resource. */
|
|
296
|
+
|
|
297
|
+
delete?: string;
|
|
298
|
+
/** Used for updating a resource. */
|
|
299
|
+
|
|
300
|
+
patch?: string;
|
|
301
|
+
/**
|
|
302
|
+
* The custom pattern is used for specifying an HTTP method that is not
|
|
303
|
+
* included in the `pattern` field, such as HEAD, or "*" to leave the
|
|
304
|
+
* HTTP method unspecified for this rule. The wild-card rule is useful
|
|
305
|
+
* for services that provide content to Web (HTML) clients.
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
custom?: CustomHttpPattern;
|
|
309
|
+
/**
|
|
310
|
+
* The name of the request field whose value is mapped to the HTTP body, or
|
|
311
|
+
* `*` for mapping all fields not captured by the path pattern to the HTTP
|
|
312
|
+
* body. NOTE: the referred field must not be a repeated field and must be
|
|
313
|
+
* present at the top-level of request message type.
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
body: string;
|
|
317
|
+
/**
|
|
318
|
+
* Optional. The name of the response field whose value is mapped to the HTTP
|
|
319
|
+
* body of response. Other response fields are ignored. When
|
|
320
|
+
* not set, the response message will be used as HTTP body of response.
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
responseBody: string;
|
|
324
|
+
/**
|
|
325
|
+
* Additional HTTP bindings for the selector. Nested bindings must
|
|
326
|
+
* not contain an `additional_bindings` field themselves (that is,
|
|
327
|
+
* the nesting may only be one level deep).
|
|
328
|
+
*/
|
|
329
|
+
|
|
330
|
+
additionalBindings: HttpRule[];
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
|
334
|
+
* REST API methods. The mapping specifies how different portions of the RPC
|
|
335
|
+
* request message are mapped to URL path, URL query parameters, and
|
|
336
|
+
* HTTP request body. The mapping is typically specified as an
|
|
337
|
+
* `google.api.http` annotation on the RPC method,
|
|
338
|
+
* see "google/api/annotations.proto" for details.
|
|
339
|
+
*
|
|
340
|
+
* The mapping consists of a field specifying the path template and
|
|
341
|
+
* method kind. The path template can refer to fields in the request
|
|
342
|
+
* message, as in the example below which describes a REST GET
|
|
343
|
+
* operation on a resource collection of messages:
|
|
344
|
+
*
|
|
345
|
+
*
|
|
346
|
+
* service Messaging {
|
|
347
|
+
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
348
|
+
* option (google.api.http).get =
|
|
349
|
+
* "/v1/messages/{message_id}/{sub.subfield}";
|
|
350
|
+
* }
|
|
351
|
+
* }
|
|
352
|
+
* message GetMessageRequest {
|
|
353
|
+
* message SubMessage {
|
|
354
|
+
* string subfield = 1;
|
|
355
|
+
* }
|
|
356
|
+
* string message_id = 1; // mapped to the URL
|
|
357
|
+
* SubMessage sub = 2; // `sub.subfield` is url-mapped
|
|
358
|
+
* }
|
|
359
|
+
* message Message {
|
|
360
|
+
* string text = 1; // content of the resource
|
|
361
|
+
* }
|
|
362
|
+
*
|
|
363
|
+
* The same http annotation can alternatively be expressed inside the
|
|
364
|
+
* `GRPC API Configuration` YAML file.
|
|
365
|
+
*
|
|
366
|
+
* http:
|
|
367
|
+
* rules:
|
|
368
|
+
* - selector: <proto_package_name>.Messaging.GetMessage
|
|
369
|
+
* get: /v1/messages/{message_id}/{sub.subfield}
|
|
370
|
+
*
|
|
371
|
+
* This definition enables an automatic, bidrectional mapping of HTTP
|
|
372
|
+
* JSON to RPC. Example:
|
|
373
|
+
*
|
|
374
|
+
* HTTP | RPC
|
|
375
|
+
* -----|-----
|
|
376
|
+
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub:
|
|
377
|
+
* SubMessage(subfield: "foo"))`
|
|
378
|
+
*
|
|
379
|
+
* In general, not only fields but also field paths can be referenced
|
|
380
|
+
* from a path pattern. Fields mapped to the path pattern cannot be
|
|
381
|
+
* repeated and must have a primitive (non-message) type.
|
|
382
|
+
*
|
|
383
|
+
* Any fields in the request message which are not bound by the path
|
|
384
|
+
* pattern automatically become (optional) HTTP query
|
|
385
|
+
* parameters. Assume the following definition of the request message:
|
|
386
|
+
*
|
|
387
|
+
*
|
|
388
|
+
* service Messaging {
|
|
389
|
+
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
390
|
+
* option (google.api.http).get = "/v1/messages/{message_id}";
|
|
391
|
+
* }
|
|
392
|
+
* }
|
|
393
|
+
* message GetMessageRequest {
|
|
394
|
+
* message SubMessage {
|
|
395
|
+
* string subfield = 1;
|
|
396
|
+
* }
|
|
397
|
+
* string message_id = 1; // mapped to the URL
|
|
398
|
+
* int64 revision = 2; // becomes a parameter
|
|
399
|
+
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
|
400
|
+
* }
|
|
401
|
+
*
|
|
402
|
+
*
|
|
403
|
+
* This enables a HTTP JSON to RPC mapping as below:
|
|
404
|
+
*
|
|
405
|
+
* HTTP | RPC
|
|
406
|
+
* -----|-----
|
|
407
|
+
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
|
|
408
|
+
* `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
|
|
409
|
+
* "foo"))`
|
|
410
|
+
*
|
|
411
|
+
* Note that fields which are mapped to HTTP parameters must have a
|
|
412
|
+
* primitive type or a repeated primitive type. Message types are not
|
|
413
|
+
* allowed. In the case of a repeated type, the parameter can be
|
|
414
|
+
* repeated in the URL, as in `...?param=A¶m=B`.
|
|
415
|
+
*
|
|
416
|
+
* For HTTP method kinds which allow a request body, the `body` field
|
|
417
|
+
* specifies the mapping. Consider a REST update method on the
|
|
418
|
+
* message resource collection:
|
|
419
|
+
*
|
|
420
|
+
*
|
|
421
|
+
* service Messaging {
|
|
422
|
+
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
|
423
|
+
* option (google.api.http) = {
|
|
424
|
+
* put: "/v1/messages/{message_id}"
|
|
425
|
+
* body: "message"
|
|
426
|
+
* };
|
|
427
|
+
* }
|
|
428
|
+
* }
|
|
429
|
+
* message UpdateMessageRequest {
|
|
430
|
+
* string message_id = 1; // mapped to the URL
|
|
431
|
+
* Message message = 2; // mapped to the body
|
|
432
|
+
* }
|
|
433
|
+
*
|
|
434
|
+
*
|
|
435
|
+
* The following HTTP JSON to RPC mapping is enabled, where the
|
|
436
|
+
* representation of the JSON in the request body is determined by
|
|
437
|
+
* protos JSON encoding:
|
|
438
|
+
*
|
|
439
|
+
* HTTP | RPC
|
|
440
|
+
* -----|-----
|
|
441
|
+
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
|
442
|
+
* "123456" message { text: "Hi!" })`
|
|
443
|
+
*
|
|
444
|
+
* The special name `*` can be used in the body mapping to define that
|
|
445
|
+
* every field not bound by the path template should be mapped to the
|
|
446
|
+
* request body. This enables the following alternative definition of
|
|
447
|
+
* the update method:
|
|
448
|
+
*
|
|
449
|
+
* service Messaging {
|
|
450
|
+
* rpc UpdateMessage(Message) returns (Message) {
|
|
451
|
+
* option (google.api.http) = {
|
|
452
|
+
* put: "/v1/messages/{message_id}"
|
|
453
|
+
* body: "*"
|
|
454
|
+
* };
|
|
455
|
+
* }
|
|
456
|
+
* }
|
|
457
|
+
* message Message {
|
|
458
|
+
* string message_id = 1;
|
|
459
|
+
* string text = 2;
|
|
460
|
+
* }
|
|
461
|
+
*
|
|
462
|
+
*
|
|
463
|
+
* The following HTTP JSON to RPC mapping is enabled:
|
|
464
|
+
*
|
|
465
|
+
* HTTP | RPC
|
|
466
|
+
* -----|-----
|
|
467
|
+
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
|
468
|
+
* "123456" text: "Hi!")`
|
|
469
|
+
*
|
|
470
|
+
* Note that when using `*` in the body mapping, it is not possible to
|
|
471
|
+
* have HTTP parameters, as all fields not bound by the path end in
|
|
472
|
+
* the body. This makes this option more rarely used in practice of
|
|
473
|
+
* defining REST APIs. The common usage of `*` is in custom methods
|
|
474
|
+
* which don't use the URL at all for transferring data.
|
|
475
|
+
*
|
|
476
|
+
* It is possible to define multiple HTTP methods for one RPC by using
|
|
477
|
+
* the `additional_bindings` option. Example:
|
|
478
|
+
*
|
|
479
|
+
* service Messaging {
|
|
480
|
+
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
481
|
+
* option (google.api.http) = {
|
|
482
|
+
* get: "/v1/messages/{message_id}"
|
|
483
|
+
* additional_bindings {
|
|
484
|
+
* get: "/v1/users/{user_id}/messages/{message_id}"
|
|
485
|
+
* }
|
|
486
|
+
* };
|
|
487
|
+
* }
|
|
488
|
+
* }
|
|
489
|
+
* message GetMessageRequest {
|
|
490
|
+
* string message_id = 1;
|
|
491
|
+
* string user_id = 2;
|
|
492
|
+
* }
|
|
493
|
+
*
|
|
494
|
+
*
|
|
495
|
+
* This enables the following two alternative HTTP JSON to RPC
|
|
496
|
+
* mappings:
|
|
497
|
+
*
|
|
498
|
+
* HTTP | RPC
|
|
499
|
+
* -----|-----
|
|
500
|
+
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
|
501
|
+
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
|
|
502
|
+
* "123456")`
|
|
503
|
+
*
|
|
504
|
+
* # Rules for HTTP mapping
|
|
505
|
+
*
|
|
506
|
+
* The rules for mapping HTTP path, query parameters, and body fields
|
|
507
|
+
* to the request message are as follows:
|
|
508
|
+
*
|
|
509
|
+
* 1. The `body` field specifies either `*` or a field path, or is
|
|
510
|
+
* omitted. If omitted, it indicates there is no HTTP request body.
|
|
511
|
+
* 2. Leaf fields (recursive expansion of nested messages in the
|
|
512
|
+
* request) can be classified into three types:
|
|
513
|
+
* (a) Matched in the URL template.
|
|
514
|
+
* (b) Covered by body (if body is `*`, everything except (a) fields;
|
|
515
|
+
* else everything under the body field)
|
|
516
|
+
* (c) All other fields.
|
|
517
|
+
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
|
518
|
+
* 4. Any body sent with an HTTP request can contain only (b) fields.
|
|
519
|
+
*
|
|
520
|
+
* The syntax of the path template is as follows:
|
|
521
|
+
*
|
|
522
|
+
* Template = "/" Segments [ Verb ] ;
|
|
523
|
+
* Segments = Segment { "/" Segment } ;
|
|
524
|
+
* Segment = "*" | "**" | LITERAL | Variable ;
|
|
525
|
+
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
|
526
|
+
* FieldPath = IDENT { "." IDENT } ;
|
|
527
|
+
* Verb = ":" LITERAL ;
|
|
528
|
+
*
|
|
529
|
+
* The syntax `*` matches a single path segment. The syntax `**` matches zero
|
|
530
|
+
* or more path segments, which must be the last part of the path except the
|
|
531
|
+
* `Verb`. The syntax `LITERAL` matches literal text in the path.
|
|
532
|
+
*
|
|
533
|
+
* The syntax `Variable` matches part of the URL path as specified by its
|
|
534
|
+
* template. A variable template must not contain other variables. If a variable
|
|
535
|
+
* matches a single path segment, its template may be omitted, e.g. `{var}`
|
|
536
|
+
* is equivalent to `{var=*}`.
|
|
537
|
+
*
|
|
538
|
+
* If a variable contains exactly one path segment, such as `"{var}"` or
|
|
539
|
+
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
|
|
540
|
+
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
|
|
541
|
+
* Discovery Document as `{var}`.
|
|
542
|
+
*
|
|
543
|
+
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
|
|
544
|
+
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
|
|
545
|
+
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
|
|
546
|
+
* show up in the Discovery Document as `{+var}`.
|
|
547
|
+
*
|
|
548
|
+
* NOTE: While the single segment variable matches the semantics of
|
|
549
|
+
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
|
|
550
|
+
* Simple String Expansion, the multi segment variable **does not** match
|
|
551
|
+
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
|
|
552
|
+
* does not expand special characters like `?` and `#`, which would lead
|
|
553
|
+
* to invalid URLs.
|
|
554
|
+
*
|
|
555
|
+
* NOTE: the field paths in variables and in the `body` must not refer to
|
|
556
|
+
* repeated fields or map fields.
|
|
557
|
+
*/
|
|
558
|
+
|
|
559
|
+
export interface HttpRuleSDKType {
|
|
560
|
+
/**
|
|
561
|
+
* Selects methods to which this rule applies.
|
|
562
|
+
*
|
|
563
|
+
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
|
|
564
|
+
* details.
|
|
565
|
+
*/
|
|
566
|
+
selector: string;
|
|
567
|
+
/** Used for listing and getting information about resources. */
|
|
568
|
+
|
|
569
|
+
get?: string;
|
|
570
|
+
/** Used for updating a resource. */
|
|
571
|
+
|
|
572
|
+
put?: string;
|
|
573
|
+
/** Used for creating a resource. */
|
|
574
|
+
|
|
575
|
+
post?: string;
|
|
576
|
+
/** Used for deleting a resource. */
|
|
577
|
+
|
|
578
|
+
delete?: string;
|
|
579
|
+
/** Used for updating a resource. */
|
|
580
|
+
|
|
581
|
+
patch?: string;
|
|
582
|
+
/**
|
|
583
|
+
* The custom pattern is used for specifying an HTTP method that is not
|
|
584
|
+
* included in the `pattern` field, such as HEAD, or "*" to leave the
|
|
585
|
+
* HTTP method unspecified for this rule. The wild-card rule is useful
|
|
586
|
+
* for services that provide content to Web (HTML) clients.
|
|
587
|
+
*/
|
|
588
|
+
|
|
589
|
+
custom?: CustomHttpPatternSDKType;
|
|
590
|
+
/**
|
|
591
|
+
* The name of the request field whose value is mapped to the HTTP body, or
|
|
592
|
+
* `*` for mapping all fields not captured by the path pattern to the HTTP
|
|
593
|
+
* body. NOTE: the referred field must not be a repeated field and must be
|
|
594
|
+
* present at the top-level of request message type.
|
|
595
|
+
*/
|
|
596
|
+
|
|
597
|
+
body: string;
|
|
598
|
+
/**
|
|
599
|
+
* Optional. The name of the response field whose value is mapped to the HTTP
|
|
600
|
+
* body of response. Other response fields are ignored. When
|
|
601
|
+
* not set, the response message will be used as HTTP body of response.
|
|
602
|
+
*/
|
|
603
|
+
|
|
604
|
+
response_body: string;
|
|
605
|
+
/**
|
|
606
|
+
* Additional HTTP bindings for the selector. Nested bindings must
|
|
607
|
+
* not contain an `additional_bindings` field themselves (that is,
|
|
608
|
+
* the nesting may only be one level deep).
|
|
609
|
+
*/
|
|
610
|
+
|
|
611
|
+
additional_bindings: HttpRuleSDKType[];
|
|
612
|
+
}
|
|
613
|
+
/** A custom pattern is used for defining custom HTTP verb. */
|
|
614
|
+
|
|
615
|
+
export interface CustomHttpPattern {
|
|
616
|
+
/** The name of this custom HTTP verb. */
|
|
617
|
+
kind: string;
|
|
618
|
+
/** The path matched by this custom verb. */
|
|
619
|
+
|
|
620
|
+
path: string;
|
|
621
|
+
}
|
|
622
|
+
/** A custom pattern is used for defining custom HTTP verb. */
|
|
623
|
+
|
|
624
|
+
export interface CustomHttpPatternSDKType {
|
|
625
|
+
/** The name of this custom HTTP verb. */
|
|
626
|
+
kind: string;
|
|
627
|
+
/** The path matched by this custom verb. */
|
|
628
|
+
|
|
629
|
+
path: string;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function createBaseHttp(): Http {
|
|
633
|
+
return {
|
|
634
|
+
rules: [],
|
|
635
|
+
fullyDecodeReservedExpansion: false
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export const Http = {
|
|
640
|
+
encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
641
|
+
for (const v of message.rules) {
|
|
642
|
+
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
if (message.fullyDecodeReservedExpansion === true) {
|
|
646
|
+
writer.uint32(16).bool(message.fullyDecodeReservedExpansion);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
return writer;
|
|
650
|
+
},
|
|
651
|
+
|
|
652
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Http {
|
|
653
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
654
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
655
|
+
const message = createBaseHttp();
|
|
656
|
+
|
|
657
|
+
while (reader.pos < end) {
|
|
658
|
+
const tag = reader.uint32();
|
|
659
|
+
|
|
660
|
+
switch (tag >>> 3) {
|
|
661
|
+
case 1:
|
|
662
|
+
message.rules.push(HttpRule.decode(reader, reader.uint32()));
|
|
663
|
+
break;
|
|
664
|
+
|
|
665
|
+
case 2:
|
|
666
|
+
message.fullyDecodeReservedExpansion = reader.bool();
|
|
667
|
+
break;
|
|
668
|
+
|
|
669
|
+
default:
|
|
670
|
+
reader.skipType(tag & 7);
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
return message;
|
|
676
|
+
},
|
|
677
|
+
|
|
678
|
+
fromJSON(object: any): Http {
|
|
679
|
+
return {
|
|
680
|
+
rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [],
|
|
681
|
+
fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) ? Boolean(object.fullyDecodeReservedExpansion) : false
|
|
682
|
+
};
|
|
683
|
+
},
|
|
684
|
+
|
|
685
|
+
toJSON(message: Http): unknown {
|
|
686
|
+
const obj: any = {};
|
|
687
|
+
|
|
688
|
+
if (message.rules) {
|
|
689
|
+
obj.rules = message.rules.map(e => e ? HttpRule.toJSON(e) : undefined);
|
|
690
|
+
} else {
|
|
691
|
+
obj.rules = [];
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
message.fullyDecodeReservedExpansion !== undefined && (obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion);
|
|
695
|
+
return obj;
|
|
696
|
+
},
|
|
697
|
+
|
|
698
|
+
fromPartial(object: Partial<Http>): Http {
|
|
699
|
+
const message = createBaseHttp();
|
|
700
|
+
message.rules = object.rules?.map(e => HttpRule.fromPartial(e)) || [];
|
|
701
|
+
message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false;
|
|
702
|
+
return message;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
function createBaseHttpRule(): HttpRule {
|
|
708
|
+
return {
|
|
709
|
+
selector: "",
|
|
710
|
+
get: undefined,
|
|
711
|
+
put: undefined,
|
|
712
|
+
post: undefined,
|
|
713
|
+
delete: undefined,
|
|
714
|
+
patch: undefined,
|
|
715
|
+
custom: undefined,
|
|
716
|
+
body: "",
|
|
717
|
+
responseBody: "",
|
|
718
|
+
additionalBindings: []
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
export const HttpRule = {
|
|
723
|
+
encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
724
|
+
if (message.selector !== "") {
|
|
725
|
+
writer.uint32(10).string(message.selector);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
if (message.get !== undefined) {
|
|
729
|
+
writer.uint32(18).string(message.get);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if (message.put !== undefined) {
|
|
733
|
+
writer.uint32(26).string(message.put);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
if (message.post !== undefined) {
|
|
737
|
+
writer.uint32(34).string(message.post);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if (message.delete !== undefined) {
|
|
741
|
+
writer.uint32(42).string(message.delete);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
if (message.patch !== undefined) {
|
|
745
|
+
writer.uint32(50).string(message.patch);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
if (message.custom !== undefined) {
|
|
749
|
+
CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim();
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
if (message.body !== "") {
|
|
753
|
+
writer.uint32(58).string(message.body);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
if (message.responseBody !== "") {
|
|
757
|
+
writer.uint32(98).string(message.responseBody);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
for (const v of message.additionalBindings) {
|
|
761
|
+
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
return writer;
|
|
765
|
+
},
|
|
766
|
+
|
|
767
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule {
|
|
768
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
769
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
770
|
+
const message = createBaseHttpRule();
|
|
771
|
+
|
|
772
|
+
while (reader.pos < end) {
|
|
773
|
+
const tag = reader.uint32();
|
|
774
|
+
|
|
775
|
+
switch (tag >>> 3) {
|
|
776
|
+
case 1:
|
|
777
|
+
message.selector = reader.string();
|
|
778
|
+
break;
|
|
779
|
+
|
|
780
|
+
case 2:
|
|
781
|
+
message.get = reader.string();
|
|
782
|
+
break;
|
|
783
|
+
|
|
784
|
+
case 3:
|
|
785
|
+
message.put = reader.string();
|
|
786
|
+
break;
|
|
787
|
+
|
|
788
|
+
case 4:
|
|
789
|
+
message.post = reader.string();
|
|
790
|
+
break;
|
|
791
|
+
|
|
792
|
+
case 5:
|
|
793
|
+
message.delete = reader.string();
|
|
794
|
+
break;
|
|
795
|
+
|
|
796
|
+
case 6:
|
|
797
|
+
message.patch = reader.string();
|
|
798
|
+
break;
|
|
799
|
+
|
|
800
|
+
case 8:
|
|
801
|
+
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
|
|
802
|
+
break;
|
|
803
|
+
|
|
804
|
+
case 7:
|
|
805
|
+
message.body = reader.string();
|
|
806
|
+
break;
|
|
807
|
+
|
|
808
|
+
case 12:
|
|
809
|
+
message.responseBody = reader.string();
|
|
810
|
+
break;
|
|
811
|
+
|
|
812
|
+
case 11:
|
|
813
|
+
message.additionalBindings.push(HttpRule.decode(reader, reader.uint32()));
|
|
814
|
+
break;
|
|
815
|
+
|
|
816
|
+
default:
|
|
817
|
+
reader.skipType(tag & 7);
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
return message;
|
|
823
|
+
},
|
|
824
|
+
|
|
825
|
+
fromJSON(object: any): HttpRule {
|
|
826
|
+
return {
|
|
827
|
+
selector: isSet(object.selector) ? String(object.selector) : "",
|
|
828
|
+
get: isSet(object.get) ? String(object.get) : undefined,
|
|
829
|
+
put: isSet(object.put) ? String(object.put) : undefined,
|
|
830
|
+
post: isSet(object.post) ? String(object.post) : undefined,
|
|
831
|
+
delete: isSet(object.delete) ? String(object.delete) : undefined,
|
|
832
|
+
patch: isSet(object.patch) ? String(object.patch) : undefined,
|
|
833
|
+
custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined,
|
|
834
|
+
body: isSet(object.body) ? String(object.body) : "",
|
|
835
|
+
responseBody: isSet(object.responseBody) ? String(object.responseBody) : "",
|
|
836
|
+
additionalBindings: Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : []
|
|
837
|
+
};
|
|
838
|
+
},
|
|
839
|
+
|
|
840
|
+
toJSON(message: HttpRule): unknown {
|
|
841
|
+
const obj: any = {};
|
|
842
|
+
message.selector !== undefined && (obj.selector = message.selector);
|
|
843
|
+
message.get !== undefined && (obj.get = message.get);
|
|
844
|
+
message.put !== undefined && (obj.put = message.put);
|
|
845
|
+
message.post !== undefined && (obj.post = message.post);
|
|
846
|
+
message.delete !== undefined && (obj.delete = message.delete);
|
|
847
|
+
message.patch !== undefined && (obj.patch = message.patch);
|
|
848
|
+
message.custom !== undefined && (obj.custom = message.custom ? CustomHttpPattern.toJSON(message.custom) : undefined);
|
|
849
|
+
message.body !== undefined && (obj.body = message.body);
|
|
850
|
+
message.responseBody !== undefined && (obj.responseBody = message.responseBody);
|
|
851
|
+
|
|
852
|
+
if (message.additionalBindings) {
|
|
853
|
+
obj.additionalBindings = message.additionalBindings.map(e => e ? HttpRule.toJSON(e) : undefined);
|
|
854
|
+
} else {
|
|
855
|
+
obj.additionalBindings = [];
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
return obj;
|
|
859
|
+
},
|
|
860
|
+
|
|
861
|
+
fromPartial(object: Partial<HttpRule>): HttpRule {
|
|
862
|
+
const message = createBaseHttpRule();
|
|
863
|
+
message.selector = object.selector ?? "";
|
|
864
|
+
message.get = object.get ?? undefined;
|
|
865
|
+
message.put = object.put ?? undefined;
|
|
866
|
+
message.post = object.post ?? undefined;
|
|
867
|
+
message.delete = object.delete ?? undefined;
|
|
868
|
+
message.patch = object.patch ?? undefined;
|
|
869
|
+
message.custom = object.custom !== undefined && object.custom !== null ? CustomHttpPattern.fromPartial(object.custom) : undefined;
|
|
870
|
+
message.body = object.body ?? "";
|
|
871
|
+
message.responseBody = object.responseBody ?? "";
|
|
872
|
+
message.additionalBindings = object.additionalBindings?.map(e => HttpRule.fromPartial(e)) || [];
|
|
873
|
+
return message;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
function createBaseCustomHttpPattern(): CustomHttpPattern {
|
|
879
|
+
return {
|
|
880
|
+
kind: "",
|
|
881
|
+
path: ""
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
export const CustomHttpPattern = {
|
|
886
|
+
encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
887
|
+
if (message.kind !== "") {
|
|
888
|
+
writer.uint32(10).string(message.kind);
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
if (message.path !== "") {
|
|
892
|
+
writer.uint32(18).string(message.path);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
return writer;
|
|
896
|
+
},
|
|
897
|
+
|
|
898
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern {
|
|
899
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
900
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
901
|
+
const message = createBaseCustomHttpPattern();
|
|
902
|
+
|
|
903
|
+
while (reader.pos < end) {
|
|
904
|
+
const tag = reader.uint32();
|
|
905
|
+
|
|
906
|
+
switch (tag >>> 3) {
|
|
907
|
+
case 1:
|
|
908
|
+
message.kind = reader.string();
|
|
909
|
+
break;
|
|
910
|
+
|
|
911
|
+
case 2:
|
|
912
|
+
message.path = reader.string();
|
|
913
|
+
break;
|
|
914
|
+
|
|
915
|
+
default:
|
|
916
|
+
reader.skipType(tag & 7);
|
|
917
|
+
break;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
return message;
|
|
922
|
+
},
|
|
923
|
+
|
|
924
|
+
fromJSON(object: any): CustomHttpPattern {
|
|
925
|
+
return {
|
|
926
|
+
kind: isSet(object.kind) ? String(object.kind) : "",
|
|
927
|
+
path: isSet(object.path) ? String(object.path) : ""
|
|
928
|
+
};
|
|
929
|
+
},
|
|
930
|
+
|
|
931
|
+
toJSON(message: CustomHttpPattern): unknown {
|
|
932
|
+
const obj: any = {};
|
|
933
|
+
message.kind !== undefined && (obj.kind = message.kind);
|
|
934
|
+
message.path !== undefined && (obj.path = message.path);
|
|
935
|
+
return obj;
|
|
936
|
+
},
|
|
937
|
+
|
|
938
|
+
fromPartial(object: Partial<CustomHttpPattern>): CustomHttpPattern {
|
|
939
|
+
const message = createBaseCustomHttpPattern();
|
|
940
|
+
message.kind = object.kind ?? "";
|
|
941
|
+
message.path = object.path ?? "";
|
|
942
|
+
return message;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
};
|