github.com/grokify/go-ringcentral-client@v0.3.31/office/v1/client/configuration.go (about)

     1  /*
     2   * RingCentral Connect Platform API Explorer
     3   *
     4   * <p>This is a beta interactive API explorer for the RingCentral Connect Platform. To use this service, you will need to have an account with the proper credentials to generate an OAuth2 access token.</p><p><h2>Quick Start</h2></p><ol><li>1) Go to <b>Authentication > /oauth/token</b></li><li>2) Enter <b>app_key, app_secret, username, password</b> fields and then click \"Try it out!\"</li><li>3) Upon success, your access_token is loaded and you can access any form requiring authorization.</li></ol><h2>Links</h2><ul><li><a href=\"https://github.com/ringcentral\" target=\"_blank\">RingCentral SDKs on Github</a></li><li><a href=\"mailto:devsupport@ringcentral.com\">RingCentral Developer Support Email</a></li></ul>
     5   *
     6   * API version: 1.0
     7   * Generated by: OpenAPI Generator (https://openapi-generator.tech)
     8   */
     9  
    10  package ringcentral
    11  
    12  import (
    13  	"net/http"
    14  )
    15  
    16  // contextKeys are used to identify the type of value in the context.
    17  // Since these are string, it is possible to get a short description of the
    18  // context key for logging and debugging using key.String().
    19  
    20  type contextKey string
    21  
    22  func (c contextKey) String() string {
    23  	return "auth " + string(c)
    24  }
    25  
    26  var (
    27  	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
    28  	ContextOAuth2 = contextKey("token")
    29  
    30  	// ContextBasicAuth takes BasicAuth as authentication for the request.
    31  	ContextBasicAuth = contextKey("basic")
    32  
    33  	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
    34  	ContextAccessToken = contextKey("accesstoken")
    35  
    36  	// ContextAPIKey takes an APIKey as authentication for the request
    37  	ContextAPIKey = contextKey("apikey")
    38  )
    39  
    40  // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
    41  type BasicAuth struct {
    42  	UserName string `json:"userName,omitempty"`
    43  	Password string `json:"password,omitempty"`
    44  }
    45  
    46  // APIKey provides API key based authentication to a request passed via context using ContextAPIKey
    47  type APIKey struct {
    48  	Key    string
    49  	Prefix string
    50  }
    51  
    52  type Configuration struct {
    53  	BasePath      string            `json:"basePath,omitempty"`
    54  	Host          string            `json:"host,omitempty"`
    55  	Scheme        string            `json:"scheme,omitempty"`
    56  	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
    57  	UserAgent     string            `json:"userAgent,omitempty"`
    58  	HTTPClient    *http.Client
    59  }
    60  
    61  func NewConfiguration() *Configuration {
    62  	cfg := &Configuration{
    63  		BasePath:      "https://platform.devtest.ringcentral.com",
    64  		DefaultHeader: make(map[string]string),
    65  		UserAgent:     "OpenAPI-Generator/1.0.0/go",
    66  	}
    67  	return cfg
    68  }
    69  
    70  func (c *Configuration) AddDefaultHeader(key string, value string) {
    71  	c.DefaultHeader[key] = value
    72  }