fix(python): refactoring python client

refactoring several pieces of the client and the Python wrapper to make them more usable.
This commit is contained in:
Scott Lyons 2024-08-21 08:36:59 -07:00
commit f2ae459c22
11 changed files with 275 additions and 95 deletions

View file

@ -22,7 +22,7 @@
//! ```
//!
//! For all other methods for making the requests, see the documentation.
#![feature(cfg_eval)]
#![warn(missing_docs)]
#![warn(rustdoc::missing_crate_level_docs)]
@ -34,9 +34,6 @@ pub use client::SzurubooruRequest;
pub mod errors;
pub use errors::SzurubooruResult;
pub mod models;
#[cfg(feature = "python")]
pub mod pyclient;
pub mod tokens;
#[cfg(feature = "python")]
@ -49,27 +46,26 @@ use pyo3::prelude::*;
#[cfg_attr(feature = "python", pymodule)]
/// A Python wrapper around [SzurubooruClient]
mod szurubooru_client {
use pyo3::prelude::*;
#[pymodule_export]
pub use crate::{
errors::SzuruPyClientError,
models::{
AroundPostResult, CommentResource, GlobalInfo, ImageSearchResult,
ImageSearchSimilarPost, MergePool, MergePost, MergeTags, MicroPoolResource,
MicroPostResource, MicroTagResource, MicroUserResource, NoteResource,
PoolCategoryResource, PoolResource, PostResource, PostSafety, PostType,
SnapshotCreationDeletionData, SnapshotData, SnapshotModificationData,
SnapshotOperationType, SnapshotResource, SnapshotResourceType, TagCategoryResource,
TagResource, TagSibling, TemporaryFileUpload, UserAuthTokenResource, UserAvatarStyle,
UserRank, UserResource,
ImageSearchSimilarPost, MicroPoolResource, MicroPostResource, MicroTagResource,
MicroUserResource, NoteResource, PoolCategoryResource, PoolResource, PostResource,
PostSafety, PostType, SnapshotCreationDeletionData, SnapshotData,
SnapshotModificationData, SnapshotOperationType, SnapshotResource,
SnapshotResourceType, TagCategoryResource, TagResource, TagSibling,
UserAuthTokenResource, UserAvatarStyle, UserRank, UserResource,
},
py::asynchronous::PythonAsyncClient,
py::synchronous::PythonSyncClient,
tokens::{
anonymous_token, named_token, sort_token, special_token, CommentNamedToken,
CommentSortToken, PoolNamedToken, PoolSortToken, PostNamedToken, PostSortToken,
PostSpecialToken, SnapshotNamedToken, TagNamedToken, TagSortToken, UserNamedToken,
UserSortToken,
PostSpecialToken, QueryToken, SnapshotNamedToken, TagNamedToken, TagSortToken,
UserNamedToken, UserSortToken,
},
};
}