-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #471 from buhaytza2005/solutions_and_bookings
Solutions and bookings
- Loading branch information
Showing
22 changed files
with
548 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use graph_rs_sdk::*; | ||
|
||
//businesses are the equivalent of booking pages | ||
//creating a new business with the name "My Business" will create a booking page and once bookings | ||
//are open, a new alias `[email protected]` will be created. If name already exists, the alias | ||
//will be `[email protected]`. | ||
// | ||
// | ||
// | ||
|
||
async fn create_business(){ | ||
let client = Graph::new("ACCESS_TOKEN"); | ||
|
||
|
||
let data = serde_json::json!({ | ||
"displayName": "My Business" | ||
}); | ||
|
||
let body = Body::from(data.to_string()); | ||
|
||
let resp = client | ||
.solutions() | ||
.booking_businesses() | ||
.create_booking_businesses(body) | ||
.send() | ||
.await; | ||
|
||
println!("{:#?}", resp); | ||
} | ||
|
||
async fn get_businesses() { | ||
let access_token = log_me_in().await.unwrap(); | ||
let client = Graph::new(&access_token); | ||
let bus = client.solutions().booking_businesses().list_booking_businesses().send().await.unwrap(); | ||
|
||
let businesses: serde_json::Value = bus.json().await.unwrap(); | ||
println!("{:#}", businesses) | ||
} | ||
|
||
async fn get_appointments() { | ||
let access_token = log_me_in().await.unwrap(); | ||
let client = Graph::new(&access_token); | ||
|
||
let appointments = client | ||
.solutions() | ||
//can be id retrieved from list_booking_businesses or pass the generated alias | ||
.booking_business("[email protected]") | ||
.appointments() | ||
.list_appointments() | ||
.send() | ||
.await | ||
.unwrap(); | ||
|
||
let app_json: serde_json::Value = appointments.json().await.unwrap(); | ||
|
||
println!("{:#?}", app_json); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod request; | ||
|
||
pub use request::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// GENERATED CODE | ||
|
||
use crate::api_default_imports::*; | ||
|
||
api_client!( | ||
AppointmentsApiClient, | ||
AppointmentsIdApiClient, | ||
ResourceIdentity::Appointments | ||
); | ||
|
||
impl AppointmentsApiClient { | ||
post!( | ||
doc: "Create bookingAppointment", | ||
name: create_appointments, | ||
path: "/appointments", | ||
body: true | ||
); | ||
get!( | ||
doc: "List appointments", | ||
name: list_appointments, | ||
path: "/appointments" | ||
); | ||
get!( | ||
doc: "Get the number of the resource", | ||
name: get_appointments_count, | ||
path: "/appointments/$count" | ||
); | ||
} | ||
|
||
impl AppointmentsIdApiClient { | ||
delete!( | ||
doc: "Delete bookingAppointment", | ||
name: delete_appointments, | ||
path: "/appointments/{{RID}}" | ||
); | ||
get!( | ||
doc: "Get bookingAppointment", | ||
name: get_appointments, | ||
path: "/appointments/{{RID}}" | ||
); | ||
patch!( | ||
doc: "Update bookingAppointment", | ||
name: update_appointments, | ||
path: "/appointments/{{RID}}", | ||
body: true | ||
); | ||
post!( | ||
doc: "Invoke action cancel", | ||
name: cancel, | ||
path: "/appointments/{{RID}}/cancel", | ||
body: true | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod request; | ||
|
||
pub use request::*; |
Oops, something went wrong.