Commit Graph

218 Commits

Author SHA1 Message Date
Sebastian Thiel
5ff22851fa fix(apis): exclude those with recursive schemas
They currently don't compile as Box 'serde' is not supported.
See https://github.com/erickt/rust-serde/issues/45.

Related to #34.
2015-03-21 08:20:06 +01:00
Sebastian Thiel
9abf0eb64a chore(youtube): add latest version
* json takes delegate errors
2015-03-20 20:11:58 +01:00
Sebastian Thiel
8d9f175f91 fix(types): make recursive types possible
Must be `Option<Box<T>>` now, whereas a simple `Box<T>` worked
previously. Anyway, serde can't decode/encode Boxes yet, so
plus1 was removed from the list of APIs to build.

Related to #34
2015-03-20 20:10:16 +01:00
Sebastian Thiel
0823dec75c feat(doit): don't crash if json decode fails.
Instead, tell the delegate about it and return the error.

Fixes #33
2015-03-20 19:31:19 +01:00
Sebastian Thiel
8bb2166da0 feat(types): mark unused types with marker trait
For some reason, some google APIs define types they never use. We now
mark them, just because we can, to show our superiority ;) ;) ;) :D .
2015-03-20 18:31:46 +01:00
Sebastian Thiel
10dfeeb1aa fix(name): MethodBuilder -> CallBuilder
Find-and-replace. It seems to build and work correctly, still
2015-03-20 18:20:50 +01:00
Sebastian Thiel
97da926e28 fix(readme):improved markdown for library overview
And names of free methods, which previously contained '.'. These are
now spaces.
2015-03-20 18:15:39 +01:00
Sebastian Thiel
bb75c5b698 feat(schema): support for 'variant' schema
Documentation links, at one spot, have been updated as well.
The variant schema is represented natively as enum, it all looks
very good.

Json has been taken care of as well ... .
2015-03-20 18:11:29 +01:00
Sebastian Thiel
55978ff9a2 feat(json): Option<_> in schema only if needed
This means that only part fields will be optional.

Fixes #32
2015-03-20 16:43:13 +01:00
Sebastian Thiel
29ecef622a Merge branch 'serde' 2015-03-20 14:50:28 +01:00
Sebastian Thiel
ff385e5cac fix(json): just add latest youtube code
It's good to see what actually changed in the json realm.
2015-03-20 14:49:56 +01:00
Sebastian Thiel
cfb8faefb8 fix(json): Vec/HashMap are Optionals
That assures that we can decode partial server responses, and send
partial structures as well.
2015-03-20 14:47:26 +01:00
Sebastian Thiel
9f719dd928 feat(json): added field aliases, were needed
This makes sure our fields can properly be decoded.
2015-03-20 14:16:06 +01:00
Sebastian Thiel
b9a81a900e fix(cmn): serde cleanup;JsonError pub fields 2015-03-20 12:05:29 +01:00
Sebastian Thiel
d3bb130be0 feat(lib): use serge instead of serialize
However, for some reason, the `Serialize/Deserialize` macros don't work
for me, even though they work just fine in the respective tests of
the serge crate. What am I possibly doing wrong ?
2015-03-20 11:28:09 +01:00
Sebastian Thiel
b6ebb1ec37 fix(types): prevent type-clash with Result
This should have been fixed in previous commit, but wasn't.
Actually a change that fixed one API, broke the other, and vice-versa.

It's kind of a hack, because it's tailored to fix particular cases only,
yet I believe it's contained enough to say 'good enough'.
2015-03-20 08:46:30 +01:00
Sebastian Thiel
265b448297 feat(doit): simplify delegate calls
Now we use the DefaultDelegate as standin in case there is user-delgate.
That way, we save plenty of complexity as no additional
`if let Some(ref mut dlg) = delegate` is necesary.

Fixes #30
2015-03-19 19:26:19 +01:00
Sebastian Thiel
3a15430339 feat(types): prevent duplicate schema types
These could clash with types we import from Cmn. When that happens,
just a single list must be adjusted for a fix, see
`unique_type_name`

