Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support v12.89.1 #67

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
- id: setup_env
run: ./ci/testenv/setup.sh
env:
MISSKEY_IMAGE: 'misskey/misskey:12.75.1'
MISSKEY_IMAGE: 'misskey/misskey:12.89.1'
MISSKEY_ID: aid
- run: cargo test --features 12-75-0
- run: cargo test --features 12-89-1
timeout-minutes: 15
env:
TEST_API_URL: http://localhost:3000/api/
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/flaky.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ jobs:
strategy:
matrix:
include:
- image: 'misskey/misskey:12.89.1'
flags: --features 12-89-1
- image: 'misskey/misskey:12.89.0'
flags: --features 12-89-0
- image: 'misskey/misskey:12.88.0'
flags: --features 12-88-0
- image: 'misskey/misskey:12.82.0'
flags: --features 12-82-0
- image: 'misskey/misskey:12.81.0'
flags: --features 12-81-0
- image: 'misskey/misskey:12.80.0'
flags: --features 12-80-0
- image: 'misskey/misskey:12.79.2'
flags: --features 12-79-2
- image: 'misskey/misskey:12.79.0'
flags: --features 12-79-0
- image: 'misskey/misskey:12.77.1'
flags: --features 12-77-1
- image: 'misskey/misskey:12.77.0'
flags: --features 12-77-0
- image: 'misskey/misskey:12.75.0'
flags: --features 12-75-0
- image: 'misskey/misskey:12.71.0'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
- id: setup_env
run: ./ci/testenv/setup.sh
env:
MISSKEY_IMAGE: 'misskey/misskey:12.75.1'
MISSKEY_IMAGE: 'misskey/misskey:12.89.1'
MISSKEY_ID: aid
- run: cargo test --features 12-75-0
- run: cargo test --features 12-89-1
timeout-minutes: 15
env:
TEST_API_URL: http://localhost:3000/api/
Expand Down
24 changes: 23 additions & 1 deletion misskey-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support for Misskey v12.69.0
- Support for Misskey v12.70.0
- Support for Misskey v12.71.0 ~ v12.74.1
- Support for Misskey v12.75.0 ~ v12.75.1
- Support for Misskey v12.75.0 ~ v12.76.1
- `muted_notification_types` user setting which is available since v12.48.0
- Page related endpoints
- endpoint `pages/*`
- endpoint `i/pages`
- endpoint `i/page_likes`
- Support for Misskey v12.77.0
- Support for Misskey v12.77.1 ~ v12.78.0
- endpoint `notifications/read`
- Support for Misskey v12.79.0 ~ v12.79.1
- endpoint `gallery/*`
- endpoint `i/gallery/*`
- endpoint `users/gallery/posts`
- Support for Misskey v12.79.2 ~ v12.79.3
- endpoint `gallery/posts/delete`
- endpoint `gallery/posts/update`
- Partial support for Misskey v12.80.0 ~ v12.80.3
- endpoint `admin/ad/*`
- Support for Misskey v12.81.0 ~ 12.81.2
- endpoint `admin/get-index-stats`
- Support for Misskey v12.82.0 ~ v12.87.0
- Partial support for Misskey v12.88.0
- Support for Misskey v12.89.0
- Support for Misskey v12.89.1 ~ v12.90.1

### Changed
### Deprecated
Expand All @@ -35,6 +53,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `ClientSettingUpdated` variant from `MainStreamEvent`
- For Misskey v12.67.0 ~ v12.68.0
- Latest version flag from being enabled as default
- endpoint `users`
- For Misskey v12.88.0
- endpoint `users/recommendation`
- For Misskey v12.88.0 ~

### Fixed

Expand Down
10 changes: 10 additions & 0 deletions misskey-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ categories = ["api-bindings"]
[features]
default = ["aid"]

12-89-1 = ["12-89-0"]
12-89-0 = ["12-88-0"]
12-88-0 = ["12-82-0"]
12-82-0 = ["12-81-0"]
12-81-0 = ["12-80-0"]
12-80-0 = ["12-79-2"]
12-79-2 = ["12-79-0"]
12-79-0 = ["12-77-1"]
12-77-1 = ["12-77-0"]
12-77-0 = ["12-75-0"]
12-75-0 = ["12-71-0"]
12-71-0 = ["12-70-0"]
12-70-0 = ["12-69-0"]
Expand Down
4 changes: 4 additions & 0 deletions misskey-api/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ pub mod server_info;
#[cfg(feature = "12-67-0")]
#[cfg_attr(docsrs, doc(cfg(feature = "12-67-0")))]
pub mod ping;

#[cfg(feature = "12-79-0")]
#[cfg_attr(docsrs, doc(cfg(feature = "12-79-0")))]
pub mod gallery;
8 changes: 8 additions & 0 deletions misskey-api/src/endpoint/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ pub mod remove_abuse_user_report;
#[cfg(feature = "12-49-0")]
#[cfg_attr(docsrs, doc(cfg(feature = "12-49-0")))]
pub mod resolve_abuse_user_report;

