mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
fix(apis): intermediate improvements ...
... it shows that the override I used previously won't work for `admin`. Therefore we have to keep the actual value, instead of degenrating it. Makes sense ... it's interesting how much one tends to hard-code things to work just for a few cases, unless you opt in to see the whole picture
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
<%
|
||||
# fr == fattest resource, the fatter, the more important, right ?
|
||||
fr = None
|
||||
fr = sorted(schemas.values(), key=lambda s: (len(c.sta_map.get(s.id, [])), len(s.get('properties', []))), reverse=True)[0]
|
||||
if schemas:
|
||||
fr = sorted(schemas.values(), key=lambda s: (len(c.sta_map.get(s.id, [])), len(s.get('properties', []))), reverse=True)[0]
|
||||
%>\
|
||||
# Features
|
||||
|
||||
@@ -62,6 +63,7 @@ Generally speaking, you can invoke *Activities* like this:
|
||||
let r = hub.resource().activity(...).${api.terms.action}()
|
||||
```
|
||||
|
||||
% if fr:
|
||||
Or specifically ...
|
||||
|
||||
```ignore
|
||||
@@ -70,6 +72,7 @@ Or specifically ...
|
||||
let r = hub.${mangle_ident(resource)}().${mangle_ident(activity)}(...).${api.terms.action}()
|
||||
% endfor
|
||||
```
|
||||
% endif
|
||||
|
||||
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
|
||||
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<%def name="new(resource, method, c)">\
|
||||
<%
|
||||
hub_type_name = hub_type(util.canonical_name())
|
||||
m = c.fqan_map[to_fqan(name, resource, method)]
|
||||
m = c.fqan_map[to_fqan(activity_root or name, resource, method)]
|
||||
# an identifier for a property. We prefix them to prevent clashes with the setters
|
||||
mb_tparams = mb_type_params_s(m)
|
||||
ThisType = mb_type(resource, method) + mb_tparams
|
||||
|
||||
@@ -51,7 +51,7 @@ impl${rb_params} ResourceMethodsBuilder for ${ThisType} {}
|
||||
impl${rb_params} ${ThisType} {
|
||||
% for a in c.rta_map[resource]:
|
||||
<%
|
||||
m = c.fqan_map[to_fqan(name, resource, a)]
|
||||
m = c.fqan_map[to_fqan(activity_root or name, resource, a)]
|
||||
RType = mb_type(resource, a)
|
||||
|
||||
# skip part if we have a request resource. Only resources can have parts
|
||||
|
||||
@@ -531,6 +531,8 @@ Context = collections.namedtuple('Context', ['sta_map', 'fqan_map', 'rta_map'])
|
||||
|
||||
# return a newly build context from the given data
|
||||
def new_context(resources):
|
||||
if not resources:
|
||||
return Context(dict(), dict(), dict())
|
||||
# Returns (A, B) where
|
||||
# A: { SchemaTypeName -> { fqan -> ['request'|'response', ...]}
|
||||
# B: { fqan -> activity_method_data }
|
||||
|
||||
Reference in New Issue
Block a user