1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use serde::Serialize;
use crate::client::{Client, Response};
use crate::params::Expand;
use crate::resources::LoginLink;
use crate::AccountId;
#[derive(Clone, Debug, Serialize)]
pub struct CreateLoginLink<'a> {
#[serde(skip_serializing_if = "Expand::is_empty")]
pub expand: &'a [&'a str],
#[serde(skip_serializing_if = "Option::is_none")]
pub redirect_url: Option<String>,
}
impl LoginLink {
pub fn create(client: &Client, id: &AccountId, redirect_url: &str) -> Response<Self> {
let create_login_link =
CreateLoginLink { expand: &[], redirect_url: Some(redirect_url.to_string()) };
client.post_form(&format!("/accounts/{}/login_links", id), &create_login_link)
}
}