pub struct SmugMugClient { /* private fields */ }Implementations§
Source§impl SmugMugClient
impl SmugMugClient
pub async fn list_albums(&self) -> Result<Vec<Album>>
Sourcepub async fn auth_user(&self) -> Result<AuthUser>
pub async fn auth_user(&self) -> Result<AuthUser>
The signed-in user’s nickname and root node, fetched on first use.
Sourcepub async fn list_children(&self, node_uri: &str) -> Result<Vec<ChildNode>>
pub async fn list_children(&self, node_uri: &str) -> Result<Vec<ChildNode>>
Every child of a folder node (folders, albums, pages), all pages.
Sourcepub async fn set_folder_sort(
&self,
node_uri: &str,
method: &str,
direction: &str,
) -> Result<()>
pub async fn set_folder_sort( &self, node_uri: &str, method: &str, direction: &str, ) -> Result<()>
Set how the folder at node_uri lists its contents (method is
Name, DateAdded, DateModified or SortIndex; direction
Ascending or Descending).
Sourcepub async fn get_album_sort(&self, album_key: &str) -> Result<(String, String)>
pub async fn get_album_sort(&self, album_key: &str) -> Result<(String, String)>
How an album sorts its photos now: (method, direction), as SmugMug names them (e.g. “Date Taken”, “Ascending”).
Sourcepub async fn create_folder(
&self,
parent_node_uri: &str,
name: &str,
privacy: Option<&str>,
) -> Result<String>
pub async fn create_folder( &self, parent_node_uri: &str, name: &str, privacy: Option<&str>, ) -> Result<String>
Create a folder named name in the folder node parent_node_uri and
return its node URI. privacy (Public, Unlisted or Private) is set if
given. SmugMug lists a new folder’s contents by date modified, newest
first; see create_sorted_folder for by name.
Sourcepub async fn create_sorted_folder(
&self,
parent_node_uri: &str,
name: &str,
privacy: Option<&str>,
) -> Result<String>
pub async fn create_sorted_folder( &self, parent_node_uri: &str, name: &str, privacy: Option<&str>, ) -> Result<String>
Like create_folder, but the new folder lists its contents by name,
ascending.
pub async fn create_album( &self, name: &str, parent_node_uri: Option<&str>, privacy: &str, ) -> Result<Album>
pub async fn find_album_in_folder( &self, parent_node_uri: &str, album_name: &str, ) -> Result<Option<Album>>
Sourcepub async fn find_or_create_folder_path(
&self,
folder_path: &str,
privacy: Option<&str>,
) -> Result<String>
pub async fn find_or_create_folder_path( &self, folder_path: &str, privacy: Option<&str>, ) -> Result<String>
Find or create each folder along folder_path (e.g. “2024/Travel”)
and return the last one’s node URI. privacy (Public, Unlisted or
Private) is set on any folder that has to be created; None leaves
SmugMug’s default. Existing folders are left as they are.
Sourcepub async fn find_or_create_sorted_folder_path(
&self,
folder_path: &str,
privacy: Option<&str>,
) -> Result<String>
pub async fn find_or_create_sorted_folder_path( &self, folder_path: &str, privacy: Option<&str>, ) -> Result<String>
Like find_or_create_folder_path, but folders it creates list their
contents by name, ascending.
Sourcepub async fn find_folder_path(
&self,
folder_path: &str,
) -> Result<Option<String>>
pub async fn find_folder_path( &self, folder_path: &str, ) -> Result<Option<String>>
Node URI of the folder at folder_path, or None if any folder along
it doesn’t exist. Creates nothing.
pub async fn get_album(&self, album_key: &str) -> Result<Album>
pub async fn delete_album(&self, album_key: &str) -> Result<()>
pub async fn get_node_tree(&self) -> Result<NodeTree>
pub async fn update_album_settings( &self, album_key: &str, settings: AlbumSettingsUpdate, ) -> Result<()>
Sourcepub async fn request_album_download(
&self,
album_key: &str,
) -> Result<AlbumDownloadInfo>
pub async fn request_album_download( &self, album_key: &str, ) -> Result<AlbumDownloadInfo>
Request album download ZIP generation
Sourcepub async fn check_album_download_status(
&self,
download_uri: &str,
) -> Result<AlbumDownloadInfo>
pub async fn check_album_download_status( &self, download_uri: &str, ) -> Result<AlbumDownloadInfo>
Check the status of an album download
Sourcepub async fn get_album_download_link(&self, album_key: &str) -> Result<String>
pub async fn get_album_download_link(&self, album_key: &str) -> Result<String>
Get album download link with polling (max 10 attempts, 3s intervals)
Source§impl SmugMugClient
impl SmugMugClient
Sourcepub async fn list_image_comments(&self, image_key: &str) -> Result<Vec<Comment>>
pub async fn list_image_comments(&self, image_key: &str) -> Result<Vec<Comment>>
List all comments for an image
Sourcepub async fn create_image_comment(
&self,
image_key: &str,
request: CreateCommentRequest,
) -> Result<Comment>
pub async fn create_image_comment( &self, image_key: &str, request: CreateCommentRequest, ) -> Result<Comment>
Create a new comment on an image
Source§impl SmugMugClient
impl SmugMugClient
Sourcepub async fn list_album_images(
&self,
album_key: &str,
) -> Result<Vec<AlbumImage>>
pub async fn list_album_images( &self, album_key: &str, ) -> Result<Vec<AlbumImage>>
Every image in the album, across all pages of the listing.
pub async fn get_image_details(&self, image_key: &str) -> Result<ImageDetails>
pub async fn delete_image(&self, image_key: &str) -> Result<()>
pub async fn update_image_metadata( &self, image_key: &str, metadata: ImageMetadataUpdate, ) -> Result<()>
Sourcepub async fn collect_images(
&self,
album_key: &str,
uris: &[String],
) -> Result<CollectResult>
pub async fn collect_images( &self, album_key: &str, uris: &[String], ) -> Result<CollectResult>
Add existing images (Image or AlbumImage URIs) to the album, without uploading them again. Collecting an image that’s already in the album changes nothing.
pub async fn move_image( &self, image_key: &str, target_album_key: &str, ) -> Result<()>
Source§impl SmugMugClient
impl SmugMugClient
pub fn new( api_key: String, api_secret: String, access_token: String, access_token_secret: String, ) -> Self
pub fn build_oauth_header(&self, method: &str, url: &str) -> String
Sourcepub fn build_oauth_header_with_query<T: Request>(
&self,
method: &str,
url: &str,
query: &T,
) -> String
pub fn build_oauth_header_with_query<T: Request>( &self, method: &str, url: &str, query: &T, ) -> String
Same as build_oauth_header, but for a request that carries query
parameters (e.g. pagination’s start/count). OAuth1 signing
requires those parameters to be passed in separately rather than
embedded in url — a url containing a ?query part panics inside
the oauth1-request crate. Callers must send the request with the same
query value (e.g. reqwest’s .query(query)) so the signed
parameters match what is actually sent.
pub async fn get_auth_user(&self) -> Result<Value>
pub async fn get_user_features(&self, user_uri: &str) -> Result<Value>
Sourcepub async fn request_raw(
&self,
method: &str,
path_or_url: &str,
body: Option<Value>,
) -> Result<(u16, String)>
pub async fn request_raw( &self, method: &str, path_or_url: &str, body: Option<Value>, ) -> Result<(u16, String)>
Authenticated request with any HTTP method to an arbitrary API path
(e.g. /api/v2!authuser?_verbosity=1) or absolute URL, returning the
HTTP status and raw body without interpreting either. Query parameters
are signed separately, as OAuth1 requires. Used for exploring
endpoints that aren’t publicly documented; OPTIONS makes SmugMug
describe an endpoint’s methods and parameters. A body is sent as
JSON, which is how SmugMug takes the parameters of POST/PATCH calls.
Sourcepub async fn get_all_pages<T: DeserializeOwned>(
&self,
first_url: &str,
locator: &str,
) -> Result<Vec<T>>
pub async fn get_all_pages<T: DeserializeOwned>( &self, first_url: &str, locator: &str, ) -> Result<Vec<T>>
GET a SmugMug list endpoint (e.g. .../album/KEY!images) and every
following page, returning all items of the locator array (e.g.
“AlbumImage”, “Album”, “Comment”, “Node”) from each page’s Response.
SmugMug returns one page per request (often 100 items, sometimes
fewer) and links the next one as Response.Pages.NextPage; a missing
locator array (empty list) yields no items. Later pages are fetched
from the same host as first_url, with their query parameters
signed separately as OAuth1 requires.
pub async fn get_with_auth(&self, url: &str) -> Result<Response>
pub async fn post_with_auth(&self, url: &str, body: Value) -> Result<Response>
pub async fn delete_with_auth(&self, url: &str) -> Result<Response>
Trait Implementations§
Source§impl CollectBackend for SmugMugClient
impl CollectBackend for SmugMugClient
Source§impl Smug for SmugMugClient
impl Smug for SmugMugClient
async fn children(&self, node_uri: &str) -> Result<Vec<ChildNode>>
Source§async fn create_folder(
&self,
parent_node_uri: &str,
name: &str,
) -> Result<String>
async fn create_folder( &self, parent_node_uri: &str, name: &str, ) -> Result<String>
Source§async fn create_album(&self, parent_node_uri: &str, name: &str) -> Result<Album>
async fn create_album(&self, parent_node_uri: &str, name: &str) -> Result<Album>
async fn image_count(&self, album: &Album) -> Result<u64>
async fn album_images(&self, album_key: &str) -> Result<Vec<AlbumImage>>
Source§impl SortBackend for SmugMugClient
impl SortBackend for SmugMugClient
async fn children(&self, node_uri: &str) -> Result<Vec<ChildNode>>
Source§async fn album_sort(&self, album_key: &str) -> Result<(String, String)>
async fn album_sort(&self, album_key: &str) -> Result<(String, String)>
async fn set_folder_sort( &self, node_uri: &str, method: &str, direction: &str, ) -> Result<()>
async fn set_album_sort( &self, album_key: &str, method: &str, direction: &str, ) -> Result<()>
Source§impl Uploads for SmugMugClient
impl Uploads for SmugMugClient
Auto Trait Implementations§
impl !Freeze for SmugMugClient
impl !RefUnwindSafe for SmugMugClient
impl !UnwindSafe for SmugMugClient
impl Send for SmugMugClient
impl Sync for SmugMugClient
impl Unpin for SmugMugClient
impl UnsafeUnpin for SmugMugClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more