mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
feat(doit): query string setup
It works for uploads as well as for others. Next up is to setup the head and authentication. It will be as simple as calling and handling `GetToken`, even though I think that there needs to be better support for the scope that is asked for ... .
This commit is contained in:
@@ -18,6 +18,7 @@ keywords = ["${name}", ${", ".join(estr(cargo.keywords))}]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
url = "*"
|
||||
rustc-serialize = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ extern crate hyper;
|
||||
extern crate "rustc-serialize" as rustc_serialize;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate mime;
|
||||
extern crate url;
|
||||
|
||||
mod cmn;
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ Handle the following *Resources* with ease ...
|
||||
* ${md_resource} (${put_and(md_methods)})
|
||||
% endfor
|
||||
|
||||
% if documentationLink:
|
||||
Everything else about the *${util.canonical_name()}* API can be found at the
|
||||
[official documentation site](${documentationLink}).
|
||||
% endif
|
||||
|
||||
# Structure of this Library
|
||||
|
||||
The API is structured into the following primary items:
|
||||
|
||||
@@ -275,6 +275,8 @@ ${'.' + action_name | indent_by(13)}(${action_args});
|
||||
###############################################################################################
|
||||
<%def name="_action_fn(resource, method, m, params, request_value, parts)">\
|
||||
<%
|
||||
import os.path
|
||||
join_url = lambda b, e: b.strip('/') + e
|
||||
media_params = method_media_params(m)
|
||||
|
||||
type_params = ''
|
||||
@@ -343,11 +345,35 @@ ${'.' + action_name | indent_by(13)}(${action_args});
|
||||
params.push((&name, value.clone()));
|
||||
}
|
||||
|
||||
% if media_params:
|
||||
let mut url = \
|
||||
% for mp in media_params:
|
||||
% if loop.first:
|
||||
if \
|
||||
% else:
|
||||
else if \
|
||||
% endif
|
||||
${mp.type.arg_name}.is_some() {
|
||||
"${join_url(rootUrl, mp.path)}".to_string()
|
||||
} \
|
||||
% endfor
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
% else:
|
||||
let mut url = "${baseUrl}".to_string();
|
||||
% endif
|
||||
|
||||
url.push('?');
|
||||
url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice()))));
|
||||
|
||||
% if response_schema:
|
||||
let response: ${response_schema.id} = Default::default();
|
||||
% else:
|
||||
let response = ();
|
||||
% endif
|
||||
|
||||
|
||||
## let mut params: Vec<(String, String)> = Vec::with_capacity
|
||||
## // note: cloned() shouldn't be needed, see issue
|
||||
## // https://github.com/servo/rust-url/issues/81
|
||||
|
||||
Reference in New Issue
Block a user