* recurively drill down a mutable, recursive enumeration, without borrow
checker issues. The obvious solution doesn't work, but should.
Stackoverflow ?
* infrastructure to set actual value, with support for ararys, pods and
hashmaps
Previously we only knew the type as string, now we have enums and
additional type information, like whether or not it's a POD.
However, borrow-checker doesn't like the current code, will need more
work.
Previously we would set static structures manully, using complex cases
and utility functions. Now we setup the foundation to allow setting
a generic `json::value::Value` instead, which can later be deserialized
into the target structure.
Related to #111
* Vec::add was removed ... which forces me to write 4 lines instead of
one very readable one :(.
Not everything is to the better here, even though I can imagine they
did it to prevent people from thinking this is a cheap operation.
[skip ci]
Without all that clutter, it's so much more enjoyable to read the
output.
The implementation is based on a suggestion of @erickt, which is
converts into a json::Value (able to represent any json structure),
on which the filtering is applied.
If we should ever implement pretty-printing in json-tools, we might
still consider using these capabilities instead, as we would avoid
building potentially large datastructures, all we would need is
a sufficiently large destination buffer which is a single alloc and
a consecutive region in memory.
Closes#102
[skip ci]
Instead of using multiple lines to add vectors up involving iterators,
I just add slices together. This should produce less, and possibly
faster machine code, with less ascii code.
Downloads tested with drive2, and are verified to be working !
Close#97
Global params were repeated per method, even though they were global,
per API. Now they are kept in vectors and used at runtime, accordingly.
We save a little bit of code, have simple matches, and less repition.
It's unclear if this reduces the size of the binary though ... or the
compile times, as the extra loop is an extra loop after all ;).
Still need to test the download mode using drive1
Related to #97
[skip ci]
* functionality is cursor-aware, and fixes the actual string the user
passed in. That way, it is made very clear how the suggested value
is to be used.
* it's a known weakness of the implementation that it operates on a
flattened list of field names, and thus may make nonsensical
suggestions.
* added punctuation to all errors
Fixes#67
[skip ci]
* As `possible_values()` applies to all arguments, we cannot use it
anymore but have to check the UploadProtocol type ourselves.
Besides that, switching to the latest `clap` simplified our lives
a little.
* ajusted docs to not enforce using `-r` all the time
Fixes#92
[skip ci]
* Use `Result` everywhere, instead of Option or tuples
* Properly handle error occurring after the dry-run. We do it in an
extensible way, in case we need to do more than handle invalid output
files at some point. Output files that could not be opened will now
result in a nice error message with all the information we have.
Fixes#66
* More detailed error type for JsonTokenStorage
* removed all traces of rustc_serialize
* use pretty-printers everywhere to allow writing human-readable json
files for secretes and for tokens
Fixes#93
* adjust documentation to resemble actual upload flag semantics. It was
still using the one previously used in docopt.
* Make -m <mime-type> optional, defaulting to 'application/octet-stream'
Should have been fixed alongside of #81
* CallType now represents either Upload or Standard calls, whereas
the Upload variant is represented by the UploadProtocol enum.
That way it's clear what happens, and we don't mix orthogonal concepts
in one enumeration just for convenience.
All tested APIs seem to build, verified
* upload
* download
* request structures
* parameters
* scopes
* config-dir
* debug[-auth]
Fixes#81
* mkdoc docs grammar is now hierarchical, making the command structure
more obvious and easier to understand. It's a nice addition to the
auto-generated, hierachical usage of clap.
* UploadProtocol enum is now CallType, to ease handling the different
ways the Call has to be executed. It looks quite clean, even though
combining upload protocols and the calltype is a bit hacky.
* `--version` now includes the API revision we embody
(using crate_version())
* Allow multiple scopes to be specified, instead of just one. Previously
this was problemantic due to argument parsing of docopt being greedy.
However, this also means we have to specify the `-r` flag for each
invocation. See https://github.com/kbknapp/clap-rs/issues/89 .
* Adapted to new signature of `Arg::possible_values()` and used the
previously orphaned `UploadProtocol` enum.
* Deduplicated code a little by adding the new `opt_values()` generator
function.
Related to #81
We will try to wait for https://github.com/kbknapp/clap-rs/issues/87
to allow us to use the enumeration instead of strings, as well as
an iterator, which will look more idiomatic in the end.
We are currently setting everything up at runtime, and manage to get
nearly all information into it, except for the more complex
`-u (simple|resumable) <file> <mime>` flag.
Fixes#87
Related to #81
We do this in the hopes to circumvent a stack overflow.
This means we will setup the parser entirely at runtime, which actually
saves a little bit of code.
* now the cursor will only be set permanently if the -r flag is used in
'cursor' mode. In 'cursor=value' mode, the cursor change doesn't
persist among the flags. That way, one can easily distinguish
between setting the cursor, and setting a field. However,
'...sublevel.level=value' will still work as it did previously, yet
the cursor change will not persist.
* Documentation was adjusted to represent the new cursor style.
Fixes#86
Previously, even though the request was passed by reference, it was
copied and thus our changes never arrived in the call.
Now the API makes this clear by taking ownership, and the CLI code
sets the Request value lateron, explicitly.
Related to #76
* implement custom scopes - previously they could be set, but were
ignored during the API call
* api-overrides are not yaml files for convenience. Existing ones were
updated as needed.
Fixes#75
* updated all json API descriptions
* enabled 'pretty' printing of response structures. However, currently
there is no way to get rid of all the NULL fields without external
filtering
* all structure fields are now optional - there seems to be no way
around it.
Fixes#73
That way, we can provide better service, as CLIs that consume a lot of
quota can easily have their own app credentials, and with it, their
own quota.
The fallback will be a project that allows to use all possible
google APIs.
The user can always put in his own application secret to use his own
quota or even paid services.
Fixes#80
* with native support for type conversion and error handling
* improved hash-map key-value parsing to at least state that it knows
it's dealing with a hashmap. Error text is still not what it should
be because we don't know at runtime (initially) what type we handle.
Fixes#68
Related to #77
* Seem to work for docopt, mkdocs and code itself
* mkdocs now show type of required params
* some code which deals with converting elements to their
target types is totally untested right now.
Related to #77
* Allow to see all authentication related communication, similar to
--debug flag otherwise.
* fixed broken generator when handling request value parsing.
Fixes#70
* If `--debug` is set, we will output all server communication to
stderr. That way, we can compare our requests to what is expected by
ush based on official docs.
* `discovery` now doesn't use the API key anymore - this is specified
using a custom override.
Nice, we are totally ready to test and fix all API features.
Related to #70
* Default::default() optimized to use T::default() if possible
* deduplicated special type handling ('Count' strings -> int64)
* put request value parsing into own private function
Fixes#69
[skip ci]
This works already for simple request values, but doens't generate
compiling code for structures with Parts in them.
Nonetheless, it's a big step towards finishing the overall issue.
Related to #64
We handle errors gracefully with costum types and minimal amount of
code. Unfortunately, Mime type parsing is very 'flexible', allowing
nonesense types to be passed easily.
Related to #62
* API-docs now adjust depending on where 'alt' is set (either as global
parameter, or as method-parameter)
* CLI: download tracking now works for 'alt' as method-parameter
* CLI: global parameter remapping allows them to be named consistently,
but map to the name required by the google API.
Fixes#61
* set globally shared parameters (which includes 'alt')
* track if 'alt' is set to 'media' at runtime to do the right thing when
outputting the result. There is still an issue to be fixed though
Related to #61
It's implemented in a working fashion, except that the default value
is not currently set to something sensible, causing duplicate errors in
case the key-value syntax is wrong.
Related to #61