pub struct WrapperTermRequestBuilder<'a> { /* private fields */ }Expand description
A structure that represents a request to be “built.” This allows you to override any settings set by the original wrapper for any requests made under the soon-to-be-built requester.
Using this builder, you can either build
- the general requester, which is your main “gateway” to a majority of the API.
- the raw requester, which gives you the ability to manually process some API responses on your own.
Implementations§
Source§impl<'a> WrapperTermRequestBuilder<'a>
impl<'a> WrapperTermRequestBuilder<'a>
Sourcepub fn new_request(wrapper_data: &'a WebRegWrapperData, term: &'a str) -> Self
pub fn new_request(wrapper_data: &'a WebRegWrapperData, term: &'a str) -> Self
Overrides the cookies for any requests made under this soon-to-be requester.
If you plan on overriding cookies for this particular request, you should ensure
requests are being closed on completion (call should_close_after_request for the
builder).
§Parameters
cookies: The cookies to use. This will not override the cookies for the wrapper, just this request.
§Returns
The builder.
§Panic
This function will only panic if you configured the wrapper instance so that it does not close the connection after a request is done.
For some context, when creating the wrapper instance, you have the option of setting
whether the connection is closed after a request is done (via the builder’s
should_close_after_request
function). If you never called this function, or you used the default constructor to create
the wrapper, or you explicitly set this value to false, then the wrapper instance will
not close the connection after a request is done and thus will panic when this function
is called.
Sourcepub fn override_client(self, client: &'a Client) -> Self
pub fn override_client(self, client: &'a Client) -> Self
Sourcepub fn override_user_agent(self, user_agent: &'a str) -> Self
pub fn override_user_agent(self, user_agent: &'a str) -> Self
Sourcepub fn override_timeout(self, duration: Duration) -> Self
pub fn override_timeout(self, duration: Duration) -> Self
Sourcepub fn raw(self) -> WrapperTermRawRequest<'a>
pub fn raw(self) -> WrapperTermRawRequest<'a>
Builds the requester that can be used to generally obtain raw responses from WebReg.
Note that you should use this requester if you want to manually parse the responses from WebReg yourself. The raw requester will handle some error handling from WebReg.
It is recommended that you build the parsed requester instead, as this gives you significantly more access to the overall API. The parsed requester, as the name implies, also handles the parsing of the raw requests for you.
§Returns
The raw requester.
Sourcepub fn parsed(self) -> WrapperTermRequest<'a>
pub fn parsed(self) -> WrapperTermRequest<'a>
Builds the requester that can be used to make many different calls (GET, POST) to WebReg.
§Returns
The parsed requester.