iver-wharf / wharf-api-client-go Goto Github PK
View Code? Open in Web Editor NEWREST & gRPC client to talk to the Wharf API, written in Go
License: MIT License
REST & gRPC client to talk to the Wharf API, written in Go
License: MIT License
Support specifying engine in regarded endpoints that was added in wharf-api v5.1.0.
New endpoint:
GET /api/engine
New query param ?engine=
:
POST /api/project/{projectId}/build?engine=jenkins
For all endpoint functions, something like this should be enough:
+// GetTokenByID invokes the HTTP request:
+// GET /api/token/{tokenID}
func (c Client) GetTokenByID(tokenID uint) (Token, error) { newToken := Token{}
apiURL := fmt.Sprintf("%s/api/token/%v", c.APIURL, tokenID)
Somewhere there should be a note about the ProblemError
and AuthError
that can be returned. Perhaps in an example test, or in the package documentation, or both
Continuation from iver-wharf/wharf-api#56
The Provider's upload URL is unused. This change is not backwards compatible for any code that uses wharfapi.Provider.UploadURL
for any purpose.
PutBranch
should do as the name says and PUT
, not POST
.
PutBranch
PUT
instead of POST
Based on iver-wharf/iver-wharf.github.io#75
Need to run Go tests and goimports formatting tests on commits and pull requests automatically.
As Wharf cannot do this yet, we should aim at using GitHub Actions.
Either we use the starter-workflow for Go https://github.com/actions/starter-workflows/blob/1d8891efc2151b2290b1d93e8489f9b1f41bd047/ci/go.yml which simply runs go test
Or we could look into a better integrated solution that could report failing tests as annotations inside the pull requests, such as:
There is currently no way to POST a project to wharf-api using this client.
This was "okay" before since the backend PUT
and POST
operations for projects were basically identical, but with recent updates in wharf-api PUT
ting now leads to a successful create, except for the fact that the ProviderID
becomes null and the import process has to be repeated to get the desired result.
Changes needed to be made to be wharf-api v5.0 compatible.
!! This is a non-exhaustive list of changes required !!
Please comment with any additional things that come to mind.
PUT
endpoints to pass ID using path params instead of in the request body.
PostProject
PostBranch
PutXXX
methods docs comments to no longer say they create.
PutBranch
PutToken
PutProject
PutProvider
PutXXX
that actually POST
PutBranch
- Change to PUT
PostXXX
that actually PUT
PostProjectRun
- Change to POST
GetXXX
methods to match new ones.Names used here are previous names for the functions.
wharf-api v5.0.0
handlers for the endpoints, e.g. GetProjectListHandler
, minus the -Handler
.Backwards compatibility will not be considered for this change.
Code using this client won't need to change that many things, whilst trying to keep it backwards compatible would greatly extend the required time to complete this.
Depends on iver-wharf/wharf-api#12
After adding Project.RemoteProjectID
to wharf-api we need to add it here as well to stay up-to-date.
If specifying e.g http://wharf-api
(assuming port 80 because of the protocol) then it error the following:
Error while dialing dial tcp: address wharf-api: missing port in address
This error is from our manual tests with wharf-cmd. Full log:
May-05 14:21Z [ERROR|AGGREGATOR |…k8saggregator.go:137] Relay error. pod=stage/wharf-cmd-worker-5w8kb error=`relaying to wharf: logs: open logs stream to wharf-api: open log creation stream: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp: address wharf-api: missing port in address"` (*fmt.wrapError)
Should allow setting context.Context on each request.
No need to keep the non-context.Context variant. Better to just replace and do a major version bump.
Unimplemented methods for endpoints that are implemented in wharf-api v5.0.0
.
The library doesn't follow redirects, but instead errors out with non-2xx status: 301 Moved Permanently
It should obviously follow the redirects. Don't know why it doesn't.
This has forced us to use some ugly URLs with trailing slashes due to implementation details in the wharf-api:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.