Closed vincent-thomas closed 8 months ago
Hello! Maybe what you are looking for is from_str
.
let customer_id = CustomerId::from_str("test")?;
let customer = Customer::retrieve(&client, &customer_id, &[]).await?;
Thank you this did work. Maybe implement the trait From<&str> and From
Correction TryFrom<&str>
trait as .from_str() returns Result
Describe the bug
When i try to retrieve a customer from
Customer::retrieve()
i need to input from the structCustomerid
. Which has a private field, and no functions that create aCustomerId
, so its impossible to retrieve a customer, without having to create it in the same code blockTo Reproduce
On some inspection, the macro definition looks like this
If making the field pub it would make it possible to get customers without creating them
Expected behavior
To be able to create a
CustomerId
, for then to retrieve theCustomer
Code snippets
No response
OS
Not relevant
Rust version
1.77.0-nightly - but not relevant
Library version
0.31.0
API version
2023-10-16
Additional context
No response