offering-protocol 0.1.0__py3-none-any.whl

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.
Files changed (80) hide show
  1. offering_protocol/__init__.py +7 -0
  2. offering_protocol/agent/__init__.py +66 -0
  3. offering_protocol/agent/agent.py +135 -0
  4. offering_protocol/agent/cache.py +51 -0
  5. offering_protocol/agent/capabilities.py +262 -0
  6. offering_protocol/agent/client.py +667 -0
  7. offering_protocol/agent/details.py +227 -0
  8. offering_protocol/agent/schema.py +129 -0
  9. offering_protocol/core/__init__.py +64 -0
  10. offering_protocol/core/models.py +475 -0
  11. offering_protocol/core/references.py +135 -0
  12. offering_protocol/core/schemas/action-relation.schema.json +9 -0
  13. offering_protocol/core/schemas/action-request.schema.json +18 -0
  14. offering_protocol/core/schemas/action.schema.json +56 -0
  15. offering_protocol/core/schemas/attribute-schema-reference.schema.json +6 -0
  16. offering_protocol/core/schemas/authentication-requirement.schema.json +11 -0
  17. offering_protocol/core/schemas/capability-identifier.schema.json +9 -0
  18. offering_protocol/core/schemas/capability-link.schema.json +14 -0
  19. offering_protocol/core/schemas/collection-search-request.schema.json +45 -0
  20. offering_protocol/core/schemas/collection.schema.json +72 -0
  21. offering_protocol/core/schemas/detail-fields.schema.json +16 -0
  22. offering_protocol/core/schemas/enrollment-protocol.schema.json +15 -0
  23. offering_protocol/core/schemas/filter-capability-source.schema.json +41 -0
  24. offering_protocol/core/schemas/filter-definition-page.schema.json +25 -0
  25. offering_protocol/core/schemas/filter-definition.schema.json +63 -0
  26. offering_protocol/core/schemas/filter-expression.schema.json +45 -0
  27. offering_protocol/core/schemas/filter-operator.schema.json +14 -0
  28. offering_protocol/core/schemas/filter-type.schema.json +14 -0
  29. offering_protocol/core/schemas/filter-unit.schema.json +45 -0
  30. offering_protocol/core/schemas/http-action-target.schema.json +36 -0
  31. offering_protocol/core/schemas/invalid-parameter.schema.json +55 -0
  32. offering_protocol/core/schemas/local-resource-identifier-list.schema.json +10 -0
  33. offering_protocol/core/schemas/local-resource-identifier.schema.json +10 -0
  34. offering_protocol/core/schemas/mcp-endpoint.schema.json +29 -0
  35. offering_protocol/core/schemas/offering-search-request.schema.json +68 -0
  36. offering_protocol/core/schemas/offering-search-response.schema.json +20 -0
  37. offering_protocol/core/schemas/offering.schema.json +92 -0
  38. offering_protocol/core/schemas/openapi-action-target.schema.json +20 -0
  39. offering_protocol/core/schemas/operation-descriptor.schema.json +27 -0
  40. offering_protocol/core/schemas/page-envelope.schema.json +25 -0
  41. offering_protocol/core/schemas/page-limit.schema.json +8 -0
  42. offering_protocol/core/schemas/payment-option.schema.json +24 -0
  43. offering_protocol/core/schemas/payment-protocol.schema.json +34 -0
  44. offering_protocol/core/schemas/price-preview.schema.json +133 -0
  45. offering_protocol/core/schemas/problem-code.schema.json +9 -0
  46. offering_protocol/core/schemas/problem-details.schema.json +66 -0
  47. offering_protocol/core/schemas/protocol-version.schema.json +8 -0
  48. offering_protocol/core/schemas/refinement-bucket.schema.json +28 -0
  49. offering_protocol/core/schemas/refinement-group.schema.json +24 -0
  50. offering_protocol/core/schemas/representation.schema.json +11 -0
  51. offering_protocol/core/schemas/resource-identity.schema.json +27 -0
  52. offering_protocol/core/schemas/resource-image.schema.json +40 -0
  53. offering_protocol/core/schemas/resource-reference.schema.json +19 -0
  54. offering_protocol/core/schemas/schema-reference.schema.json +15 -0
  55. offering_protocol/core/schemas/search-capabilities.schema.json +26 -0
  56. offering_protocol/core/schemas/service-branding-image.schema.json +23 -0
  57. offering_protocol/core/schemas/service-branding.schema.json +19 -0
  58. offering_protocol/core/schemas/service-document.schema.json +337 -0
  59. offering_protocol/core/schemas/service-openapi.schema.json +15 -0
  60. offering_protocol/core/schemas/service-origin.schema.json +9 -0
  61. offering_protocol/core/schemas/service-protocols.schema.json +101 -0
  62. offering_protocol/core/schemas/sort-capability-source.schema.json +41 -0
  63. offering_protocol/core/schemas/sort-definition-page.schema.json +25 -0
  64. offering_protocol/core/schemas/sort-definition.schema.json +35 -0
  65. offering_protocol/core/schemas/sort-key.schema.json +28 -0
  66. offering_protocol/core/schemas/top-level-document.schema.json +16 -0
  67. offering_protocol/core/schemas/trust-protocol.schema.json +15 -0
  68. offering_protocol/core/validation.py +390 -0
  69. offering_protocol/directory/__init__.py +51 -0
  70. offering_protocol/directory/client.py +206 -0
  71. offering_protocol/directory/models.py +103 -0
  72. offering_protocol/directory/transport.py +145 -0
  73. offering_protocol/py.typed +1 -0
  74. offering_protocol/service/__init__.py +32 -0
  75. offering_protocol/service/service.py +444 -0
  76. offering_protocol/service/static_catalog.py +258 -0
  77. offering_protocol-0.1.0.dist-info/METADATA +362 -0
  78. offering_protocol-0.1.0.dist-info/RECORD +80 -0
  79. offering_protocol-0.1.0.dist-info/WHEEL +4 -0
  80. offering_protocol-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/service-branding.schema.json",
