Some API endpoints for articles #245

Birleştirildi
elegaanz 6 yıl önce rest-api içindeki 4 işlemeyi master ile birleştirdi
elegaanz 6 yıl önce yorum yaptı (github.com konumundan göç edildi)
  • 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 (github.com konumundan göç edildi) 6 yıl önce incelendi
igalic (github.com konumundan göç edildi) bir yorum yaptı

👀

👀
@ -5,6 +5,7 @@ version = "0.2.0"
[dependencies]
activitypub = "0.1.3"
atom_syndication = "0.6"
canapi = "0.1"
igalic (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

exciting Version number

exciting Version number
@ -0,0 +1,45 @@
openapi: "3.0"
igalic (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

is this autogenerated?

is this autogenerated?
@ -0,0 +13,4 @@
}
}
};
}
igalic (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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 (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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 (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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 (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

why does this file keep changing with every new build?

why does this file keep changing with every new build?
igalic (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

such as?

such as?
elegaanz (github.com konumundan göç edildi) 6 yıl önce incelendi
@ -0,0 +1,45 @@
openapi: "3.0"
elegaanz (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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

not yet, but it may be possible thanks to canapi…
elegaanz (github.com konumundan göç edildi) 6 yıl önce incelendi
elegaanz (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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 (github.com konumundan göç edildi) 6 yıl önce incelendi
elegaanz (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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 (github.com konumundan göç edildi) 6 yıl önce incelendi
@ -58,0 +93,4 @@
}
fn create(_conn: &PgConnection, _query: PostEndpoint) -> Result<PostEndpoint, Error> {
unimplemented!()
elegaanz (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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 (github.com konumundan göç edildi) 6 yıl önce incelendi
@ -58,0 +93,4 @@
}
fn create(_conn: &PgConnection, _query: PostEndpoint) -> Result<PostEndpoint, Error> {
unimplemented!()
elegaanz (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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

not sure if I'm clear, tell me if not :grin:
igalic 6 yıl önce yorum yaptı (github.com konumundan göç edildi)

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 6 yıl önce incelendi
Sahibi

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 (github.com konumundan göç edildi) 6 yıl önce incelendi
elegaanz (github.com konumundan göç edildi) 6 yıl önce yorum yaptı

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`.
Değişiklik isteği 236cf14406 olarak birleştirildi.
komut satırı talimatlarını da görüntüleyebilirsiniz.

1. Adım:

Proje deponuzdan yeni bir dala göz atın ve değişiklikleri test edin.
git checkout -b rest-api master
git pull origin rest-api

2. Adım:

Forgejo'daki değişiklikleri ve güncellemeleri birleştirin.
git checkout master
git merge --no-ff rest-api
git push origin master
Bu konuşmaya katılmak için oturum aç.
Değerlendirici yok
Kilometre Taşı Yok
Atanan Kişi Yok
2 Katılımcı
Bildirimler
Bitiş Tarihi
Bitiş tarihi geçersiz veya aralık dışında. Lütfen 'yyyy-aa-gg' biçimini kullanın.

Bitiş tarihi atanmadı.

Bağımlılıklar

Bağımlılık yok.

Referans: Plume/Plume#245
Yükleniyor…
Henüz bir içerik yok.