/*
* Speechmatics ASR REST API
*
* The Speechmatics Automatic Speech Recognition REST API is used to submit ASR jobs and receive the results.
*
* The version of the OpenAPI document: 2.0.0
* Contact: support@speechmatics.com
* Generated by: https://openapi-generator.tech
*/
use crate::batch::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotificationConfig {
/// The url to which a notification message will be sent upon completion of the job. The job `id` and `status` are added as query parameters, and any combination of the job inputs and outputs can be included by listing them in `contents`. If `contents` is empty, the body of the request will be empty. If only one item is listed, it will be sent as the body of the request with `Content-Type` set to an appropriate value such as `application/octet-stream` or `application/json`. If multiple items are listed they will be sent as named file attachments using the multipart content type. If `contents` is not specified, the `transcript` item will be sent as a file attachment named `data_file`, for backwards compatibility. If the job was rejected or failed during processing, that will be indicated by the status, and any output items that are not available as a result will be omitted. The body formatting rules will still be followed as if all items were available. The user-agent header is set to `Speechmatics-API/2.0`, or `Speechmatics API V2` in older API versions.
#[serde(rename = "url")]
pub url: String,
/// Specifies a list of items to be attached to the notification message. When multiple items are requested, they are included as named file attachments.
#[serde(rename = "contents", skip_serializing_if = "Option::is_none")]
pub contents: Option<Vec<Contents>>,
/// The method to be used with http and https urls. The default is post.
#[serde(rename = "method", skip_serializing_if = "Option::is_none")]
pub method: Option<Method>,
/// A list of additional headers to be added to the notification request when using http or https. This is intended to support authentication or authorization, for example by supplying an OAuth2 bearer token.
#[serde(rename = "auth_headers", skip_serializing_if = "Option::is_none")]
pub auth_headers: Option<Vec<String>>,
}
impl NotificationConfig {
pub fn new(url: String) -> NotificationConfig {
NotificationConfig {
url,
contents: None,
method: None,
auth_headers: None,
}
}
}
/// Specifies a list of items to be attached to the notification message. When multiple items are requested, they are included as named file attachments.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Contents {
#[serde(rename = "jobinfo")]
Jobinfo,
#[serde(rename = "transcript")]
Transcript,
#[serde(rename = "transcript.json-v2")]
TranscriptPeriodJsonV2,
#[serde(rename = "transcript.txt")]
TranscriptPeriodTxt,
#[serde(rename = "transcript.srt")]
TranscriptPeriodSrt,
#[serde(rename = "alignment")]
Alignment,
#[serde(rename = "alignment.word_start_and_end")]
AlignmentPeriodWordStartAndEnd,
#[serde(rename = "alignment.one_per_line")]
AlignmentPeriodOnePerLine,
#[serde(rename = "data")]
Data,
#[serde(rename = "text")]
Text,
}
impl Default for Contents {
fn default() -> Contents {
Self::Jobinfo
}
}
/// The method to be used with http and https urls. The default is post.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Method {
#[serde(rename = "post")]
Post,
#[serde(rename = "put")]
Put,
}
impl Default for Method {
fn default() -> Method {
Self::Post
}
}