mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-27 20:30:52 +01:00
86 lines
22 KiB
HTML
86 lines
22 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Delegate` trait in crate `google_binaryauthorization1_beta1`."><meta name="keywords" content="rust, rustlang, rust-lang, Delegate"><title>google_binaryauthorization1_beta1::client::Delegate - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../google_binaryauthorization1_beta1/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Trait Delegate</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.begin">begin</a><a href="#method.finished">finished</a><a href="#method.token">token</a><a href="#method.pre_request">pre_request</a><a href="#method.http_error">http_error</a><a href="#method.http_failure">http_failure</a><a href="#method.response_json_decode_error">response_json_decode_error</a><a href="#method.api_key">api_key</a><a href="#method.upload_url">upload_url</a><a href="#method.store_upload_url">store_upload_url</a><a href="#method.chunk_size">chunk_size</a><a href="#method.cancel_chunk_upload">cancel_chunk_upload</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class="location"><a href="../index.html">google_binaryauthorization1_beta1</a>::<wbr><a href="index.html">client</a></p><div id="sidebar-vars" data-name="Delegate" data-ty="trait" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Trait <a href="../index.html">google_binaryauthorization1_beta1</a>::<wbr><a href="index.html">client</a>::<wbr><a class="trait" href="">Delegate</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#110-233" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust trait">pub trait Delegate {
|
||
fn <a href="#method.begin" class="fnname">begin</a>(&mut self, _info: <a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.MethodInfo.html" title="struct google_binaryauthorization1_beta1::client::MethodInfo">MethodInfo</a>) { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.http_error" class="fnname">http_error</a>(&mut self, _err: &<a class="struct" href="../../hyper/error/struct.Error.html" title="struct hyper::error::Error">Error</a>) -> <a class="enum" href="../../google_binaryauthorization1_beta1/client/enum.Retry.html" title="enum google_binaryauthorization1_beta1::client::Retry">Retry</a> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.api_key" class="fnname">api_key</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.token" class="fnname">token</a>(&mut self, err: &<a class="enum" href="../../yup_oauth2/error/enum.Error.html" title="enum yup_oauth2::error::Error">Error</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../yup_oauth2/types/struct.AccessToken.html" title="struct yup_oauth2::types::AccessToken">AccessToken</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.upload_url" class="fnname">upload_url</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.store_upload_url" class="fnname">store_upload_url</a>(&mut self, url: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>) { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.response_json_decode_error" class="fnname">response_json_decode_error</a>(<br> &mut self, <br> json_encoded_value: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br> json_decode_error: &<a class="struct" href="../../serde_json/error/struct.Error.html" title="struct serde_json::error::Error">Error</a><br> ) { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.http_failure" class="fnname">http_failure</a>(<br> &mut self, <br> _: &<a class="struct" href="../../http/response/struct.Response.html" title="struct http::response::Response">Response</a><<a class="struct" href="../../hyper/body/body/struct.Body.html" title="struct hyper::body::body::Body">Body</a>>, <br> _err: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.JsonServerError.html" title="struct google_binaryauthorization1_beta1::client::JsonServerError">JsonServerError</a>>, <br> _: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.ServerError.html" title="struct google_binaryauthorization1_beta1::client::ServerError">ServerError</a>><br> ) -> <a class="enum" href="../../google_binaryauthorization1_beta1/client/enum.Retry.html" title="enum google_binaryauthorization1_beta1::client::Retry">Retry</a> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.pre_request" class="fnname">pre_request</a>(&mut self) { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.chunk_size" class="fnname">chunk_size</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.cancel_chunk_upload" class="fnname">cancel_chunk_upload</a>(&mut self, chunk: &<a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.ContentRange.html" title="struct google_binaryauthorization1_beta1::client::ContentRange">ContentRange</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.finished" class="fnname">finished</a>(&mut self, is_success: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) { ... }
|
||
}</pre></div><div class="docblock"><p>A trait specifying functionality to help controlling any request performed by the API.
|
||
The trait has a conservative default implementation.</p>
|
||
<p>It contains methods to deal with all common issues, as well with the ones related to
|
||
uploading media</p>
|
||
</div><h2 id="provided-methods" class="small-section-header">Provided methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><h3 id="method.begin" class="method"><code>fn <a href="#method.begin" class="fnname">begin</a>(&mut self, _info: <a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.MethodInfo.html" title="struct google_binaryauthorization1_beta1::client::MethodInfo">MethodInfo</a>)</code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#117" title="goto source code">[src]</a></h3><div class="docblock"><p>Called at the beginning of any API request. The delegate should store the method
|
||
information if he is interesting in knowing more context when further calls to it
|
||
are made.
|
||
The matching <code>finished()</code> call will always be made, no matter whether or not the API
|
||
request was successful. That way, the delegate may easily maintain a clean state
|
||
between various API calls.</p>
|
||
</div><h3 id="method.http_error" class="method"><code>fn <a href="#method.http_error" class="fnname">http_error</a>(&mut self, _err: &<a class="struct" href="../../hyper/error/struct.Error.html" title="struct hyper::error::Error">Error</a>) -> <a class="enum" href="../../google_binaryauthorization1_beta1/client/enum.Retry.html" title="enum google_binaryauthorization1_beta1::client::Retry">Retry</a></code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#125-127" title="goto source code">[src]</a></h3><div class="docblock"><p>Called whenever there is an <a href="../../hyper/error/struct.Error.html">HttpError</a>, usually if there are network problems.</p>
|
||
<p>If you choose to retry after a duration, the duration should be chosen using the
|
||
<a href="http://en.wikipedia.org/wiki/Exponential_backoff">exponential backoff algorithm</a>.</p>
|
||
<p>Return retry information.</p>
|
||
</div><h3 id="method.api_key" class="method"><code>fn <a href="#method.api_key" class="fnname">api_key</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#132-134" title="goto source code">[src]</a></h3><div class="docblock"><p>Called whenever there is the need for your applications API key after
|
||
the official authenticator implementation didn't provide one, for some reason.
|
||
If this method returns None as well, the underlying operation will fail</p>
|
||
</div><h3 id="method.token" class="method"><code>fn <a href="#method.token" class="fnname">token</a>(&mut self, err: &<a class="enum" href="../../yup_oauth2/error/enum.Error.html" title="enum yup_oauth2::error::Error">Error</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../yup_oauth2/types/struct.AccessToken.html" title="struct yup_oauth2::types::AccessToken">AccessToken</a>></code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#141-144" title="goto source code">[src]</a></h3><div class="docblock"><p>Called whenever the Authenticator didn't yield a token. The delegate
|
||
may attempt to provide one, or just take it as a general information about the
|
||
impending failure.
|
||
The given Error provides information about why the token couldn't be acquired in the
|
||
first place</p>
|
||
</div><h3 id="method.upload_url" class="method"><code>fn <a href="#method.upload_url" class="fnname">upload_url</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#153-155" title="goto source code">[src]</a></h3><div class="docblock"><p>Called during resumable uploads to provide a URL for the impending upload.
|
||
It was saved after a previous call to <code>store_upload_url(...)</code>, and if not None,
|
||
will be used instead of asking the server for a new upload URL.
|
||
This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||
be resumed.
|
||
The returned URL will be used exactly once - if it fails again and the delegate allows
|
||
to retry, we will ask the server for a new upload URL.</p>
|
||
</div><h3 id="method.store_upload_url" class="method"><code>fn <a href="#method.store_upload_url" class="fnname">store_upload_url</a>(&mut self, url: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>)</code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#163-165" title="goto source code">[src]</a></h3><div class="docblock"><p>Called after we have retrieved a new upload URL for a resumable upload to store it
|
||
in case we fail or cancel. That way, we can attempt to resume the upload later,
|
||
see <code>upload_url()</code>.
|
||
It will also be called with None after a successful upload, which allows the delegate
|
||
to forget the URL. That way, we will not attempt to resume an upload that has already
|
||
finished.</p>
|
||
</div><h3 id="method.response_json_decode_error" class="method"><code>fn <a href="#method.response_json_decode_error" class="fnname">response_json_decode_error</a>(<br> &mut self, <br> json_encoded_value: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br> json_decode_error: &<a class="struct" href="../../serde_json/error/struct.Error.html" title="struct serde_json::error::Error">Error</a><br>)</code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#175-182" title="goto source code">[src]</a></h3><div class="docblock"><p>Called whenever a server response could not be decoded from json.
|
||
It's for informational purposes only, the caller will return with an error
|
||
accordingly.</p>
|
||
<h1 id="arguments" class="section-header"><a href="#arguments">Arguments</a></h1>
|
||
<ul>
|
||
<li><code>json_encoded_value</code> - The json-encoded value which failed to decode.</li>
|
||
<li><code>json_decode_error</code> - The decoder error</li>
|
||
</ul>
|
||
</div><h3 id="method.http_failure" class="method"><code>fn <a href="#method.http_failure" class="fnname">http_failure</a>(<br> &mut self, <br> _: &<a class="struct" href="../../http/response/struct.Response.html" title="struct http::response::Response">Response</a><<a class="struct" href="../../hyper/body/body/struct.Body.html" title="struct hyper::body::body::Body">Body</a>>, <br> _err: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.JsonServerError.html" title="struct google_binaryauthorization1_beta1::client::JsonServerError">JsonServerError</a>>, <br> _: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.ServerError.html" title="struct google_binaryauthorization1_beta1::client::ServerError">ServerError</a>><br>) -> <a class="enum" href="../../google_binaryauthorization1_beta1/client/enum.Retry.html" title="enum google_binaryauthorization1_beta1::client::Retry">Retry</a></code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#192-199" title="goto source code">[src]</a></h3><div class="docblock"><p>Called whenever the http request returns with a non-success status code.
|
||
This can involve authentication issues, or anything else that very much
|
||
depends on the used API method.
|
||
The delegate should check the status, header and decoded json error to decide
|
||
whether to retry or not. In the latter case, the underlying call will fail.</p>
|
||
<p>If you choose to retry after a duration, the duration should be chosen using the
|
||
<a href="http://en.wikipedia.org/wiki/Exponential_backoff">exponential backoff algorithm</a>.</p>
|
||
</div><h3 id="method.pre_request" class="method"><code>fn <a href="#method.pre_request" class="fnname">pre_request</a>(&mut self)</code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#204" title="goto source code">[src]</a></h3><div class="docblock"><p>Called prior to sending the main request of the given method. It can be used to time
|
||
the call or to print progress information.
|
||
It's also useful as you can be sure that a request will definitely be made.</p>
|
||
</div><h3 id="method.chunk_size" class="method"><code>fn <a href="#method.chunk_size" class="fnname">chunk_size</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#209-211" title="goto source code">[src]</a></h3><div class="docblock"><p>Return the size of each chunk of a resumable upload.
|
||
Must be a power of two, with 1<<18 being the smallest allowed chunk size.
|
||
Will be called once before starting any resumable upload.</p>
|
||
</div><h3 id="method.cancel_chunk_upload" class="method"><code>fn <a href="#method.cancel_chunk_upload" class="fnname">cancel_chunk_upload</a>(&mut self, chunk: &<a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.ContentRange.html" title="struct google_binaryauthorization1_beta1::client::ContentRange">ContentRange</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#217-220" title="goto source code">[src]</a></h3><div class="docblock"><p>Called before the given chunk is uploaded to the server.
|
||
If true is returned, the upload will be interrupted.
|
||
However, it may be resumable if you stored the upload URL in a previous call
|
||
to <code>store_upload_url()</code></p>
|
||
</div><h3 id="method.finished" class="method"><code>fn <a href="#method.finished" class="fnname">finished</a>(&mut self, is_success: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>)</code><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#230-232" title="goto source code">[src]</a></h3><div class="docblock"><p>Called before the API request method returns, in every case. It can be used to clean up
|
||
internal state between calls to the API.
|
||
This call always has a matching call to <code>begin(...)</code>.</p>
|
||
<h1 id="arguments-1" class="section-header"><a href="#arguments-1">Arguments</a></h1>
|
||
<ul>
|
||
<li><code>is_success</code> - a true value indicates the operation was successful. If false, you should
|
||
discard all values stored during <code>store_upload_url</code>.</li>
|
||
</ul>
|
||
</div></div><span class="loading-content">Loading content...</span><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><h3 id="impl-Delegate" class="impl"><code class="in-band">impl Delegate for <a class="struct" href="../../google_binaryauthorization1_beta1/client/struct.DefaultDelegate.html" title="struct google_binaryauthorization1_beta1::client::DefaultDelegate">DefaultDelegate</a></code><a href="#impl-Delegate" class="anchor"></a><a class="srclink" href="../../src/google_binaryauthorization1_beta1/client.rs.html#240" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><span class="loading-content">Loading content...</span><script type="text/javascript" src="../../implementors/google_binaryauthorization1_beta1/client/trait.Delegate.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="google_binaryauthorization1_beta1"></div>
|
||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html> |