MCPcopy Create free account
hub / github.com/cloudfoundry/cli / GetAPIVersion

Method GetAPIVersion

api/uaa/version.go:8–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6)
7
8func (client *Client) GetAPIVersion() (string, error) {
9 type loginResponse struct {
10 App struct {
11 Version string `json:"version"`
12 } `json:"app"`
13 }
14
15 request, err := client.newRequest(requestOptions{
16 Method: http.MethodGet,
17 URL: fmt.Sprintf("%s/login", client.LoginLink()),
18 })
19
20 if err != nil {
21 return "", err
22 }
23
24 info := loginResponse{}
25 response := Response{
26 Result: &info,
27 }
28
29 err = client.connection.Make(request, &response)
30 if err != nil {
31 return "", err
32 }
33
34 return info.App.Version, nil
35}

Callers

nothing calls this directly

Calls 3

newRequestMethod · 0.95
LoginLinkMethod · 0.80
MakeMethod · 0.65

Tested by

no test coverage detected