4
+ "title": "ODP Service branding",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "icon",
9
+ "logo"
10
+ ],
11
+ "properties": {
12
+ "icon": {
13
+ "$ref": "service-branding-image.schema.json"
14
+ },
15
+ "logo": {
16
+ "$ref": "service-branding-image.schema.json"
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,337 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/service-document.schema.json",
4
+ "title": "ODP Service Document",
5
+ "type": "object",
6
+ "required": [
7
+ "odp_version",
8
+ "name",
9
+ "description",
10
+ "language",
11
+ "localizations",
12
+ "operations",
13
+ "http"
14
+ ],
15
+ "properties": {
16
+ "odp_version": {
17
+ "const": "1.0"
18
+ },
19
+ "name": {
20
+ "type": "string",
21
+ "minLength": 1,
22
+ "maxLength": 128
23
+ },
24
+ "description": {
25
+ "type": "string",
26
+ "minLength": 1,
27
+ "maxLength": 1024
28
+ },
29
+ "documentation_url": {
30
+ "$ref": "resource-reference.schema.json"
31
+ },
32
+ "language": {
33
+ "type": "string",
34
+ "minLength": 2,
35
+ "maxLength": 35
36
+ },
37
+ "localizations": {
38
+ "type": "array",
39
+ "minItems": 1,
40
+ "maxItems": 16,
41
+ "uniqueItems": true,
42
+ "items": {
43
+ "type": "string",
44
+ "minLength": 2,
45
+ "maxLength": 35
46
+ }
47
+ },
48
+ "mcp": {
49
+ "type": "array",
50
+ "minItems": 1,
51
+ "items": {
52
+ "$ref": "mcp-endpoint.schema.json"
53
+ }
54
+ },
55
+ "keywords": {
56
+ "type": "array",
57
+ "maxItems": 32,
58
+ "uniqueItems": true,
59
+ "items": {
60
+ "type": "string",
61
+ "minLength": 1,
62
+ "maxLength": 64,
63
+ "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
64
+ }
65
+ },
66
+ "branding": {
67
+ "$ref": "service-branding.schema.json"
68
+ },
69
+ "operations": {
70
+ "type": "array",
71
+ "minItems": 2,
72
+ "maxItems": 7,
73
+ "allOf": [
74
+ {
75
+ "contains": {
76
+ "properties": {
77
+ "name": {
78
+ "const": "list-offerings"
79
+ }
80
+ },
81
+ "required": [
82
+ "name"
83
+ ]
84
+ }
85
+ },
86
+ {
87
+ "contains": {
88
+ "properties": {
89
+ "name": {
90
+ "const": "get-offering"
91
+ }
92
+ },
93
+ "required": [
94
+ "name"
95
+ ]
96
+ }
97
+ }
98
+ ],
99
+ "items": {
100
+ "$ref": "operation-descriptor.schema.json"
101
+ }
102
+ },
103
+ "http": {
104
+ "type": "object",
105
+ "required": [
106
+ "endpoint_base"
107
+ ],
108
+ "properties": {
109
+ "endpoint_base": {
110
+ "type": "string",
111
+ "maxLength": 2048,
112
+ "pattern": "^/(?!/)[A-Za-z0-9._~!$&'()*+,;=:@%/-]*$"
113
+ },
114
+ "openapi": {
115
+ "$ref": "service-openapi.schema.json"
116
+ }
117
+ }
118
+ },
119
+ "protocols": {
120
+ "$ref": "service-protocols.schema.json"
121
+ },
122
+ "payment_origins": {
123
+ "type": "array",
124
+ "minItems": 1,
125
+ "maxItems": 16,
126
+ "items": {
127
+ "$ref": "service-origin.schema.json"
128
+ }
129
+ },
130
+ "search_capabilities": {
131
+ "$ref": "search-capabilities.schema.json"
132
+ },
133
+ "status_url": {
134
+ "$ref": "resource-reference.schema.json"
135
+ },
136
+ "support_url": {
137
+ "$ref": "resource-reference.schema.json"
138
+ },
139
+ "website_url": {
140
+ "$ref": "resource-reference.schema.json"
141
+ }
142
+ },
143
+ "allOf": [
144
+ {
145
+ "$ref": "#/$defs/unique-operation-names"
146
+ },
147
+ {
148
+ "if": {
149
+ "properties": {
150
+ "operations": {
151
+ "contains": {
152
+ "properties": {
153
+ "authentication": {
154
+ "enum": [
155
+ "optional",
156
+ "required"
157
+ ]
158
+ }
159
+ },
160
+ "required": [
161
+ "authentication"
162
+ ]
163
+ }
164
+ }
165
+ },
166
+ "required": [
167
+ "operations"
168
+ ]
169
+ },
170
+ "then": {
171
+ "properties": {
172
+ "protocols": {
173
+ "required": [
174
+ "enrollment"
175
+ ]
176
+ }
177
+ },
178
+ "required": [
179
+ "protocols"
180
+ ]
181
+ }
182
+ }
183
+ ],
184
+ "$defs": {
185
+ "unique-operation-names": {
186
+ "allOf": [
187
+ {
188
+ "$ref": "#/$defs/at-most-one-get-collection"
189
+ },
190
+ {
191
+ "$ref": "#/$defs/at-most-one-get-offering"
192
+ },
193
+ {
194
+ "$ref": "#/$defs/at-most-one-list-collection-offerings"
195
+ },
196
+ {
197
+ "$ref": "#/$defs/at-most-one-list-collections"
198
+ },
199
+ {
200
+ "$ref": "#/$defs/at-most-one-list-offerings"
201
+ },
202
+ {
203
+ "$ref": "#/$defs/at-most-one-search-collections"
204
+ },
205
+ {
206
+ "$ref": "#/$defs/at-most-one-search-offerings"
207
+ }
208
+ ]
209
+ },
210
+ "at-most-one-get-collection": {
211
+ "properties": {
212
+ "operations": {
213
+ "contains": {
214
+ "properties": {
215
+ "name": {
216
+ "const": "get-collection"
217
+ }
218
+ },
219
+ "required": [
220
+ "name"
221
+ ]
222
+ },
223
+ "minContains": 0,
224
+ "maxContains": 1
225
+ }
226
+ }
227
+ },
228
+ "at-most-one-get-offering": {
229
+ "properties": {
230
+ "operations": {
231
+ "contains": {
232
+ "properties": {
233
+ "name": {
234
+ "const": "get-offering"
235
+ }
236
+ },
237
+ "required": [
238
+ "name"
239
+ ]
240
+ },
241
+ "minContains": 0,
242
+ "maxContains": 1
243
+ }
244
+ }
245
+ },
246
+ "at-most-one-list-collection-offerings": {
247
+ "properties": {
248
+ "operations": {
249
+ "contains": {
250
+ "properties": {
251
+ "name": {
252
+ "const": "list-collection-offerings"
253
+ }
254
+ },
255
+ "required": [
256
+ "name"
257
+ ]
258
+ },
259
+ "minContains": 0,
260
+ "maxContains": 1
261
+ }
262
+ }
263
+ },
264
+ "at-most-one-list-collections": {
265
+ "properties": {
266
+ "operations": {
267
+ "contains": {
268
+ "properties": {
269
+ "name": {
270
+ "const": "list-collections"
271
+ }
272
+ },
273
+ "required": [
274
+ "name"
275
+ ]
276
+ },
277
+ "minContains": 0,
278
+ "maxContains": 1
279
+ }
280
+ }
281
+ },
282
+ "at-most-one-list-offerings": {
283
+ "properties": {
284
+ "operations": {
285
+ "contains": {
286
+ "properties": {
287
+ "name": {
288
+ "const": "list-offerings"
289
+ }
290
+ },
291
+ "required": [
292
+ "name"
293
+ ]
294
+ },
295
+ "minContains": 0,
296
+ "maxContains": 1
297
+ }
298
+ }
299
+ },
300
+ "at-most-one-search-collections": {
301
+ "properties": {
302
+ "operations": {
303
+ "contains": {
304
+ "properties": {
305
+ "name": {
306
+ "const": "search-collections"
307
+ }
308
+ },
309
+ "required": [
310
+ "name"
311
+ ]
312
+ },
313
+ "minContains": 0,
314
+ "maxContains": 1
315
+ }
316
+ }
317
+ },
318
+ "at-most-one-search-offerings": {
319
+ "properties": {
320
+ "operations": {
321
+ "contains": {
322
+ "properties": {
323
+ "name": {
324
+ "const": "search-offerings"
325
+ }
326
+ },
327
+ "required": [
328
+ "name"
329
+ ]
330
+ },
331
+ "minContains": 0,
332
+ "maxContains": 1
333
+ }
334
+ }
335
+ }
336
+ }
337
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/service-openapi.schema.json",
4
+ "title": "ODP Service OpenAPI reference",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "url"
9
+ ],
10
+ "properties": {
11
+ "url": {
12
+ "$ref": "resource-reference.schema.json"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/service-origin.schema.json",
4
+ "title": "ODP Service origin",
5
+ "description": "The canonical serialized origin of the final ODP Service Document URL.",
6
+ "type": "string",
7
+ "format": "uri",
8
+ "pattern": "^(?:https://(?![^/?#]*@)(?:[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?|\\[[0-9a-f:]+\\])(?::(?!443$)[0-9]{1,5})?|http://(?:localhost|127\\.0\\.0\\.1|\\[::1\\])(?::(?!80$)[0-9]{1,5})?)$"
9
+ }
@@ -0,0 +1,101 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/service-protocols.schema.json",
4
+ "title": "ODP Service protocol support",
5
+ "type": "object",
6
+ "minProperties": 1,
7
+ "properties": {
8
+ "enrollment": {
9
+ "type": "array",
10
+ "minItems": 1,
11
+ "maxItems": 1,
12
+ "uniqueItems": true,
13
+ "items": {
14
+ "$ref": "enrollment-protocol.schema.json"
15
+ }
16
+ },
17
+ "payments": {
18
+ "type": "array",
19
+ "minItems": 1,
20
+ "maxItems": 2,
21
+ "uniqueItems": true,
22
+ "items": {
23
+ "$ref": "payment-protocol.schema.json"
24
+ }
25
+ },
26
+ "trust": {
27
+ "type": "array",
28
+ "minItems": 1,
29
+ "maxItems": 1,
30
+ "uniqueItems": true,
31
+ "items": {
32
+ "$ref": "trust-protocol.schema.json"
33
+ }
34
+ }
35
+ },
36
+ "allOf": [
37
+ {
38
+ "properties": {
39
+ "payments": {
40
+ "contains": {
41
+ "properties": {
42
+ "name": {
43
+ "const": "mpp"
44
+ }
45
+ },
46
+ "required": [
47
+ "name"
48
+ ]
49
+ },
50
+ "minContains": 0,
51
+ "maxContains": 1
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "properties": {
57
+ "payments": {
58
+ "contains": {
59
+ "properties": {
60
+ "name": {
61
+ "const": "x402"
62
+ }
63
+ },
64
+ "required": [
65
+ "name"
66
+ ]
67
+ },
68
+ "minContains": 0,
69
+ "maxContains": 1
70
+ }
71
+ }
72
+ },
73
+ {
74
+ "if": {
75
+ "properties": {
76
+ "payments": {
77
+ "contains": {
78
+ "properties": {
79
+ "authentication": {
80
+ "const": "required"
81
+ }
82
+ },
83
+ "required": [
84
+ "authentication"
85
+ ]
86
+ }
87
+ }
88
+ },
89
+ "required": [
90
+ "payments"
91
+ ]
92
+ },
93
+ "then": {
94
+ "required": [
95
+ "enrollment"
96
+ ]
97
+ }
98
+ }
99
+ ],
100
+ "additionalProperties": false
101
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/sort-capability-source.schema.json",
4
+ "title": "ODP Sort Definition source",
5
+ "type": "object",
6
+ "oneOf": [
7
+ {
8
+ "required": [
9
+ "inline"
10
+ ],
11
+ "not": {
12
+ "required": [
13
+ "linked"
14
+ ]
15
+ }
16
+ },
17
+ {
18
+ "required": [
19
+ "linked"
20
+ ],
21
+ "not": {
22
+ "required": [
23
+ "inline"
24
+ ]
25
+ }
26
+ }
27
+ ],
28
+ "properties": {
29
+ "inline": {
30
+ "type": "array",
31
+ "minItems": 1,
32
+ "maxItems": 16,
33
+ "items": {
34
+ "$ref": "sort-definition.schema.json"
35
+ }
36
+ },
37
+ "linked": {
38
+ "$ref": "capability-link.schema.json"
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/sort-definition-page.schema.json",
4
+ "title": "ODP Sort Definition page",
5
+ "type": "object",
6
+ "required": [
7
+ "odp_version",
8
+ "items"
9
+ ],
10
+ "properties": {
11
+ "odp_version": {
12
+ "const": "1.0"
13
+ },
14
+ "items": {
15
+ "type": "array",
16
+ "maxItems": 100,
17
+ "items": {
18
+ "$ref": "sort-definition.schema.json"
19
+ }
20
+ },
21
+ "next": {
22
+ "$ref": "resource-reference.schema.json"
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/sort-definition.schema.json",
4
+ "title": "ODP Sort Definition",
5
+ "type": "object",
6
+ "required": [
7
+ "id",
8
+ "title",
9
+ "description",
10
+ "keys"
11
+ ],
12
+ "properties": {
13
+ "id": {
14
+ "$ref": "capability-identifier.schema.json"
15
+ },
16
+ "title": {
17
+ "type": "string",
18
+ "minLength": 1,
19
+ "maxLength": 128
20
+ },
21
+ "description": {
22
+ "type": "string",
23
+ "minLength": 1,
24
+ "maxLength": 1024
25
+ },
26
+ "keys": {
27
+ "type": "array",
28
+ "minItems": 1,
29
+ "maxItems": 3,
30
+ "items": {
31
+ "$ref": "sort-key.schema.json"
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/sort-key.schema.json",
4
+ "title": "ODP Sort Key",
5
+ "type": "object",
6
+ "required": [
7
+ "filter_id",
8
+ "direction",
9
+ "missing"
10
+ ],
11
+ "properties": {
12
+ "filter_id": {
13
+ "$ref": "capability-identifier.schema.json"
14
+ },
15
+ "direction": {
16
+ "enum": [
17
+ "ascending",
18
+ "descending"
19
+ ]
20
+ },
21
+ "missing": {
22
+ "enum": [
23
+ "first",
24
+ "last"
25
+ ]
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/top-level-document.schema.json",
4
+ "title": "ODP top-level document",
5
+ "description": "The version-bearing envelope shared by top-level ODP request and response documents.",
6
+ "type": "object",
7
+ "required": [
8
+ "odp_version"
9
+ ],
10
+ "additionalProperties": true,
11
+ "properties": {
12
+ "odp_version": {
13
+ "$ref": "protocol-version.schema.json"
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://offeringprotocol.org/schemas/trust-protocol.schema.json",
4
+ "title": "ODP Trust Protocol Descriptor",
5
+ "type": "object",
6
+ "required": [
7
+ "name"
8
+ ],
9
+ "properties": {
10
+ "name": {
11
+ "const": "tap"
12
+ }
13
+ },
14
+ "additionalProperties": false
15
+ }