github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/api/uaa/prompts.go (about)

     1  package uaa
     2  
     3  import (
     4  	"fmt"
     5  	"net/http"
     6  )
     7  
     8  func (client *Client) GetLoginPrompts() (map[string][]string, error) {
     9  	type loginResponse struct {
    10  		Prompts map[string][]string `json:"prompts"`
    11  	}
    12  
    13  	request, err := client.newRequest(requestOptions{
    14  		Method: http.MethodGet,
    15  		URL:    fmt.Sprintf("%s/login", client.LoginLink()),
    16  	})
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  
    21  	info := loginResponse{}
    22  	response := Response{
    23  		Result: &info,
    24  	}
    25  
    26  	err = client.connection.Make(request, &response)
    27  	if err != nil {
    28  		return nil, err
    29  	}
    30  
    31  	return info.Prompts, nil
    32  }