tpitale/legato

API V4 Support

tpitale opened this issue ยท 17 comments

Hi @tpitale I wonder if this issue is related to something new I just found: I can't see these new "kind" of web profiles called "App + Web" when calling the web_profiles method.

Thanks in advance!

Could you share the docs for this new kind of profile? It may be V4-only. But Iโ€™d be surprised. Either way I reallly need to do this ticket. ๐Ÿ˜†

Hi @tpitale! I'm not able to find any related documentation. I'm doing a fork now and will give it a try for the version upgrade.

wow, the change is massive! lol

Yeah, it isn't a trivial change between V3 and V4 โ€ฆ but I think we can keep the code the same in most legato, and just change the adapter that sends the request to the API. I think that will work.

It's basically โ€ฆ instead of making it query params to one endpoint, it's a POST to another endpoint with a big body for the request.

So, need an adapter to handle converting our structures into either query params or the body. And then a change in the endpoint depending on some config.

Yes, the change should be done mainly here. right?

Do you want to keep the response object with the same format that you have today?

By the way, the upgrade is only in the Reporting API, not in the Management API, so my initial "App + Web" issue shouldn't be solved by upgrading the Reporting API :(

So, there's some work here: https://github.com/tpitale/legato/blob/master/lib/legato/request.rb#L22 to handle the new endpoint. We'll need a path to switch on.

Changes in the Response

It might be best to move the current Request and Response into a new module like V3::Response and V3::Request so we can then make V4::Request and V4::Response or something like that.

Then, instead of query.to_query_string and this: https://github.com/tpitale/legato/blob/master/lib/legato/request.rb#L37 we'd probably want a new class to take a query and output the query as the request body format.

The User could have some switch on like api_version or something where it defaults to 3, and 4 is an option.

And then based on that we would look up the Request/Response here https://github.com/tpitale/legato/blob/master/lib/legato/user.rb#L14.

And all of that while updating the management API sections to use the V3::Request/response.

Hey y'all,

I was wondering how this was moving along and if y'all needed any help! Would definitely be down to help push the api-v4 along if possible.

๐Ÿ™

Started working on this, but now I have a 9-day-old baby so kinda on pause. Sorry!

bborn commented

Curious if there are any updates here? I'd love to keep using Legato for V4 if it's supported. If not, what are other people using instead?

I haven't received any PRs for the work. You're welcome to submit one @bborn.

bborn commented

@tpitale ok, I'd love to help out. Is this still the best approach?

The last time I looked, yeah. Legato hasn't changed much, but I haven't looked at the Google api since that comment.

I've got some time today to work on this, too. Give me through this weekend @bborn?

bborn commented

@tpitale happy to help out as much as possible! I just don't know the Legato internals all that well ๐Ÿ˜„

Starting with the changes to move all the existing functionality to a V3 location to make space for a V4.