mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-21 18:54:07 +01:00
feat(rbuild): build insert/update ... methods
It's just the first version which defaults everything. Required parameter lists still have to be built. It's not going to be a problem at all.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,7 @@ use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::borrow::BorrowMut;
|
||||
use std::cell::RefCell;
|
||||
use std::default::Default;
|
||||
|
||||
pub use cmn::{Hub, ResourceMethodsBuilder, MethodBuilder, Resource, Part, ResponseResult, RequestResult, NestedType};
|
||||
|
||||
|
||||
@@ -60,16 +60,14 @@ impl<'a, C, NC, A> MethodBuilder for ${ThisType} {}
|
||||
|
||||
impl<'a, C, NC, A> ${ThisType} {
|
||||
|
||||
% if 'description' in m:
|
||||
${m.description | rust_doc_comment, indent_all_but_first_by(1)}
|
||||
///
|
||||
% endif
|
||||
/// Perform the operation you have build so far.
|
||||
/// Can only be called once !
|
||||
/// TODO: Build actual call
|
||||
pub fn ${api.terms.action}(self) {
|
||||
|
||||
}
|
||||
|
||||
## PROPERTIES ###############
|
||||
## SETTERS ###############
|
||||
% for p in method_params(m):
|
||||
${self._setter(resource, method, m, p, ThisType, c)}\
|
||||
% endfor
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<%!
|
||||
from util import (put_and, rust_test_fn_invisible, rust_doc_test_norun, rust_doc_comment,
|
||||
rb_type, singular, hub_type, mangle_ident)
|
||||
rb_type, singular, hub_type, mangle_ident, mb_type, method_params, property,
|
||||
to_fqan, indent_all_but_first_by)
|
||||
%>\
|
||||
<%namespace name="util" file="util.mako"/>\
|
||||
<%namespace name="lib" file="lib.mako"/>\
|
||||
@@ -41,4 +42,28 @@ pub struct ${ThisType}
|
||||
}
|
||||
|
||||
impl<'a, C, NC, A> ResourceMethodsBuilder for ${ThisType} {}
|
||||
|
||||
## Builder Creators Methods ####################
|
||||
impl<'a, C, NC, A> ${ThisType} {
|
||||
% for a in c.rta_map[resource]:
|
||||
<%
|
||||
m = c.fqan_map[to_fqan(name, resource, a)]
|
||||
RType = mb_type(resource, a)
|
||||
%>\
|
||||
|
||||
% if 'description' in m:
|
||||
/// Create a builder to help you perform the following task:
|
||||
///
|
||||
${m.description | rust_doc_comment, indent_all_but_first_by(1)}
|
||||
% endif
|
||||
fn ${mangle_ident(a)}(&self) -> ${RType}<'a, C, NC, A> {
|
||||
${RType} {
|
||||
hub: self.hub,
|
||||
% for p in method_params(m):
|
||||
${property(p.name)}: Default::default(),
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
% endfor ## for each activity
|
||||
}
|
||||
</%def>
|
||||
Reference in New Issue
Block a user