// WithLogoutChallenge adds the logoutChallenge to the accept logout request params
512738
func (o *AcceptLogoutRequestParams) WithLogoutChallenge(logoutChallenge string) *AcceptLogoutRequestParams {
	o.SetLogoutChallenge(logoutChallenge)
	return o
}
773872
func (o *FindParams) WithTimeout(timeout time.Duration) *FindParams {
	o.SetTimeout(timeout)
	return o
}
586510
func WithTimeout(timeoutType fab.TimeoutType, timeout time.Duration) RequestOption {
	return func(ctx context.Client, o *requestOptions) error {
		if o.Timeouts == nil {
			o.Timeouts = make(map[fab.TimeoutType]time.Duration)
		}
		o.Timeouts[timeoutType] = timeout
		return nil
	}
}
206605
func (o *AcceptLogoutRequestParams) WithTimeout(timeout time.Duration) *AcceptLogoutRequestParams {
	o.SetTimeout(timeout)
	return o
}
1009452
func (s *SearchContext) WithLogger(log io.Writer) *SearchContext {
	result := *s
	result.Logging = logging.NewLogBackend(log, "", 0)
	if result.Trace == TRACE_DISABLED {
		result.Trace = TRACE_ENABLED
	}
	return &result
}
1072678
func (o *PatchEndpointIDConfigParams) WithTimeout(timeout time.Duration) *PatchEndpointIDConfigParams {
	o.SetTimeout(timeout)
	return o
}
154792
func (s *Session) Logout() (err error) {

	//  _, err = s.Request("POST", LOGOUT, `{"token": "` + s.Token + `"}`)

	if s.Token == "" {
		return
	}

	data := struct {
		Token string `json:"token"`
	}{s.Token}

	_, err = s.RequestWithBucketID("POST", EndpointLogout, data, EndpointLogout)
	return
}
1322683
func (o *AcceptLogoutRequestParams) WithHTTPClient(client *http.Client) *AcceptLogoutRequestParams {
	o.SetHTTPClient(client)
	return o
}
10878
func (o *UserinfoParams) WithTimeout(timeout time.Duration) *UserinfoParams {
	o.SetTimeout(timeout)
	return o
}
473094
func exitWithError(err error) {
	fmt.Fprintf(os.Stderr, "\n%v\n", err)
	os.Exit(1)
}
413048
func (o *GetLogoutRequestParams) WithHTTPClient(client *http.Client) *GetLogoutRequestParams {
	o.SetHTTPClient(client)
	return o
}
190466
func (s *AuthenticationService) Logout(p *LogoutParams) (*LogoutResponse, error) {
	resp, err := s.cs.newRequest("logout", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r LogoutResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
536063
func (o *RejectConsentRequestParams) WithTimeout(timeout time.Duration) *RejectConsentRequestParams {
	o.SetTimeout(timeout)
	return o
}
1360671
func (o *Oauth2TokenParams) WithTimeout(timeout time.Duration) *Oauth2TokenParams {
	o.SetTimeout(timeout)
	return o
}
646154
func (c *LogoutController) doLogout(ctx jsonapi.InternalServerError, redirect *string, referrer *string) (string, error) {
	if redirect == nil {
		if referrer == nil {
			log.Error(ctx, nil, "Failed to logout. Referer Header and redirect param are both empty.")
			return "", jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterErrorFromString("referrer", referrer,
				"referer Header and redirect param are both empty (at least one should be specified)"))
		}
		redirect = referrer
	}
	log.Debug(ctx, map[string]interface{}{
		"referrer": referrer,
		"redirect": *redirect,
	}, "Got Request to logout!")

	redirectURL, err := url.Parse(*redirect)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"redirect_url": *redirect,
			"err":          err,
		}, "Failed to logout. Unable to parse provided redirect url.")
		return "", jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("redirect", *redirect))
	}
	log.Debug(ctx, map[string]interface{}{
		"redirect_url": *redirectURL,
		"err":          err,
	}, "parsed provided redirect url.")

	logoutRedirect, err := c.app.LogoutService().Logout(ctx, redirectURL.String())
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"redirect_url": redirectURL.String(),
			"err":          err,
		}, "Failed to logout.")
		return "", jsonapi.JSONErrorResponse(ctx, err)
	}

	return logoutRedirect, nil

}
562722
func (o *RejectLogoutRequestParams) WithHTTPClient(client *http.Client) *RejectLogoutRequestParams {
	o.SetHTTPClient(client)
	return o
}
668295
func WithLogEntries(msg string, err error, entries map[string][]string) {
	displayError(msg, err)

	for name, lines := range entries {
		console.OutStyle("failure", "Problems detected in %q:", name)
		if len(lines) > MaxLogEntries {
			lines = lines[:MaxLogEntries]
		}
		for _, l := range lines {
			console.OutStyle("log-entry", l)
		}
	}
	os.Exit(Software)
}