Commit Graph

63 Commits

Author SHA1 Message Date
Sebastian Thiel
60adacf8d4 feat(doit): pre-request delegate call.
This one is likely to change the further we advance in the upload-media
implementation.
2015-03-17 09:21:18 +01:00
Sebastian Thiel
eef1471357 feat(doit): json decode and delegation
Now json errors are handled and delegated with the option to retry,
and all other values are just decoded according to plan.

For now, I brutally unwrap json values assuming this will work, because
it really should work.
2015-03-16 17:14:04 +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
814c9c9ffa fix(lib-name):user lower-case library names,always
fixes #14
2015-03-16 08:50:23 +01:00
Sebastian Thiel
7f33cf22a5 feat(docs): add cargo.toml dependency information
Fixes #10
2015-03-15 11:37:19 +01:00
Sebastian Thiel
dd0772f1d7 feat(travis): docs and tests of youtube3 on travis
This might already bring it close to 7 minutes runtime, which seems
like providing us with a buffer big enough for when it is
feature-complete.
2015-03-14 11:52:59 +01:00
Sebastian Thiel
c0a2476058 feat(deps): update-json using discovery API
Instead of depending on the google go client API repository, I now
use the original data source, namely the discovery API.

fixes #5
2015-03-13 17:06:48 +01:00
Sebastian Thiel
c8061ebe2f fix(#5): use function to make links correctly
It will automatically handle rust-doc mode, and use relative or absolute
links respectively.
2015-03-13 15:39:33 +01:00
Sebastian Thiel
4cf365d026 docs(todos): result handling and remaining todos
Basically there is no todo left, which puts us in a good position for
implementing more features, and get some feedback in the meanwhile.
2015-03-13 15:01:32 +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
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
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
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
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
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
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
2d036b6623 feat(all-apis): build all apis, were possible
Now there is a blacklist feature, allowing to list apis we can't yet
handle for whichever reason.
2015-03-10 14:34:26 +01:00
Sebastian Thiel
2531011fc5 fix(resource): now with flattened activities
That way, we don't have recursive method builders, but instead
flatten the hierarchy. In our case, this is easier and means
less to type. E.g.

`hub.user().message().import(...)` now is
`hub.user().message_import(...)`

In go it would look like this though
`hub.user.messages.import(...)
which is neater.

We will never have that though, as it will initialize a massive amount
of data right on the stack, even though only some of it is ever used
... .
2015-03-10 11:55:11 +01:00
Sebastian Thiel
6d2b0fc264 fix(scope): scopes are sorted Strings now
That way, we make retrieved tokens independent of the order scopes
were passed in. Additionally, we can pass any scopes, just in case
someone uses one token for multiple APIs.
Let's keep it flexible.
2015-03-10 09:31:29 +01:00
Sebastian Thiel
28878e0618 fix(Scope): Manual scope parameter ...
... however, it should better be a set, and there must be a way to
control certain global names using the configuration :)
2015-03-10 09:05:03 +01:00
Sebastian Thiel
bb76832b2f feat(lib): new Scope enum type
For use in all places where scopes are desired. It will also be made
available for adding scopes by the user.
2015-03-10 08:35:57 +01:00
Sebastian Thiel
9bcb3f8ba9 docs(params): for additional parameters
Based on the parameters suitable for the entire API. One could also
make them available in the builder ... .
2015-03-10 07:54:58 +01:00
Sebastian Thiel
e1b7a63f06 feat(mbuild): scope as property ...
... however, it will become an enumeration, as I don't like people
putting in strings all by themselves. This also means we have to
generate good enums ourselves.
2015-03-10 07:43:49 +01:00
Sebastian Thiel
aabed38581 feat(doit): query string setup
It works for uploads as well as for others.

Next up is to setup the head and authentication. It will be as simple
as calling and handling `GetToken`, even though I think that there
needs to be better support for the scope that is asked for ... .
2015-03-09 17:29:44 +01:00
Sebastian Thiel
da300e035e feat(result): generic result type
... and we actually add additional fields to our fields list.
2015-03-09 16:16:13 +01:00
Sebastian Thiel
7c6f7d5e97 feat(params): additional fields and Result type
Now query params are handled completely, including clash check.
Additionally, there is a new result type which encapsulates everything.

It must be typed to the actual result type though, which can be a
request result
2015-03-09 15:49:53 +01:00
Sebastian Thiel
6c41660943 feat(fields): put all fields onto a list
Also handle the case when the 'part' field is generated from the
request. Additional params still need work
2015-03-09 15:26:04 +01:00
Sebastian Thiel
1423e46210 fix(delegate): it now works in every which way
Custom property annotations have been very useful, to steer very special
cases.

It's also good that now there is enough infrastructure to deal with
any amount of additional type parameters.
2015-03-09 11:55:33 +01:00
Sebastian Thiel
678b6929ca feat(delegate): first attempt to get it to work
With a big but ! The most simple thing to do it was to just add
additional type parameters to the respective method.

Now the type cannot be inferred, which means type-hints must be added.
This should be easy enough, but ... has to be done somehow.
2015-03-09 10:44:13 +01:00
Sebastian Thiel
ac35432b3f docs(lib): cross linking of resources/activities
This makes it so much easier to get to the example call you are
interested in.
It's getting there, slowly ;)
2015-03-08 18:58:15 +01:00
Sebastian Thiel
baea071a6f fix(mbuild): added size and mime type support
This information must be provided, I just forgot it
2015-03-08 17:42:41 +01:00
Sebastian Thiel
5b2d8a77a3 feat(mbuild): media-upload doit() methods
It's just a first step, and even though the generation works well,
I am still missing the right Rust code. Will have to simplify ...
2015-03-08 15:49:28 +01:00
Sebastian Thiel
de0c7a4ae0 feat(mbuild): param() to set any parameter
That way, things like drive.files.insert alt=media has a chance to work.
We should actually check for this to support various 'alt' values
2015-03-08 14:00:02 +01:00
Sebastian Thiel
0d9f6363eb fix(nestedtypes): recursion for nested types
Drive has recursive nested types, which were not handled preeviously.
2015-03-08 12:45:02 +01:00
Sebastian Thiel
66f3ae14e5 feat(drive): added gogole drive API
Just to have another, different set of api information to deal with,
and not accidentally hard-code things to work with youtube only.

Prepared dealing with media uploads, and it turns out to be best to
adjust the 'doit()' to take the respective type parameter.

We also have to think about downloads, like the ones for google drive,
which requires custom query parameters.
2015-03-08 11:38:06 +01:00
Sebastian Thiel
020300af15 feat(type-params): ground work for upload media
This might mean we need additional type parameters, but I will see how
it's going to work out.

In theory, we could define a new trait for Seek+Read, but this would
mean that we couldn't contain owned streams.

For max flexibility, it's better to have additional type parameters
and use BorrowMut to allow ownership, and borrow.
2015-03-08 09:09:18 +01:00
Sebastian Thiel
fad0a7177a fix(docs): filter request value props by parts
Previously, it would just show all parts.
It's still not correct though as this isn't necessarily the parts used
in the request value, but only the ones in the response value.

It's as good as it gets though, that's all the information contained
in the json.
2015-03-05 17:47:35 +01:00
Sebastian Thiel
42ae75c1a1 docs(mbuild): added info about settable parts
It's not as good as the parts info on the website, but it's something !
At least people don't have to read the text, but find this information
in all the spots that are relevant to this.
2015-03-05 17:32:26 +01:00
Sebastian Thiel
4e8872b37a docs(mbuild): more information, nicer visuals 2015-03-05 16:28:23 +01:00
Sebastian Thiel
a3206abc92 fix(test): method builder examples work now
It was easier than expected, but in the end needs quite some custom
code and handling. Good to have mako (and python !!!)
2015-03-05 16:10:59 +01:00
Sebastian Thiel
bfa20a18c8 docs(mbuild): method builder call example
With nearly fully randomized examples to show how it can be done.
It's quite nice to see actual calls, using everything required to get
a call. The only thing the user has to manage is to fill in actual
values.

But, it also shows that our builder pattern doesn't work yet due to ...
you guessed it ... lifetime issues :D
2015-03-05 15:42:37 +01:00
Sebastian Thiel
f2dda421e6 fix(docs): remove empty '/// # ' lines
They seem to make cargo fail to build valid doctests. Might be worth
a ticket !
2015-03-05 12:05:02 +01:00
Sebastian Thiel
70ea612f19 fix(builders): fixed part handling,it compiles now
What's missing is docs, which will see some work now.
I guess it will be best to hide all the prelude from the user, to allow
him to focus on what's important here.
2015-03-05 11:07:43 +01:00
Sebastian Thiel
48d40d45c5 feat(builders): request type handling part 1
Now we will generate proper resoure methods builder calls to instaniate
the more or less valid method builders.

However, it doesn't compile yet, and the 'to_parts()' method on
resources is still missing.
2015-03-05 08:27:07 +01:00
Sebastian Thiel
452b658c27 fix(mbuild): setters now copy copyables
Previously, they would take everything as reference and clone
everything unconditionally. Now we do it only as we need to do it,
no extra work incurred.
2015-03-04 21:13:04 +01:00
Sebastian Thiel
693b5c8f6a feat(rbuild): build insert/update ... methods
It's just the first version which defaults everything.
Required parameter lists still have to be built.

It's not going to be a problem at all.
2015-03-04 20:57:04 +01:00
Sebastian Thiel
1dc168497e refactor(mbuild): new _setter method
Just to make things a little easier to read. Don't expect it to
grow much larger though.
2015-03-04 20:29:58 +01:00
Sebastian Thiel
582aca3249 feat(setters): properties and setters for mbuilder
This includes descriptions, of course, and generally seems to look
quite neat. For now, we brutally consume all input to own it,
but in future we might be able to put in Borrow to support them all.
2015-03-04 19:18:04 +01:00