Add Outline API client library foundation
Implements a first vertical slice of the Outline RPC API (auth, documents, collections, users) covering the structural patterns used across the whole API: single object, paginated list, tree, create/update, delete, search. Chosen as the basis for future CLI and GUI clients built on top of this crate. - Handwritten client (not codegen) against the vendored OpenAPI spec, since Outline's API is uniformly POST /api/<resource>.<action> with JSON bodies and inline/anonymous schemas that generators handle poorly - Async (reqwest + tokio) Client, cheaply cloneable, no &mut self methods - thiserror-based Error with ErrorKind classification and boxed API error context; forward-compatible models (unknown fields ignored, unknown string-enum values preserved via a catch-all variant) since the API is unversioned and self-hosted instances vary in age - Pagination via Page<T>/Paginator with next_page/collect_all/into_stream - wiremock-based test suite plus a spec-coverage test guarding against typos in RPC method names
This commit is contained in:
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"id": "5c3fa3dd-eb47-4239-8a5f-de5b5d6bf6e2",
|
||||
"collectionId": "9d3d1b2e-3c9a-4c67-8a2a-7f5d3f0e9c11",
|
||||
"parentDocumentId": null,
|
||||
"title": "Welcome to Acme Inc",
|
||||
"fullWidth": false,
|
||||
"icon": "🎉",
|
||||
"color": null,
|
||||
"text": "# Welcome\n\nThis is the text of the document.",
|
||||
"url": "/doc/welcome-to-acme-inc-hDYep1TPAM",
|
||||
"urlId": "hDYep1TPAM",
|
||||
"collaboratorIds": ["5c3fa3dd-eb47-4239-8a5f-de5b5d6bf6e2"],
|
||||
"tasks": { "completed": 1, "total": 4 },
|
||||
"revision": 12,
|
||||
"createdAt": "2024-01-15T10:00:00.000Z",
|
||||
"createdBy": {
|
||||
"id": "5c3fa3dd-eb47-4239-8a5f-de5b5d6bf6e2",
|
||||
"name": "Jane Doe",
|
||||
"email": "jane@example.com",
|
||||
"role": "admin",
|
||||
"isSuspended": false
|
||||
},
|
||||
"updatedAt": "2024-02-20T09:30:00.000Z",
|
||||
"publishedAt": "2024-01-15T11:00:00.000Z",
|
||||
"archivedAt": null,
|
||||
"deletedAt": null
|
||||
}
|
||||
Reference in New Issue
Block a user