Commit Graph

104 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Sebastian Thiel
2c79f6e3cf feat(doit): authentication with and without scopes
It's quite rough around the edges, but has a slight chance to work.
Will still to handle return values accordingly.
2015-03-16 15:23:38 +01:00
Sebastian Thiel
1349c786b7 fix(doit): remove BorrowMut until it's cleared
See stackoverflow at http://goo.gl/f27zJkj.

Now we can actually call out client and move on with handling the result
2015-03-16 11:51:12 +01:00
Sebastian Thiel
9a58b0badd feat(doit): attempt to send json-encoded request
This doesn't work yet, as I am unable to unwrap the client properly.
It's a refcell that contains a BorrowMut to a hyper::Client, and
lets just, it's complicated.
2015-03-16 10:35:26 +01:00
Sebastian Thiel
814c9c9ffa fix(lib-name):user lower-case library names,always
fixes #14
2015-03-16 08:50:23 +01:00
Sebastian Thiel
9a17ab9e4e feat(docs): full usage example on landing page
Related to #4
2015-03-12 16:40:28 +01:00
Sebastian Thiel
4b9dbb28ff fix(to_version): assured it handles '0' correctly
Previously, it could possibly take a '0' away from the start of a
version. Now this is definitely not possible anymore.

Fixes #3
2015-03-12 11:40:09 +01:00
Sebastian Thiel
664d8225d2 feat(name): oauth22 -> oauth2_v2
Related to #3
2015-03-12 11:30:47 +01:00
Sebastian Thiel
b8956103d9 feat(names): improved library names
Related to #3
2015-03-12 11:21:11 +01:00
Sebastian Thiel
4f794ef5ff fix(types): fix incorrect nested type names
There was a name-duplication which led to un-inmplemented types.

The good thing is that this was the last issue that kept all 72
APIs from compiling.
2015-03-11 21:59:28 +01:00
Sebastian Thiel
7e243936f2 fix(traits): finally, we pick up all types
HashMap types were missing previously, but now it seems to be picked
up quite nicely.
Would this mean we do the type-setup correctly, everywhere ?
2015-03-11 21:21:11 +01:00
Sebastian Thiel
00de2b187d fix(traits): transitive, minimal traits for types
Previously, I would just assign all useful traits to all types, no
matter on how they were actually used.
Now it builds all dependnecies and considers them when assigning
traits, which is as precise as we need it.

This is important to us as the `Json` type is just encodable, but
not decodable. Fortunately, we just have to encode it, but in theory
this makes it hard to embed any json in a known structure.
2015-03-11 21:00:34 +01:00
Sebastian Thiel
e3ab233a6c fix(schema): no unused types anymore
Due to shared global state which was altered, we got wrong results.
This is fixed now, thanks to a deepcopy. Amazing, how altering global
state is always biting you, even though you are convinced it's safe
to do in just this case !
General rule: Just don't do it, no matter what !
2015-03-11 18:47:37 +01:00
Sebastian Thiel
ac8c41530d feat(schemas): now we pre-generate nested schemas
Into a complete, global list of schemas, with additional meta-data.

However, it's currently not complete, as $refs are missing.
There is some resemblance to to_rust_type(...), which worries me
slightly
2015-03-11 18:01:53 +01:00
Sebastian Thiel
712fed578a feat(json): part 1 to implement 'any' type
It is a Json object, with a schema as defined elsewhere. It's quite
cool to see this (nearly) working already. However, it will require
us to transitively assign the required markers which is based
on information we don't currently have.

Maybe implementing this could also help to simplify name-clash checks
or make them better at least ?
2015-03-11 17:07:07 +01:00
Sebastian Thiel
de40a8bd1e fix(typename): improved camelCasing
Previously, it was possible to get types like Foo_bar, which is not
desireable.
Now it is totally impossible to see such blasphemy ;)
2015-03-11 15:41:49 +01:00
Sebastian Thiel
614539a925 fix(type-clashes): protect from nested-type-clash
It was possible for a nested type to be generated with a name that in
fact CLASHED with an existing schema type. What are the odds !

The clash-check added will just verify against clashes with schema
types, which seems to be doing it for now.
2015-03-11 15:30:11 +01:00
Sebastian Thiel
32145e645e fix(names): nested type names are consistent now
At least so it appears.
The implementation doesn't look totally clean to me, as it seems
similar concerns are in different portions of the code, which was
merely tuned to work together.

It could break appart if someone - me - wants to change it sometime
2015-03-11 14:58:02 +01:00
Sebastian Thiel
da57505567 fix(types): prevent struct recursion issue
This works by just boxing types which are nested within themselves,
breaking the recursion.
2015-03-11 11:37:45 +01:00
Sebastian Thiel
9b308bb6dd fix(cosmetics): nicer code and identifiers 2015-03-11 11:29:57 +01:00
Sebastian Thiel
54540e695a fix(types): nested types work for arrays
Thanks to removed code which made no sense to me, I put in a bug.
Now the code is back, beta than ever, and documented as well :).
2015-03-11 11:18:22 +01:00
Sebastian Thiel
50fa189a71 fix(schema): now deals with non-objects
These are arrays or HashMaps, which are nested types too. This is used
to have custom types of standard vectors or hashmaps, which resolve
to NewTypes in Rust.
2015-03-11 11:07:03 +01:00
Sebastian Thiel
a268be27d2 fix(types): optionals are working once again
A bug was introduced which caused nested-types not to be optional
in situations were they should.
2015-03-11 10:32:18 +01:00
Sebastian Thiel
5d563c88a8 fix(hash): nested type resolution and hashes
It seems we do it better than the actual Go implementation, which fails
to detect that scopes are actually having a string member.

However, there still is an issue, as it's as hashmap for us, but just
a member for go ... lets see ...
https://developers.google.com/discovery/v1/reference/apis#resource
shows that we implement it correctly :) !!
2015-03-11 10:19:51 +01:00
Sebastian Thiel
efe56ad250 fix(util): deepcopy dicts instead
It was possible for writes to happen in nested dicts, causing global
data to change and confuse the system.
Not that I wouldn't be aware of that danger, but apparently I didn't
see the recursiveness of the call tree :).
2015-03-11 08:40:05 +01:00
Sebastian Thiel
cf258bf4e5 fix(build): fixes to help more projects to build
Involving
* complete list of reserved words (keywords in Rust)
* use namespace for otherwise clashing types in cmn::, io::
2015-03-11 08:16:10 +01:00
Sebastian Thiel
d99ba9c5b3 fix(mako): fix name clashes
Scopes could be invalid, previosly, and the hub type could clash
with other types provided as Schema.

Also, we used reserved identifiers
2015-03-10 18:03:35 +01:00
Sebastian Thiel
c7e169dff3 fix(util): resource-to-category map
It allows to obtain category, which we previously dropped
2015-03-10 16:23:22 +01:00
Sebastian Thiel
7816cc8145 fix(util): do not degenerate during activity_split
First step, next one will actually be keeping that data ...
2015-03-10 16:10:19 +01:00