Fixes #26
2015-03-19 19:09:53 +01:00
Sebastian Thiel
508d14eafb feat(delegate): begin()/finished() calls
During `begin()`, the delegate receives additional information about the
current call, which can be useful for performance tracking, among
other things.

Fixes #25
2015-03-19 15:30:39 +01:00
Sebastian Thiel
a05426e79b fix(doc-links): some links pointed to old doc name
With one of the recent changes, the crate name was changed to be
different from the library name. However, there were still plenty of
places that would refer to the library name instead of the new crate
name.

That way, links in the README.md as well as index/index.html still
pointed to the old location.
2015-03-19 14:40:59 +01:00
Sebastian Thiel
aadf37004e docs(methods):deal with 'virtual' methods resource
We assure to know about it, instead of writing nonsense about that
'methods' resources which does not actually exist.

I am relatively sure to have found all the spots.

Fixes #22
2015-03-19 11:56:18 +01:00
Sebastian Thiel
2f293f5e1b docs(ul/dl): method features and general info
* add method listing for various categories, like 'downloads' and
  'uploads'
* add general information on how to do downloads and uploads using
  various protocols

Fixes #28
2015-03-19 11:00:59 +01:00
Sebastian Thiel
02d7a06fdf feat(downloads): alt 'media' handling to allow dls
This also includes documentation to state which methods actually support
media download, and how to achieve that.

Added TODO to not forget we should tell the user how to achieve these
kinds of things.

Fixes #21
2015-03-19 09:31:29 +01:00
Sebastian Thiel
4a27ac7e1d feat(cargo): crates with 'google-' prefix
Fixes #23
2015-03-19 08:08:48 +01:00
Sebastian Thiel
cb5a0a35bc feat(hub): allow to set user-agent
Fixes #24
2015-03-19 07:54:15 +01:00
Sebastian Thiel
9d401f5486 feat(doit): optimizations and simplification; seek
* MultiPartReader is using match to handle state, reducing unnecessary
  calls to 0 in that regard.
* Fixed seek() calls on readers, assuring they are reset to start each
  time the loop is done.
* both media-parameters now use `ReadSeek` streams.
* Use `seek()` to figure out size, simplifying the interface.

Closes #17
2015-03-19 07:30:43 +01:00
Sebastian Thiel
6b2301351f fix(common): MultiPartReader test case
Simple fixes, required as its API changed
2015-03-18 22:18:17 +01:00
Sebastian Thiel
224af64068 feat(doit):optimized memory allocation and options
* reserve_exact(X) where possible (params, multi-part-reader)
* `if let` used whereever possible to prevent duplicate checks

This increases the possible performance, and makes for more readable,
concise code.
2015-03-18 22:03:52 +01:00
Sebastian Thiel
e53e23a893 fix(common): MultiPartReader now works correctly
The state-handling was incorrect, causing it to not handle small reads
correctly.
However, this is working nicely now.
2015-03-18 21:09:48 +01:00
Sebastian Thiel
b127df17b0 feat(common): multibytereader single byte test
It shows that we actually don't handle our state correctly.
The first test which reads to string obviously uses a big-enough buffer.
2015-03-18 19:05:07 +01:00
Sebastian Thiel
8db346b8b0 feat(common): MultiPartReader is working.
Something that is missing is a single-byte read test
2015-03-18 18:48:03 +01:00
Sebastian Thiel
71c827b306 feat(doit): initial part writing
We are a state-machine, and handle parts of it correctly.
However, we don't yet write the boundary at all, and could improve
our use of match.
2015-03-18 17:53:39 +01:00
Sebastian Thiel
fc589cb965 feat(doit): multi-part mime-type and add_parts()
Next we will implement the actual Read method
2015-03-18 16:15:51 +01:00
Sebastian Thiel
3ea5e19485 feat(doit): handle 'alt' param
It's conditionally set to json, if we expect a response value.

