Skip to content

Commit

Permalink
refactor(models): removing unnecessary python classes
Browse files Browse the repository at this point in the history
  • Loading branch information
slyons committed Aug 15, 2024
1 parent 9c8d084 commit 669be07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
5 changes: 2 additions & 3 deletions szurubooru-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@ use pyo3::prelude::*;

#[cfg(feature = "python")]
#[cfg_attr(feature = "python", pymodule)]
/// A Python wrapper around [SzurubooruClient]
mod szurubooru_client {
use pyo3::prelude::*;

#[pymodule_export]
pub use crate::{
models::{
AroundPostResult, CommentResource, CreateUpdateComment, CreateUpdatePool,
CreateUpdatePoolCategory, CreateUpdatePost, CreateUpdateTag, CreateUpdateTagCategory,
CreateUpdateUser, CreateUpdateUserAuthToken, GlobalInfo, ImageSearchResult,
AroundPostResult, CommentResource, GlobalInfo, ImageSearchResult,
ImageSearchSimilarPost, MergePool, MergePost, MergeTags, MicroPoolResource,
MicroPostResource, MicroTagResource, MicroUserResource, NoteResource,
PoolCategoryResource, PoolResource, PostResource, PostSafety, PostType,
Expand Down
9 changes: 1 addition & 8 deletions szurubooru-client/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ impl TagResource {
/// ```
#[derive(Debug, Clone, Serialize, Deserialize, Builder, Default)]
//#[builder(pattern="owned")]
#[cfg_attr(all(feature = "python"), pyclass(get_all))]
#[builder(setter(strip_option), build_fn(error = "SzurubooruClientError"))]
pub struct CreateUpdateTag {
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -244,7 +243,7 @@ impl TagCategoryResource {

#[derive(Debug, Clone, Serialize, Deserialize, Default, Builder)]
#[builder(setter(strip_option), build_fn(error = "SzurubooruClientError"))]
#[cfg_attr(all(feature = "python"), pyclass(get_all))]

/// Used for creating or updating a Tag Category
pub struct CreateUpdateTagCategory {
/// Resource version. See [versioning](ResourceVersion)
Expand Down Expand Up @@ -499,7 +498,6 @@ impl WithBaseURL for PostResource {
}

#[derive(Debug, Clone, Serialize, Deserialize, Builder)]
#[cfg_attr(all(feature = "python"), pyclass(get_all))]
#[builder(setter(strip_option), build_fn(error = "SzurubooruClientError"))]
#[serde(rename_all = "camelCase")]
/// A `struct` used to create or update a post. For updating purposes
Expand Down Expand Up @@ -774,7 +772,6 @@ impl WithBaseURL for UserResource {
}

#[derive(Debug, Clone, Serialize, Deserialize, Default, Builder)]
#[cfg_attr(all(feature = "python"), pyclass(get_all))]
#[builder(setter(strip_option), build_fn(error = "SzurubooruClientError"))]
#[serde(rename_all = "camelCase")]
/// `struct` used to create or update a user resource. The version field is only used when
Expand Down Expand Up @@ -878,7 +875,6 @@ impl WithBaseURL for UserAuthTokenResource {
}

#[derive(Debug, Clone, Serialize, Deserialize, Builder, Default)]
#[cfg_attr(all(feature = "python"), pyclass(get_all))]
#[builder(setter(into, strip_option), build_fn(error = "SzurubooruClientError"))]
#[serde(rename_all = "kebab-case")]
/// `struct` to create or update a UserAuthToken. `version` is only required when updating an
Expand Down Expand Up @@ -999,7 +995,6 @@ impl PoolCategoryResource {
}

#[derive(Debug, Clone, Serialize, Deserialize, Builder)]
#[cfg_attr(all(feature = "python"), pyclass(get_all))]
#[builder(setter(strip_option), build_fn(error = "SzurubooruClientError"))]
/// `struct` used for creating or updating a pool category. This type uses a Builder pattern like
/// so:
Expand Down Expand Up @@ -1072,7 +1067,6 @@ impl WithBaseURL for PoolResource {
}

#[derive(Debug, Clone, Serialize, Deserialize, Builder, Default)]
#[cfg_attr(all(feature = "python"), pyclass(get_all))]
#[builder(setter(strip_option), build_fn(error = "SzurubooruClientError"))]
#[serde(rename_all = "camelCase")]
/// This type is used when creating or updating a pool object. It uses the builder pattern like so:
Expand Down Expand Up @@ -1202,7 +1196,6 @@ impl CommentResource {
}

#[derive(Debug, Clone, Serialize, Deserialize, Builder, Default)]
#[cfg_attr(all(feature = "python"), pyclass(get_all))]
#[builder(setter(strip_option), build_fn(error = "SzurubooruClientError"))]
#[serde(rename_all = "camelCase")]
/// This type is used when creating or updating a comment. This type uses the builder pattern like
Expand Down

0 comments on commit 669be07

Please sign in to comment.