Skip to content

API Models

On this page you can find a detailed description of API requests and responses.

Session

SessionSettings

Response

This model describes the response of a session settings request.

type SessionSettings = {
    language: string;
    project: SessionSettingsProject;
    code: SessionSettingsCode;
    challenge: SessionSettingsChallenge;
}

type SessionSettingsProject = {
    name: string;
}

type SessionSettingsCode = {
    length: number;
    digits: boolean;
    letters: boolean;
}

type SessionSettingsChallenge = {
    enabled: boolean;
    api_key: string|null;
    provider: ChallengeProvider,
}
type SessionSettings struct {
    Language  string                   `json:"language"`
    Project   SessionSettingsProject   `json:"project"`
    Code      SessionSettingsCode      `json:"code"`
    Challenge SessionSettingsChallenge `json:"challenge"`
}

type SessionSettingsProject struct {
    Name string `json:"name"`
}

type SessionSettingsCode struct {
    Length  uint8 `json:"length"`
    Digits  bool  `json:"digits"`
    Letters bool  `json:"letters"`
}

type SessionSettingsChallenge struct {
    Enabled  bool              `json:"enabled"`
    ApiKey   *string           `json:"api_key"`
    Provider ChallengeProvider `json:"provider"`
}
#[derive(serde::Deserialize)]
pub struct SessionSettings<'a> {
    pub language: &'a str,
    pub project: SessionSettingsProject<'a>,
    pub code: SessionSettingsCode,
    pub challenge: SessionSettingsChallenge<'a>,
}

#[derive(serde::Deserialize)]
pub struct SessionSettingsProject<'a> {
    pub name: &'a str,
}

#[derive(serde::Deserialize)]
pub struct SessionSettingsCode {
    pub length: u8,
    pub digits: bool,
    pub letters: bool,
}

#[derive(serde::Deserialize)]
pub struct SessionSettingsChallenge<'a> {
    pub enabled: bool,
    pub api_key: Option<&'a str>,
    pub provider: ChallengeProvider,
}

SessionChannel

Response

The model describes the response of a session channels request.

type SessionChannel = {
    name: string;
    type: Channel;
    is_active: boolean;
    timeout: number;
    image_url: string;
    link: string;
}
type SessionChannel struct {
    Name     string  `json:"name"`
    Type     Channel `json:"type"`
    IsActive bool    `json:"is_active"`
    Timeout  uint8   `json:"timeout"`
    ImageUrl string  `json:"image_url"`
    Link     string  `json:"link"`
}
#[derive(serde::Deserialize)]
pub struct SessionChannel<'a> {
    pub name: &'a str,
    #[serde(rename = "type")]
    pub channel_type: Channel,
    pub is_active: bool,
    pub timeput: u8,
    pub image_url: &'a str,
    pub link: &'a str,
}

SessionCreate

Request

The model describes request body of session create request.

type SessionCreateBody = {
    to: string;
    type?: Channel;
    send?: boolean;
}
type SessionCreateBody struct {
    To   string  `json:"to"`
    Type Channel `json:"type"`
    Send bool    `json:"is_active"`
}
#[derive(serde::Deserialize)]
pub struct SessionCreateBody<'a> {
    pub to: &'a str,
    #[serde(rename = "type")]
    pub channel_type: Channel,
    pub send: bool,
}

Response

The model describes response of session create request.

type SessionCreateResponse = {
    session_id: string;
    session_expired_at: string|Date;
    sent_to: Channel;
    channels: SessionChannel[]
}
type SessionCreateResponse struct {
    SessionID        string           `json:"session_id"`
    SessionExpiredAt time.Time        `json:"session_expired_at"`
    SentTo           Channel          `json:"send_to"`
    Channels         []SessionChannel `json:"channels"`
}
#[derive(Deserialize)]
pub struct SessionCreateResponse<'a> {
    pub session_id: &'a str,
    pub session_expired_at: chrono::DateTime<chrono::Utc>,
    pub sent_to: bool,
    pub channels: Vec<SessionChannel<'a>>,
}

SessionSend

Request

The model describes request body of session send request.

type SessionSendBody = {
    session_id: string;
    type: Channel;
}
type SessionSendBody struct {
    SessionID string  `json:"session_id"`
    Type      Channel `json:"type"`
}
#[derive(serde::Deserialize)]
pub struct SessionSendBody<'a> {
    pub session_id: &'a str,
    #[serde(rename = "type")]
    pub channel_type: Channel,
}

Response

The model describes response of session create request.

