package ussd import ( "context" "github.com/carlmjohnson/requests" ) type ( USSDClient struct { endpoint string } USSDResponse struct { Address string `json:"address"` } ) func New(endpoint string) *USSDClient { return &USSDClient{ endpoint: endpoint, } } func (uc *USSDClient) GetAddress(ctx context.Context, phone string) (string, error) { var resp USSDResponse if err := requests. URL(uc.endpoint + phone). ToJSON(&resp). Fetch(ctx); err != nil { return "", err } return resp.Address, nil }