github.com/free5gc/openapi@v1.0.8/Npcf_BDTPolicyControl/configuration.go (about)

     1  /*
     2   * Npcf_BDTPolicyControl Service API
     3   *
     4   * The Npcf_BDTPolicyControl Service is used by an NF service consumer to retrieve background data transfer policies from the PCF and to update the PCF with the background data transfer policy selected by the NF service consumer.
     5   *
     6   * API version: 1.0.0
     7   * Generated by: OpenAPI Generator (https://openapi-generator.tech)
     8   */
     9  
    10  package Npcf_BDTPolicyControl
    11  
    12  import (
    13  	"net/http"
    14  	"strings"
    15  )
    16  
    17  type Configuration struct {
    18  	url           string
    19  	basePath      string
    20  	host          string
    21  	defaultHeader map[string]string
    22  	userAgent     string
    23  	httpClient    *http.Client
    24  }
    25  
    26  func NewConfiguration() *Configuration {
    27  	cfg := &Configuration{
    28  		basePath:      "https://example.com/npcf-bdtpolicycontrol/v1",
    29  		url:           "{apiRoot}/npcf-bdtpolicycontrol/v1",
    30  		defaultHeader: make(map[string]string),
    31  		userAgent:     "OpenAPI-Generator/1.0.0/go",
    32  	}
    33  	return cfg
    34  }
    35  
    36  func (c *Configuration) SetBasePath(apiRoot string) {
    37  	url := c.url
    38  
    39  	// Replace apiRoot
    40  	url = strings.Replace(url, "{"+"apiRoot"+"}", apiRoot, -1)
    41  
    42  	c.basePath = url
    43  }
    44  
    45  func (c *Configuration) BasePath() string {
    46  	return c.basePath
    47  }
    48  
    49  func (c *Configuration) Host() string {
    50  	return c.host
    51  }
    52  
    53  func (c *Configuration) SetHost(host string) {
    54  	c.host = host
    55  }
    56  
    57  func (c *Configuration) UserAgent() string {
    58  	return c.userAgent
    59  }
    60  
    61  func (c *Configuration) SetUserAgent(userAgent string) {
    62  	c.userAgent = userAgent
    63  }
    64  
    65  func (c *Configuration) DefaultHeader() map[string]string {
    66  	return c.defaultHeader
    67  }
    68  
    69  func (c *Configuration) AddDefaultHeader(key string, value string) {
    70  	c.defaultHeader[key] = value
    71  }
    72  
    73  func (c *Configuration) HTTPClient() *http.Client {
    74  	return c.httpClient
    75  }