type SessionSendResponse = {
    session_id: string;
    session_expired_at: string|Date;
    channel: SessionChannel
}
type SessionSendResponse struct {
    SessionID        string         `json:"session_id"`
    SessionExpiredAt time.Time      `json:"session_expired_at"`
    Channel          SessionChannel `json:"channel"`
}
#[derive(Deserialize)]
pub struct SessionSendResponse<'a> {
    pub session_id: &'a str,
    pub session_expired_at: chrono::DateTime<chrono::Utc>,
    pub channel: SessionChannel<'a>,
}

SessionCheck

Request

The model describes request body of session check request.

type SessionCheckBody = {
    session_id: string;
    code: string;
}
type SessionCheckBody struct {
    SessionID string  `json:"session_id"`
    Code      string  `json:"code"`
}
#[derive(serde::Deserialize)]
pub struct SessionCheckBody<'a> {
    pub session_id: &'a str,
    pub code: &'a str,
}

Response

The model describes response of session check request.

type SessionCheckResponse = {
    verify_token: string;
    is_test: bool;
}
type SessionCheckResponse struct {
    VerifyToken string `json:"verify_token"`
    IsTest      bool   `json:"is_test"`
}
#[derive(Deserialize)]
pub struct SessionCheckResponse<'a> {
    pub verify_token: &'a str,
    pub is_test: bool,
}

SessionVerify

Request

The model describes request body of session verify request.

type SessionVerifyBody = {
    verify_token: string;
}
type SessionVerifyBody struct {
    VerifyToken string  `json:"verify_token"`
}
#[derive(serde::Deserialize)]
pub struct SessionVerifyBody<'a> {
    pub verify_token: &'a str,
}

Response

The model describes response of session verify request.

type SessionVerifyResponse = {
  phone: string | null;
  email: string | null;
}
type SessionVerifyResponse struct {
    Phone *string `json:"phone"`
    Email *string `json:"email"`
}
#[derive(Deserialize)]
pub struct SessionVerifyResponse<'a> {
    pub phone: Option<&'a str>,
    pub email: Option<&'a str>,
}

Manual

ManualChannel

Response

The model describes response of manual channels request.

type ManualChannelResponse = {
  name: string;
  type: Channel;
  proivders: ManualProviderResponse[];
};

type ManualProviderResponse = {
  id: number;
  type: Provider;
  is_system: boolean;
};
type ManualChannelResponse struct {
    Name      string                   `json:"name"`
    Type      Channel                  `json:"type"`
    Proivders []ManualProviderResponse `json:"providers"`
}

type ManualProviderResponse struct {
    ID       uint     `json:"id"`
    Type     Provider `json:"type"`
    IsSystem bool     `json:"is_system"`
}
#[derive(Deserialize)]
pub struct ManualChannelResponse<'a> {
    pub name: &'a str,
    pub type: Channel,
    pub providers: Vec<ManualProviderResponse>,
}

#[derive(Deserialize)]
pub struct ManualProviderResponse {
    pub id: u64,
    pub type: Provider,
    pub is_system: bool,
}

ManualSend

Request

The model describes body of manual send request.

type ManualSendRequest = {
  to: string;
  channel?: Channel;
  provider_id?: number;
  code?: string;
  callback_url?: string;
};
type ManualSendRequest struct {
    To          string   `json:"to"`
    Channel     *Channel `json:"channel"`
    ProviderID  *uint    `json:"provider_id"`
    Code        *string  `json:"code"`
    CallbackUrl *string  `json:"callback_url"`
}
#[derive(Deserialize)]
pub struct ManualSendRequest<'a> {
    pub to: &'a str,
    pub channel: Option<Channel>,
    pub provider_id: Option<usize>,
    pub code: Option<&'a str>,
    pub callback_url: Option<&'a str>,
}

Response

The model describes response of manual send request.

type ManualSendResponse = {
  message: string;
  code: string;
  message_id: number;
};
type ManualSendResponse struct {
    Message   string `json:"message"`
    Code      string `json:"code"`
    MessageID uint   `json:"message_id"`
}
#[derive(Deserialize)]
pub struct ManualSendResponse<'a> {
    pub message: &'a str,
    pub code: &'a str,
    pub message_id: usize,
}

ManualMessage

Response

The model describes response of manual send request.

type ManualMessageResponse = {
  id: number;
  channel: Channel;
  status: MessageStatus;
  error: string | null;
};
type ManualMessageResponse struct {
    ID      uint          `json:"id"`
    Channel Channel       `json:"channel"`
    Status  MessageStatus `json:"status"`
    Error   *string       `json:"error"`
}
#[derive(Deserialize)]
pub struct ManualMessageResponse<'a> {
    pub id: usize,
    pub channel: Channel,
    pub status: MessageStatus,
    pub error: Option<&'a str>,
}