[][src]Module misskey::endpoint

API endpoints.

Each endpoint is implemented under modules named by replacing / with :: and - with _ in the endpoint name. For example, notes/local-timeline is implemented under notes::local_timeline and drive/files/create is implemented under drive::files::create.

All request types implement Request. We dispatch it actually and get the response using Client::request.

Example

Create a note using /api/notes/create:

client
    .request(
        // Each endpoint implementation has a corresponding `Request` type.
        // We can dispatch an API call by passing `Request` to `Client::request` method.
        // Here, we build a `Request` to `notes/create` using a `Request::builder()`.
        misskey::endpoint::notes::create::Request::builder()
            .text("Hello, Misskey")
            .build(),
    )
    // Asynchronously wait for the response.
    // `Client::request` method returns `Result<ApiResult<T>>`.
    // The returned `Result` may contain an error happened on our side
    // (e.g. networking failure or deserialization error)
    .await?
    // Convert `ApiResult<T>` to `Result<T, ApiError>` using `ApiResult::into_result`.
    // `ApiError` is an error which is returned from Misskey API.
    .into_result()?;

Get your own information from /api/i:

    let me = client
        .request(misskey::endpoint::i::Request::default())
        .await?
        .into_result()?;
    println!("{:?}", me);

Re-exports

pub use misskey_api::endpoint::*;

Traits

OffsetPaginationRequest

Request that can be paginated via offset.

PaginationRequest

Request that can be paginated via since_id and until_id.

Request

API request.

UploadFileRequest

Request that requires a file to upload.