go-circleci icon indicating copy to clipboard operation
go-circleci copied to clipboard

starting down the road to supporting the circleci api v2

Open maplebed opened this issue 5 years ago • 7 comments

In doing some work with the CircleCI API I got a suggestion that I look at v2 of the API. It is not yet released but some of the pre-release documentation is https://github.com/CircleCI-Public/api-preview-docs. Specifically, https://github.com/CircleCI-Public/api-preview-docs/blob/master/docs/api-changes.md holds the definition for the /workflow endpoint.

This change adds support for v2 of the API by initially adding the ability to fetch details for a specific workflow and all the jobs in that workflow. From there you can fall back to the v1 api to get the full details for a specific job.

I'm opening this PR for comments on the approach. Is this useful work? If it is, maybe it could be merged in to a v2 tag or something for further work before landing in master, since the API is still in pre-release mode and will likely change.

Thanks!

Here's some sample code that exercises the new functions defined: https://gist.github.com/maplebed/d9cb97961448dc02a641200b089e2f19

maplebed avatar Jun 21 '19 05:06 maplebed