Some API endpoints for articles #245

Merged
elegaanz merged 4 commits from rest-api into master 2018-09-29 15:33:31 +00:00
elegaanz commented 2018-09-25 19:51:07 +00:00 (Migrated from github.com)
  • Define the API with canapi
  • Implement canapi::Provider for Post (only get and list actually)
  • Use these functions to serve the API (/api/v1/posts/<id> and /api/v1/posts)
  • Document the API with Swagger (couldn't test it, I hope it will be served correctly 😕)

It is a first step for #5

- Define the API with canapi - Implement `canapi::Provider` for `Post` (only `get` and `list` actually) - Use these functions to serve the API (`/api/v1/posts/<id>` and `/api/v1/posts`) - Document the API with Swagger (couldn't test it, I hope it will be served correctly :confused:) It is a first step for #5
igalic (Migrated from github.com) reviewed 2018-09-27 20:06:33 +00:00
igalic (Migrated from github.com) left a comment

👀

👀
@ -5,6 +5,7 @@ version = "0.2.0"
[dependencies]
activitypub = "0.1.3"
atom_syndication = "0.6"
canapi = "0.1"
igalic (Migrated from github.com) commented 2018-09-27 19:53:48 +00:00

exciting Version number

exciting Version number
@ -0,0 +1,45 @@
openapi: "3.0"
igalic (Migrated from github.com) commented 2018-09-27 19:54:52 +00:00

is this autogenerated?

is this autogenerated?
@ -0,0 +13,4 @@
}
}
};
}
igalic (Migrated from github.com) commented 2018-09-27 20:04:07 +00:00

sometimes i dream of lisp indentation style in Javascript. soon, I'll start dreaming of lisp indentation style in rust

sometimes i dream of lisp indentation style in Javascript. soon, I'll start dreaming of lisp indentation style in rust
@ -58,0 +93,4 @@
}
fn create(_conn: &PgConnection, _query: PostEndpoint) -> Result<PostEndpoint, Error> {
unimplemented!()
igalic (Migrated from github.com) commented 2018-09-27 20:00:10 +00:00

what's the point of these queries and the override of the query variable?

what's the point of these queries and the override of the query variable?
igalic (Migrated from github.com) commented 2018-09-27 20:02:35 +00:00

aahh, you're fetching different parts of the same article, and stuffing them into different boxes of the query variable!

aahh, you're fetching different parts of the same article, and stuffing them into different boxes of the query variable!
igalic (Migrated from github.com) commented 2018-09-27 20:04:50 +00:00

why does this file keep changing with every new build?

why does this file keep changing with every new build?
igalic (Migrated from github.com) commented 2018-09-27 20:06:14 +00:00

such as?

such as?
elegaanz (Migrated from github.com) reviewed 2018-09-27 20:08:21 +00:00
@ -0,0 +1,45 @@
openapi: "3.0"
elegaanz (Migrated from github.com) commented 2018-09-27 20:08:21 +00:00

not yet, but it may be possible thanks to canapi…

not yet, but it may be possible thanks to canapi…
elegaanz (Migrated from github.com) reviewed 2018-09-27 20:11:10 +00:00
elegaanz (Migrated from github.com) commented 2018-09-27 20:11:10 +00:00

it is updated every time you run Plume. However, extracting i18n related task to an external tool may be better… 🤔

it is updated every time you run Plume. However, extracting i18n related task to an external tool may be better… :thinking:
elegaanz (Migrated from github.com) reviewed 2018-09-27 20:14:26 +00:00
elegaanz (Migrated from github.com) commented 2018-09-27 20:14:26 +00:00

For instance, if you GET /api/v1/posts?title=Hello%20world, only posts with the Hello world title should be shown (title is not the best example, but author_id could be interesting for instance)

For instance, if you `GET /api/v1/posts?title=Hello%20world`, only posts with the `Hello world` title should be shown (`title` is not the best example, but `author_id` could be interesting for instance)
elegaanz (Migrated from github.com) reviewed 2018-09-27 20:16:51 +00:00
@ -58,0 +93,4 @@
}
fn create(_conn: &PgConnection, _query: PostEndpoint) -> Result<PostEndpoint, Error> {
unimplemented!()
elegaanz (Migrated from github.com) commented 2018-09-27 20:16:51 +00:00

actually, the PostEndpoint type is here to represent both the client's query and the result sent by the API. filter is what is requested by the client, so if any filter have been specified I update the SQL query to only return the requested posts.

actually, the `PostEndpoint` type is here to represent both the client's query and the result sent by the API. `filter` is what is requested by the client, so if any filter have been specified I update the SQL `query` to only return the requested posts.
elegaanz (Migrated from github.com) reviewed 2018-09-27 20:17:22 +00:00
@ -58,0 +93,4 @@
}
fn create(_conn: &PgConnection, _query: PostEndpoint) -> Result<PostEndpoint, Error> {
unimplemented!()
elegaanz (Migrated from github.com) commented 2018-09-27 20:17:22 +00:00

not sure if I'm clear, tell me if not 😁

not sure if I'm clear, tell me if not :grin:
igalic commented 2018-09-28 12:10:11 +00:00 (Migrated from github.com)

i just realized how easy CLI mappings would be to implement, once the API is in place.

i just realized how easy CLI mappings would be to implement, once the API is in place.
trinity-1686a reviewed 2018-09-29 07:58:16 +00:00

So is this (at least partially) blocked by #149, or not related?

So is this (at least partially) blocked by #149, or not related?
elegaanz (Migrated from github.com) reviewed 2018-09-29 09:51:17 +00:00
elegaanz (Migrated from github.com) commented 2018-09-29 09:51:17 +00:00

No, actually we just need to get the raw query params, and deserialize them to PostEndpoint with something like serde_qs.

No, actually we just need to get the raw query params, and deserialize them to `PostEndpoint` with something like `serde_qs`.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Plume/Plume#245
No description provided.