#[cfg(feature = "12-80-0")]
#[cfg_attr(docsrs, doc(cfg(feature = "12-80-0")))]
pub mod ad;

#[cfg(feature = "12-81-0")]
#[cfg_attr(docsrs, doc(cfg(feature = "12-81-0")))]
pub mod get_index_stats;
4 changes: 4 additions & 0 deletions misskey-api/src/endpoint/admin/ad.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub mod create;
pub mod delete;
pub mod list;
pub mod update;
64 changes: 64 additions & 0 deletions misskey-api/src/endpoint/admin/ad/create.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
use chrono::{serde::ts_milliseconds, DateTime, Utc};
use serde::Serialize;
use typed_builder::TypedBuilder;

use crate::model::ad::{Place, Priority};

#[derive(Serialize, Debug, Clone, TypedBuilder)]
#[serde(rename_all = "camelCase")]
#[builder(doc)]
pub struct Request {
/// [ 1 .. ] characters
#[builder(setter(into))]
pub url: String,
#[builder(default, setter(into))]
pub memo: String,
#[builder(default)]
pub place: Place,
#[builder(default)]
pub priority: Priority,
#[cfg(feature = "12-81-0")]
#[cfg_attr(docsrs, doc(cfg(feature = "12-81-0")))]
#[builder(default, setter(into))]
pub ratio: u64,
#[serde(with = "ts_milliseconds")]
#[builder(setter(into))]
pub expires_at: DateTime<Utc>,
/// [ 1 .. ] characters
#[builder(setter(into))]
pub image_url: String,
}

impl misskey_core::Request for Request {
type Response = ();
const ENDPOINT: &'static str = "admin/ad/create";
}

#[cfg(test)]
mod tests {
use super::Request;
use crate::{
model::ad::{Place, Priority},
test::{ClientExt, TestClient},
};

#[tokio::test]
async fn request() {
let client = TestClient::new();
let url = client.avatar_url().await;

client
.admin
.test(Request {
url: url.to_string(),
memo: "memo".to_string(),
place: Place::Square,
priority: Priority::Middle,
#[cfg(feature = "12-81-0")]
ratio: 1,
image_url: url.to_string(),
expires_at: chrono::Utc::now() + chrono::Duration::hours(1),
})
.await;
}
}
44 changes: 44 additions & 0 deletions misskey-api/src/endpoint/admin/ad/delete.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
use crate::model::{ad::Ad, id::Id};

use serde::Serialize;

#[derive(Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Request {
pub id: Id<Ad>,
}

impl misskey_core::Request for Request {
type Response = ();
const ENDPOINT: &'static str = "admin/ad/delete";
}

#[cfg(test)]
mod tests {
use super::Request;
use crate::test::{ClientExt, TestClient};

#[tokio::test]
async fn request() {
let client = TestClient::new();
let url = client.avatar_url().await;

client
.admin
.test(
crate::endpoint::admin::ad::create::Request::builder()
.url(url.clone())
.image_url(url.clone())
.expires_at(chrono::Utc::now() + chrono::Duration::hours(1))
.build(),
)
.await;

let ads = client
.admin
.test(crate::endpoint::admin::ad::list::Request::default())
.await;

client.admin.test(Request { id: ads[0].id }).await;
}
}
80 changes: 80 additions & 0 deletions misskey-api/src/endpoint/admin/ad/list.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
use crate::model::{ad::Ad, id::Id};

use serde::Serialize;
use typed_builder::TypedBuilder;

#[derive(Serialize, Default, Debug, Clone, TypedBuilder)]
#[serde(rename_all = "camelCase")]
#[builder(doc)]
pub struct Request {
/// 1 .. 100
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub limit: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub since_id: Option<Id<Ad>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub until_id: Option<Id<Ad>>,
}

impl misskey_core::Request for Request {
type Response = Vec<Ad>;
const ENDPOINT: &'static str = "admin/ad/list";
}

impl_pagination!(Request, Ad);

#[cfg(test)]
mod tests {
use super::Request;
use crate::test::{ClientExt, TestClient};

#[tokio::test]
async fn request() {
let client = TestClient::new();
client.admin.test(Request::default()).await;
}

#[tokio::test]
async fn request_with_limit() {
let client = TestClient::new();

client
.admin
.test(Request {
limit: Some(100),
since_id: None,
until_id: None,
})
.await;
}

#[tokio::test]
async fn request_paginate() {
let client = TestClient::new();
let url = client.avatar_url().await;
client
.admin
.test(
crate::endpoint::admin::ad::create::Request::builder()
.url(url.clone())
.image_url(url.clone())
.expires_at(chrono::Utc::now() + chrono::Duration::hours(1))
.build(),
)
.await;

let ads = client.admin.test(Request::default()).await;

client
.admin
.test(Request {
limit: None,
since_id: Some(ads[0].id.clone()),
until_id: Some(ads[0].id.clone()),
})
.await;
}
}
Loading