Fixes #20
2015-03-18 15:41:23 +01:00
Sebastian Thiel
29d9e45c9f fix(doit): fix lifetime issues
Those were totally real, actually, and I am happy the borrow checker
exists !

Only one weirdness happened with RefCell<BorrowMut<C>>, but it could be
fixed by checking actual types using `let foo: () = something_nasty()`.
2015-03-18 15:05:01 +01:00
Sebastian Thiel
b0a1f518e9 feat(doit): more multipart infrastructure
* outer frame of `MultiPartReader` to allow using it in `doit()`
* restructured `doit()` to get content-types right

There is more work to do, as it currently doesn't compile, nor
do we deal with our streams correctly.

But we are on a good way.
2015-03-18 12:40:18 +01:00
Sebastian Thiel
7cfb5afd39 feat(doit): improve body infrastructure
This will support choosing custom readers at runtime, depending on
whether we have a resumable or simple media upload.
2015-03-18 08:50:22 +01:00
Sebastian Thiel
76827ff665 refactor(mbuild+lib): remove map!, better dlg call
* map! wasn't used.
* improved delegate calls, using `match` or `delegate.is_some()` to
  get the nicest looking, shortest-possible code
2015-03-17 21:56:34 +01:00
Sebastian Thiel
b90a191688 fix(doit): repeated params string addition
It seems odd that String + &str is required.
In any way, previously it would try to add i32 to a string.
2015-03-17 19:59:04 +01:00
Sebastian Thiel
d2bf24ca85 feat(doit): simplify URL_ENCODE handling
More maintainable template code, with less redundancy.
2015-03-17 19:21:12 +01:00
Sebastian Thiel
1fee21de24 feat(doit): uri-template handling complete
We now handle url-encoding for the parameters that would require it,
and can deal with repeated params that will match '/param*'.
2015-03-17 19:12:44 +01:00
Sebastian Thiel
54eb784a55 feat(doit): uri-template generation works
This doesn't mean it's correctly implemented, but we are on our way.
It does compile, at least
2015-03-17 18:27:25 +01:00
Sebastian Thiel
863a98c0d7 fix(docs): repeated parameters docs improvement
Previously, it said it would 'set' the property, which is not the case
after all.
2015-03-17 17:34:33 +01:00
Sebastian Thiel
64219e7e7e feat(doit): repeated types in examples
Made sure usage examples know how to use repeated types.
2015-03-17 17:28:03 +01:00
Sebastian Thiel
d758f410f6 feat(doit): repeatable parameters working
The code dealing with them currently assumes they are "/" separated.
2015-03-17 17:16:27 +01:00
Sebastian Thiel
63997910de fix(makefile): regenerate .api.deps less often
It took too long to do it, so the 'MAKO_LIB_FILES' dependency was
removed. It can be re-added if needed.
2015-03-17 16:32:51 +01:00
Sebastian Thiel
79879daf1b fix(methods): decent solution for free methods
Now I just add a 'virtual' resource, which is called 'methods'.
The good thing about this is that it works well standalone, or
in conjunction with actual resources.

Also the system works with it just with minimal changes

Fixes #19
2015-03-17 16:31:22 +01:00
Sebastian Thiel
60d953a342 feat(methods): intermed. support for 'methods'
These 'methods' have no resources, and need slightly special handling.
This version at least makes the generator work, even though
it produces duplicates.

However, as it is so ugly, I'd rather consider to change it
substantially ... this feature should just come naturally.
2015-03-17 15:48:07 +01:00
Sebastian Thiel
354370705d feat(doit): partial implementation of url expr
URL expressions allow to substitute values within the URL with
parameters. However, this is not only a simple key-value replacement,
but supports expressions that need a parser.

This one will have to be implemented next.
2015-03-17 11:41:51 +01:00
Sebastian Thiel
33e85ddd29 feat(doit): set upload media type
Related to #17
2015-03-17 10:39:11 +01:00