github.com/Bio-core/jtree@v0.0.0-20190705165106-1d7a7e7d6272/restapi/operations/get_sample_columns_urlbuilder.go (about)

     1  package operations
     2  
     3  // This file was generated by the swagger tool.
     4  // Editing this file might prove futile when you re-run the generate command
     5  
     6  import (
     7  	"errors"
     8  	"net/url"
     9  	golangswaggerpaths "path"
    10  )
    11  
    12  // GetSampleColumnsURL generates an URL for the get sample columns operation
    13  type GetSampleColumnsURL struct {
    14  	_basePath string
    15  }
    16  
    17  // WithBasePath sets the base path for this url builder, only required when it's different from the
    18  // base path specified in the swagger spec.
    19  // When the value of the base path is an empty string
    20  func (o *GetSampleColumnsURL) WithBasePath(bp string) *GetSampleColumnsURL {
    21  	o.SetBasePath(bp)
    22  	return o
    23  }
    24  
    25  // SetBasePath sets the base path for this url builder, only required when it's different from the
    26  // base path specified in the swagger spec.
    27  // When the value of the base path is an empty string
    28  func (o *GetSampleColumnsURL) SetBasePath(bp string) {
    29  	o._basePath = bp
    30  }
    31  
    32  // Build a url path and query string
    33  func (o *GetSampleColumnsURL) Build() (*url.URL, error) {
    34  	var result url.URL
    35  
    36  	var _path = "/columns"
    37  
    38  	_basePath := o._basePath
    39  	if _basePath == "" {
    40  		_basePath = "/Jtree/metadata/0.1.0"
    41  	}
    42  	result.Path = golangswaggerpaths.Join(_basePath, _path)
    43  
    44  	return &result, nil
    45  }
    46  
    47  // Must is a helper function to panic when the url builder returns an error
    48  func (o *GetSampleColumnsURL) Must(u *url.URL, err error) *url.URL {
    49  	if err != nil {
    50  		panic(err)
    51  	}
    52  	if u == nil {
    53  		panic("url can't be nil")
    54  	}
    55  	return u
    56  }
    57  
    58  // String returns the string representation of the path with query string
    59  func (o *GetSampleColumnsURL) String() string {
    60  	return o.Must(o.Build()).String()
    61  }
    62  
    63  // BuildFull builds a full url with scheme, host, path and query string
    64  func (o *GetSampleColumnsURL) BuildFull(scheme, host string) (*url.URL, error) {
    65  	if scheme == "" {
    66  		return nil, errors.New("scheme is required for a full url on GetSampleColumnsURL")
    67  	}
    68  	if host == "" {
    69  		return nil, errors.New("host is required for a full url on GetSampleColumnsURL")
    70  	}
    71  
    72  	base, err := o.Build()
    73  	if err != nil {
    74  		return nil, err
    75  	}
    76  
    77  	base.Scheme = scheme
    78  	base.Host = host
    79  	return base, nil
    80  }
    81  
    82  // StringFull returns the string representation of a complete url
    83  func (o *GetSampleColumnsURL) StringFull(scheme, host string) string {
    84  	return o.Must(o.BuildFull(scheme, host)).String()
    85  }