Commit Graph

239 Commits

Author SHA1 Message Date
Sebastian Thiel
04f4c95688 fix(mbuild): upload size now taken properly
Previously, it would query the size from the wrong dict and obtain
the value 0 all the time. This would have made every upload fail with
`UploadSizeLimitExeeded`.
Now we obtain the actual size limit, and will ignore it if unset/0
for some reason.

Patch += 1
api-v0.1.1
2015-03-22 22:39:36 +01:00
Sebastian Thiel
3bc930ae47 fix(version-up): 0.1.0 release
* Added all APIs to source control
* upped crate version
api-v0.1.0
2015-03-22 20:30:01 +01:00
Sebastian Thiel
cd1ff18ba9 fix(cmn): upload() return value handling
Now deals with Cancellation and non-OK status codes correctly.

Fixes #18
2015-03-22 20:21:21 +01:00
Sebastian Thiel
29ee94b4c0 feat(cmn): Resumable upload implemented
With all bells and whisles. For now, we don't have a good return value
to indicate that the operation was cancelled, which needs fixing.
2015-03-22 19:56:35 +01:00
Sebastian Thiel
065753cc3a feat(cmn): implement query_transfer_status()
The delegate logic is implemented and seems sound.
It's somewhat funny that after all this back and forth, all we get
is a valid start position for the upload.
2015-03-22 17:58:34 +01:00
Sebastian Thiel
42a76e4655 feat(cmn): ContentRange header (parse and format)
Now we are able to send the transfer-update requests and implement the
actual chunk logic.
2015-03-22 16:24:39 +01:00
Sebastian Thiel
556906ca60 fix(docs): re-export types used by delegate
Otherwise, delegate implementation might not actually be possible.
2015-03-22 13:28:28 +01:00
Sebastian Thiel
3a9aa51949 fix(docs):better introduction and version handling
Make it cristal clear what the crate version means, and what version of
the documentation you are looking at. Also do this in the README file.

Assure that 'Google' is capitalized.
2015-03-22 12:33:43 +01:00
Sebastian Thiel
d26cf77406 feat(mbuild): use of oauth2::Scheme
That way, we improved our API, reduced code bloat, and are very clear
about the what we do for Authorization.
2015-03-22 12:07:40 +01:00
Sebastian Thiel
030c40d269 fix(cargo): repository/source-code link
Previously it pointed to a timestamp file. Unified repository
source code link generation, and simplified 'deps.mako'.

Related to #38
2015-03-22 10:51:06 +01:00
Sebastian Thiel
8ad316bda3 feat(cargo): crate version +<revision>
That way, crate names reveal exact inforamtion about the contained
API revision.

* crate version: code gen version
* +<revision> (build-metadata): exact version of API schema

Fixes #38
2015-03-22 10:40:59 +01:00
Sebastian Thiel
57e0f06583 feat(mbuild): check upload size against max-size
Fixes #37
2015-03-22 10:12:04 +01:00
Sebastian Thiel
c1d09e6d57 docs(lib): minor phrasing changes
Also removed superfluous 'extern' for tests
2015-03-22 09:32:08 +01:00
Sebastian Thiel
f73204c6b9 fix(cmn) re-export important types from cmn
That way, 'cmn' becomes our private module. All URLs were updated
to reflect that.

This commit also contains an early implementation of the
'transfer_status' method, which will require plenty of work.
2015-03-22 09:26:49 +01:00
Sebastian Thiel
ffef7dda57 feat(dlg): make actual store_upload_url() call
We also assure to call only as often as we have to, keeping some state
between the loops accordingly.
2015-03-21 18:44:08 +01:00
Sebastian Thiel
9ea85273cd feat(mbuild): improved delegate calls
The delegate will be asked for an upload URL, that he may store during
yet another call.
2015-03-21 18:25:59 +01:00
Sebastian Thiel
4bf280079e fix(mbuild): simplification and cleanup
* renamed `*MethodsBuilder` type to `*Methods` type
* renamed `*CallBuilder` type to `*Call` type
* greatly simplified `doit()` signature if uploads are involved
* pass `auth` to upload helper
2015-03-21 16:27:41 +01:00
Sebastian Thiel
307d3f487c feat(mbuild): resumable-upload infrastructure
Layout the `ResumableUploadHelper` and implement the entire logic
with the mbuild renerator.

All that's left to be done is to implement the 'chunked upload' method.

The borrow checker helped me to prevent a bug as well.
2015-03-21 13:55:15 +01:00
Sebastian Thiel
98f4bbab47 fix(lib):schema_markers() accessed map incorrectly 2015-03-21 10:35:20 +01:00
Sebastian Thiel
80161f72be fix(types):prune unused and ToParts trait
* do not emit unused types. Sometimes though, rustc doesn't seem to
  detect that attributses are actually used
* ToParts trait is used and implemented only when needed.

Linters are back to 'normal'.

Fixes #35
2015-03-21 10:23:40 +01:00
Sebastian Thiel
0152138e0c fix(docs): pretty names for methods and resources
Previously, it was possible for methods to have '.' which showed up
in the documentation. Now these are replaced with ' '.
2015-03-21 08:34:30 +01:00
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