-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep simple, relegate more generated code to specific generated crates
- Loading branch information
1 parent
0a4ae20
commit b279dcb
Showing
1,364 changed files
with
3,839 additions
and
4,219 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
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,44 @@ | ||
use crate::AccountId; | ||
use crate::ApiVersion; | ||
use crate::ApplicationId; | ||
|
||
#[derive(Clone, Default)] | ||
pub struct AppInfo { | ||
pub name: String, | ||
pub url: Option<String>, | ||
pub version: Option<String>, | ||
} | ||
|
||
impl ToString for AppInfo { | ||
/// Formats a plugin's 'App Info' into a string that can be added to the end of an User-Agent string. | ||
/// | ||
/// This formatting matches that of other libraries, and if changed then it should be changed everywhere. | ||
fn to_string(&self) -> String { | ||
match (&self.version, &self.url) { | ||
(Some(a), Some(b)) => format!("{}/{} ({})", &self.name, a, b), | ||
(Some(a), None) => format!("{}/{}", &self.name, a), | ||
(None, Some(b)) => format!("{} ({})", &self.name, b), | ||
_ => self.name.to_string(), | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone)] | ||
pub struct Headers { | ||
pub stripe_version: ApiVersion, | ||
pub user_agent: String, | ||
|
||
pub client_id: Option<ApplicationId>, | ||
pub stripe_account: Option<AccountId>, | ||
} | ||
|
||
impl Headers { | ||
pub fn to_array(&self) -> [(&str, Option<&str>); 4] { | ||
[ | ||
("Client-Id", self.client_id.as_deref()), | ||
("Stripe-Account", self.stripe_account.as_deref()), | ||
("Stripe-Version", Some(self.stripe_version.as_str())), | ||
("User-Agent", Some(&self.user_agent)), | ||
] | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod headers; | ||
mod request_strategy; | ||
mod stripe; | ||
|
||
|
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
Oops, something went wrong.