github.com/blend/go-sdk@v1.20240719.1/oauth/state_option.go (about)

     1  /*
     2  
     3  Copyright (c) 2024 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package oauth
     9  
    10  // StateOption is an option for state objects
    11  type StateOption func(*State)
    12  
    13  // OptStateSecureToken sets the secure token on the state.
    14  func OptStateSecureToken(secureToken string) StateOption {
    15  	return func(s *State) {
    16  		s.SecureToken = secureToken
    17  	}
    18  }
    19  
    20  // OptStateRedirectURI sets the redirect uri on the stae.
    21  func OptStateRedirectURI(redirectURI string) StateOption {
    22  	return func(s *State) {
    23  		s.RedirectURI = redirectURI
    24  	}
    25  }
    26  
    27  // OptStateExtra sets the redirect uri on the stae.
    28  func OptStateExtra(key string, value interface{}) StateOption {
    29  	return func(s *State) {
    30  		if s.Extra == nil {
    31  			s.Extra = make(map[string]interface{})
    32  		}
    33  		s.Extra[key] = value
    34  	}
    35  }