mergetbapi 0.0.1__tar.gz

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.
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2024 USC INFORMATION SCIENCES INSTITUTE
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.1
2
+ Name: mergetbapi
3
+ Version: 0.0.1
4
+ Summary: Python bindings for the GRPC client interface to the MergeTB API
5
+ Author-email: Brian Kocoloski <bkocolos@isi.edu>
6
+ Project-URL: Homepage, https://gitlab.com/mergetb/api
7
+ Project-URL: Issues, https://gitlab.com/mergetb/api/-/issues
8
+ Project-URL: Documentation, https://mergetb.gitlab.io/api/
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Development Status :: 4 - Beta
15
+ Requires-Python: >=3.8
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE.md
18
+ Requires-Dist: betterproto==2.0.0b6
19
+ Requires-Dist: grpclib==0.4.7
20
+
21
+ # mergetb_api
22
+
23
+ This package contains Python bindings for the GRPC client interface to MergeTB API
24
+
@@ -0,0 +1,4 @@
1
+ # mergetb_api
2
+
3
+ This package contains Python bindings for the GRPC client interface to MergeTB API
4
+
@@ -0,0 +1,26 @@
1
+ [project]
2
+ name = "mergetbapi"
3
+ version = "0.0.1"
4
+ authors = [
5
+ { name="Brian Kocoloski", email="bkocolos@isi.edu" },
6
+ ]
7
+ description = "Python bindings for the GRPC client interface to the MergeTB API"
8
+ readme = "README.md"
9
+ requires-python = ">=3.8"
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Operating System :: OS Independent",
14
+ "Intended Audience :: Developers",
15
+ "Intended Audience :: End Users/Desktop",
16
+ "Development Status :: 4 - Beta",
17
+ ]
18
+ dependencies = [
19
+ "betterproto==2.0.0b6",
20
+ "grpclib==0.4.7",
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://gitlab.com/mergetb/api"
25
+ Issues = "https://gitlab.com/mergetb/api/-/issues"
26
+ Documentation = "https://mergetb.gitlab.io/api/"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
File without changes
@@ -0,0 +1,255 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # sources: google/api/annotations.proto, google/api/field_behavior.proto, google/api/http.proto
3
+ # plugin: python-betterproto
4
+ # This file has been @generated
5
+
6
+ from dataclasses import dataclass
7
+ from typing import List
8
+
9
+ import betterproto
10
+
11
+
12
+ class FieldBehavior(betterproto.Enum):
13
+ """
14
+ An indicator of the behavior of a given field (for example, that a field is
15
+ required in requests, or given as output but ignored as input). This **does
16
+ not** change the behavior in protocol buffers itself; it only denotes the
17
+ behavior and may affect how API tooling handles the field. Note: This enum
18
+ **may** receive new values in the future.
19
+ """
20
+
21
+ FIELD_BEHAVIOR_UNSPECIFIED = 0
22
+ """Conventional default for enums. Do not use this."""
23
+
24
+ OPTIONAL = 1
25
+ """
26
+ Specifically denotes a field as optional. While all fields in protocol
27
+ buffers are optional, this may be specified for emphasis if appropriate.
28
+ """
29
+
30
+ REQUIRED = 2
31
+ """
32
+ Denotes a field as required. This indicates that the field **must** be
33
+ provided as part of the request, and failure to do so will cause an error
34
+ (usually `INVALID_ARGUMENT`).
35
+ """
36
+
37
+ OUTPUT_ONLY = 3
38
+ """
39
+ Denotes a field as output only. This indicates that the field is provided
40
+ in responses, but including the field in a request does nothing (the server
41
+ *must* ignore it and *must not* throw an error as a result of the field's
42
+ presence).
43
+ """
44
+
45
+ INPUT_ONLY = 4
46
+ """
47
+ Denotes a field as input only. This indicates that the field is provided in
48
+ requests, and the corresponding field is not included in output.
49
+ """
50
+
51
+ IMMUTABLE = 5
52
+ """
53
+ Denotes a field as immutable. This indicates that the field may be set once
54
+ in a request to create a resource, but may not be changed thereafter.
55
+ """
56
+
57
+
58
+ @dataclass(eq=False, repr=False)
59
+ class Http(betterproto.Message):
60
+ """
61
+ Defines the HTTP configuration for an API service. It contains a list of
62
+ [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC
63
+ method to one or more HTTP REST API methods.
64
+ """
65
+
66
+ rules: List["HttpRule"] = betterproto.message_field(1)
67
+ """
68
+ A list of HTTP configuration rules that apply to individual API methods.
69
+ **NOTE:** All service configuration rules follow "last one wins" order.
70
+ """
71
+
72
+ fully_decode_reserved_expansion: bool = betterproto.bool_field(2)
73
+ """
74
+ When set to true, URL path parmeters will be fully URI-decoded except in
75
+ cases of single segment matches in reserved expansion, where "%2F" will be
76
+ left encoded. The default behavior is to not decode RFC 6570 reserved
77
+ characters in multi segment matches.
78
+ """
79
+
80
+
81
+ @dataclass(eq=False, repr=False)
82
+ class HttpRule(betterproto.Message):
83
+ """
84
+ `HttpRule` defines the mapping of an RPC method to one or more HTTP REST
85
+ API methods. The mapping specifies how different portions of the RPC
86
+ request message are mapped to URL path, URL query parameters, and HTTP
87
+ request body. The mapping is typically specified as an `google.api.http`
88
+ annotation on the RPC method, see "google/api/annotations.proto" for
89
+ details. The mapping consists of a field specifying the path template and
90
+ method kind. The path template can refer to fields in the request message,
91
+ as in the example below which describes a REST GET operation on a resource
92
+ collection of messages: service Messaging { rpc
93
+ GetMessage(GetMessageRequest) returns (Message) { option
94
+ (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; }
95
+ } message GetMessageRequest { message SubMessage { string
96
+ subfield = 1; } string message_id = 1; // mapped to the URL
97
+ SubMessage sub = 2; // `sub.subfield` is url-mapped } message
98
+ Message { string text = 1; // content of the resource } The same
99
+ http annotation can alternatively be expressed inside the `GRPC API
100
+ Configuration` YAML file. http: rules: - selector:
101
+ <proto_package_name>.Messaging.GetMessage get:
102
+ /v1/messages/{message_id}/{sub.subfield} This definition enables an
103
+ automatic, bidrectional mapping of HTTP JSON to RPC. Example: HTTP | RPC
104
+ -----|----- `GET /v1/messages/123456/foo` | `GetMessage(message_id:
105
+ "123456" sub: SubMessage(subfield: "foo"))` In general, not only fields but
106
+ also field paths can be referenced from a path pattern. Fields mapped to
107
+ the path pattern cannot be repeated and must have a primitive (non-message)
108
+ type. Any fields in the request message which are not bound by the path
109
+ pattern automatically become (optional) HTTP query parameters. Assume the
110
+ following definition of the request message: service Messaging {
111
+ rpc GetMessage(GetMessageRequest) returns (Message) { option
112
+ (google.api.http).get = "/v1/messages/{message_id}"; } }
113
+ message GetMessageRequest { message SubMessage { string
114
+ subfield = 1; } string message_id = 1; // mapped to the URL
115
+ int64 revision = 2; // becomes a parameter SubMessage sub = 3;
116
+ // `sub.subfield` becomes a parameter } This enables a HTTP JSON to RPC
117
+ mapping as below: HTTP | RPC -----|----- `GET
118
+ /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id:
119
+ "123456" revision: 2 sub: SubMessage(subfield: "foo"))` Note that fields
120
+ which are mapped to HTTP parameters must have a primitive type or a
121
+ repeated primitive type. Message types are not allowed. In the case of a
122
+ repeated type, the parameter can be repeated in the URL, as in
123
+ `...?param=A&param=B`. For HTTP method kinds which allow a request body,
124
+ the `body` field specifies the mapping. Consider a REST update method on
125
+ the message resource collection: service Messaging { rpc
126
+ UpdateMessage(UpdateMessageRequest) returns (Message) { option
127
+ (google.api.http) = { put: "/v1/messages/{message_id}"
128
+ body: "message" }; } } message UpdateMessageRequest {
129
+ string message_id = 1; // mapped to the URL Message message = 2; //
130
+ mapped to the body } The following HTTP JSON to RPC mapping is enabled,
131
+ where the representation of the JSON in the request body is determined by
132
+ protos JSON encoding: HTTP | RPC -----|----- `PUT /v1/messages/123456 {
133
+ "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text:
134
+ "Hi!" })` The special name `*` can be used in the body mapping to define
135
+ that every field not bound by the path template should be mapped to the
136
+ request body. This enables the following alternative definition of the
137
+ update method: service Messaging { rpc UpdateMessage(Message)
138
+ returns (Message) { option (google.api.http) = { put:
139
+ "/v1/messages/{message_id}" body: "*" }; } }
140
+ message Message { string message_id = 1; string text = 2; }
141
+ The following HTTP JSON to RPC mapping is enabled: HTTP | RPC -----|-----
142
+ `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
143
+ "123456" text: "Hi!")` Note that when using `*` in the body mapping, it is
144
+ not possible to have HTTP parameters, as all fields not bound by the path
145
+ end in the body. This makes this option more rarely used in practice of
146
+ defining REST APIs. The common usage of `*` is in custom methods which
147
+ don't use the URL at all for transferring data. It is possible to define
148
+ multiple HTTP methods for one RPC by using the `additional_bindings`
149
+ option. Example: service Messaging { rpc
150
+ GetMessage(GetMessageRequest) returns (Message) { option
151
+ (google.api.http) = { get: "/v1/messages/{message_id}"
152
+ additional_bindings { get:
153
+ "/v1/users/{user_id}/messages/{message_id}" } }; }
154
+ } message GetMessageRequest { string message_id = 1; string
155
+ user_id = 2; } This enables the following two alternative HTTP JSON to
156
+ RPC mappings: HTTP | RPC -----|----- `GET /v1/messages/123456` |
157
+ `GetMessage(message_id: "123456")` `GET /v1/users/me/messages/123456` |
158
+ `GetMessage(user_id: "me" message_id: "123456")` # Rules for HTTP mapping
159
+ The rules for mapping HTTP path, query parameters, and body fields to the
160
+ request message are as follows: 1. The `body` field specifies either `*` or
161
+ a field path, or is omitted. If omitted, it indicates there is no HTTP
162
+ request body. 2. Leaf fields (recursive expansion of nested messages in the
163
+ request) can be classified into three types: (a) Matched in the URL
164
+ template. (b) Covered by body (if body is `*`, everything except (a)
165
+ fields; else everything under the body field) (c) All other
166
+ fields. 3. URL query parameters found in the HTTP request are mapped to (c)
167
+ fields. 4. Any body sent with an HTTP request can contain only (b) fields.
168
+ The syntax of the path template is as follows: Template = "/" Segments
169
+ [ Verb ] ; Segments = Segment { "/" Segment } ; Segment = "*" |
170
+ "**" | LITERAL | Variable ; Variable = "{" FieldPath [ "=" Segments ]
171
+ "}" ; FieldPath = IDENT { "." IDENT } ; Verb = ":" LITERAL ;
172
+ The syntax `*` matches a single path segment. The syntax `**` matches zero
173
+ or more path segments, which must be the last part of the path except the
174
+ `Verb`. The syntax `LITERAL` matches literal text in the path. The syntax
175
+ `Variable` matches part of the URL path as specified by its template. A
176
+ variable template must not contain other variables. If a variable matches a
177
+ single path segment, its template may be omitted, e.g. `{var}` is
178
+ equivalent to `{var=*}`. If a variable contains exactly one path segment,
179
+ such as `"{var}"` or `"{var=*}"`, when such a variable is expanded into a
180
+ URL path, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. Such
181
+ variables show up in the Discovery Document as `{var}`. If a variable
182
+ contains one or more path segments, such as `"{var=foo/*}"` or
183
+ `"{var=**}"`, when such a variable is expanded into a URL path, all
184
+ characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
185
+ show up in the Discovery Document as `{+var}`. NOTE: While the single
186
+ segment variable matches the semantics of [RFC
187
+ 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
188
+ Expansion, the multi segment variable **does not** match RFC 6570 Reserved
189
+ Expansion. The reason is that the Reserved Expansion does not expand
190
+ special characters like `?` and `#`, which would lead to invalid URLs.
191
+ NOTE: the field paths in variables and in the `body` must not refer to
192
+ repeated fields or map fields.
193
+ """
194
+
195
+ selector: str = betterproto.string_field(1)
196
+ """
197
+ Selects methods to which this rule applies. Refer to
198
+ [selector][google.api.DocumentationRule.selector] for syntax details.
199
+ """
200
+
201
+ get: str = betterproto.string_field(2, group="pattern")
202
+ """Used for listing and getting information about resources."""
203
+
204
+ put: str = betterproto.string_field(3, group="pattern")
205
+ """Used for updating a resource."""
206
+
207
+ post: str = betterproto.string_field(4, group="pattern")
208
+ """Used for creating a resource."""
209
+
210
+ delete: str = betterproto.string_field(5, group="pattern")
211
+ """Used for deleting a resource."""
212
+
213
+ patch: str = betterproto.string_field(6, group="pattern")
214
+ """Used for updating a resource."""
215
+
216
+ custom: "CustomHttpPattern" = betterproto.message_field(8, group="pattern")
217
+ """
218
+ The custom pattern is used for specifying an HTTP method that is not
219
+ included in the `pattern` field, such as HEAD, or "*" to leave the HTTP
220
+ method unspecified for this rule. The wild-card rule is useful for services
221
+ that provide content to Web (HTML) clients.
222
+ """
223
+
224
+ body: str = betterproto.string_field(7)
225
+ """
226
+ The name of the request field whose value is mapped to the HTTP body, or
227
+ `*` for mapping all fields not captured by the path pattern to the HTTP
228
+ body. NOTE: the referred field must not be a repeated field and must be
229
+ present at the top-level of request message type.
230
+ """
231
+
232
+ response_body: str = betterproto.string_field(12)
233
+ """
234
+ Optional. The name of the response field whose value is mapped to the HTTP
235
+ body of response. Other response fields are ignored. When not set, the
236
+ response message will be used as HTTP body of response.
237
+ """
238
+
239
+ additional_bindings: List["HttpRule"] = betterproto.message_field(11)
240
+ """
241
+ Additional HTTP bindings for the selector. Nested bindings must not contain
242
+ an `additional_bindings` field themselves (that is, the nesting may only be
243
+ one level deep).
244
+ """
245
+
246
+
247
+ @dataclass(eq=False, repr=False)
248
+ class CustomHttpPattern(betterproto.Message):
249
+ """A custom pattern is used for defining custom HTTP verb."""
250
+
251
+ kind: str = betterproto.string_field(1)
252
+ """The name of this custom HTTP verb."""
253
+
254
+ path: str = betterproto.string_field(2)
255
+ """The path matched by this custom verb."""
File without changes
File without changes