hey-sdk 0.31.0

Rust client for the HEY API, generated from a Smithy model of the API
Documentation
// Generated by hey-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

#![allow(missing_docs, unreachable_pub, clippy::all, clippy::pedantic)]

use crate::client::Client;
use crate::error::Error;
use crate::generated::routes;
use crate::generated::types::*;
use crate::pagination::Page;

/// Optional query parameters for `GetFolder`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetFolderParams {
    pub page: Option<String>,
}

pub struct Folders<'a> {
    client: &'a Client,
}

impl<'a> Folders<'a> {
    pub(crate) fn new(client: &'a Client) -> Self {
        Self { client }
    }

    /// The client this service sends through.
    pub fn client(&self) -> &'a Client {
        self.client
    }

    /// Get a folder (label) and the postings filed in it
    pub async fn get(
        &self,
        folder_id: i64,
        params: &GetFolderParams,
    ) -> Result<Page<GetFolderResponseContent>, Error> {
        let mut operation = self.client.operation(&routes::GET_FOLDER, &[&folder_id]);
        operation.resource_id(folder_id);
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }
}