Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Accurate0 committed Jul 14, 2023
1 parent cd0662b commit 1a3fd65
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libmaccas"
version = "0.43.0"
version = "0.45.0"
edition = "2021"
license = "MIT"
description = "McDonald's API Client"
Expand Down
29 changes: 25 additions & 4 deletions src/api.rs
@@ -1,9 +1,11 @@
use crate::types::request::{ActivateAndSignInRequest, ActivationRequest, RegistrationRequest};
use crate::types::request::{
ActivateAndSignInRequest, ActivationRequest, EmailRequest, RegistrationRequest,
};
use crate::types::response::{
ActivateAndSignInResponse, ActivationResponse, CatalogResponse, ClientResponse,
CustomerPointResponse, LoginRefreshResponse, LoginResponse, OfferDealStackResponse,
OfferDetailsResponse, OfferResponse, RegistrationResponse, RestaurantLocationResponse,
RestaurantResponse, TokenResponse,
CustomerPointResponse, EmailResponse, LoginRefreshResponse, LoginResponse,
OfferDealStackResponse, OfferDetailsResponse, OfferResponse, RegistrationResponse,
RestaurantLocationResponse, RestaurantResponse, TokenResponse,
};
use crate::ClientResult;
use anyhow::Context;
Expand Down Expand Up @@ -201,6 +203,25 @@ impl ApiClient {
ClientResponse::from_response(response).await
}

// POST https://ap-prod.api.mcd.com/exp/v1/customer/identity/email
#[instrument]
pub async fn identity_email(
&self,
request: &EmailRequest,
) -> ClientResult<ClientResponse<EmailResponse>> {
let token = self.login_token.as_ref().context("no login token set")?;

let request = self
.get_default_request("exp/v1/customer/identity/email", Method::POST)
.bearer_auth(token)
.json(&request);

let response = request.send().await?;
tracing::debug!("raw response: {:?}", response);

ClientResponse::from_response(response).await
}

// POST https://ap-prod.api.mcd.com/exp/v1/customer/login
#[instrument(skip(sensor_data))]
pub async fn customer_login<A, B, C, D>(
Expand Down
8 changes: 8 additions & 0 deletions src/types/request.rs
@@ -1,6 +1,14 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EmailRequest {
pub customer_identifier: String,
pub device_id: String,
pub registration_type: String,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ActivateAndSignInRequest {
Expand Down
6 changes: 6 additions & 0 deletions src/types/response.rs
Expand Up @@ -36,6 +36,12 @@ where
}
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EmailResponse {
pub status: Status,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ActivateAndSignInResponse {
Expand Down

0 comments on commit 1a3fd65

Please sign in to comment.