Struct paypal_rust::client::paypal::Client
source · pub struct Client {
pub default_headers: HttpRequestHeaders,
pub auth_data: Arc<RwLock<AuthData>>,
/* private fields */
}
Fields§
§default_headers: HttpRequestHeaders
§auth_data: Arc<RwLock<AuthData>>
Implementations§
source§impl Client
impl Client
sourcepub fn new(
username: String,
client_secret: String,
environment: Environment
) -> Result<Self, Box<PayPalError>>
pub fn new(
username: String,
client_secret: String,
environment: Environment
) -> Result<Self, Box<PayPalError>>
Initialize a new PayPal client. To authenticate, use the authenticate
method.
sourcepub fn compose_url(&self, request_path: &str) -> Url
pub fn compose_url(&self, request_path: &str) -> Url
Composes an URL from the base URL and the provided path.
Arguments
request_path
- The path to append to the base URL.
sourcepub fn compose_url_with_query(
&self,
request_path: &str,
query: &QueryParams
) -> Result<Url, Error>
pub fn compose_url_with_query(
&self,
request_path: &str,
query: &QueryParams
) -> Result<Url, Error>
Composes an URL with query parameters.
Arguments
request_path
- The path to append to the base URL.query
- The query parameters to append to the URL.
pub fn with_app_info(self, app_info: AppInfo) -> Self
sourcepub async fn get<T: Endpoint>(
&self,
endpoint: &T
) -> Result<T::ResponseBody, PayPalError>
pub async fn get<T: Endpoint>(
&self,
endpoint: &T
) -> Result<T::ResponseBody, PayPalError>
sourcepub async fn post<T: Endpoint>(
&self,
endpoint: &T
) -> Result<T::ResponseBody, PayPalError>
pub async fn post<T: Endpoint>(
&self,
endpoint: &T
) -> Result<T::ResponseBody, PayPalError>
sourcepub fn set_request_headers(
&self,
request_builder: RequestBuilder,
headers: &HttpRequestHeaders
) -> RequestBuilder
pub fn set_request_headers(
&self,
request_builder: RequestBuilder,
headers: &HttpRequestHeaders
) -> RequestBuilder
Sets the request headers for a request.
Arguments
request_builder
- The request builder to set the headers on.headers
- The headers to set.