workos 1.0.1

Official Rust SDK for the WorkOS API
Documentation
// Code generated by oagen. DO NOT EDIT.

use crate::client::Client;
#[allow(unused_imports)]
use crate::enums::*;
use crate::error::Error;
#[allow(unused_imports)]
use crate::models::*;
use serde::Serialize;

pub struct AdminPortalApi<'a> {
    pub(crate) client: &'a Client,
}

#[derive(Debug, Clone, Serialize)]
pub struct GenerateLinkParams {
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: GenerateLink,
}

impl GenerateLinkParams {
    /// Construct a new `GenerateLinkParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: GenerateLink) -> Self {
        Self { body }
    }
}

impl<'a> AdminPortalApi<'a> {
    /// Generate a Portal Link
    ///
    /// Generate a Portal Link scoped to an Organization.
    pub async fn generate_link(
        &self,
        params: GenerateLinkParams,
    ) -> Result<PortalLinkResponse, Error> {
        self.generate_link_with_options(params, None).await
    }

    /// Variant of [`Self::generate_link`] that accepts per-request [`crate::RequestOptions`].
    pub async fn generate_link_with_options(
        &self,
        params: GenerateLinkParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<PortalLinkResponse, Error> {
        let path = "/portal/generate_link".to_string();
        let method = http::Method::POST;
        self.client
            .request_with_body_opts(method, &path, &params, Some(&params.body), options)
            .await
    }
}