github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/batch/batch_references_create_urlbuilder.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  // Code generated by go-swagger; DO NOT EDIT.
    13  
    14  package batch
    15  
    16  // This file was generated by the swagger tool.
    17  // Editing this file might prove futile when you re-run the generate command
    18  
    19  import (
    20  	"errors"
    21  	"net/url"
    22  	golangswaggerpaths "path"
    23  )
    24  
    25  // BatchReferencesCreateURL generates an URL for the batch references create operation
    26  type BatchReferencesCreateURL struct {
    27  	ConsistencyLevel *string
    28  
    29  	_basePath string
    30  	// avoid unkeyed usage
    31  	_ struct{}
    32  }
    33  
    34  // WithBasePath sets the base path for this url builder, only required when it's different from the
    35  // base path specified in the swagger spec.
    36  // When the value of the base path is an empty string
    37  func (o *BatchReferencesCreateURL) WithBasePath(bp string) *BatchReferencesCreateURL {
    38  	o.SetBasePath(bp)
    39  	return o
    40  }
    41  
    42  // SetBasePath sets the base path for this url builder, only required when it's different from the
    43  // base path specified in the swagger spec.
    44  // When the value of the base path is an empty string
    45  func (o *BatchReferencesCreateURL) SetBasePath(bp string) {
    46  	o._basePath = bp
    47  }
    48  
    49  // Build a url path and query string
    50  func (o *BatchReferencesCreateURL) Build() (*url.URL, error) {
    51  	var _result url.URL
    52  
    53  	var _path = "/batch/references"
    54  
    55  	_basePath := o._basePath
    56  	if _basePath == "" {
    57  		_basePath = "/v1"
    58  	}
    59  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    60  
    61  	qs := make(url.Values)
    62  
    63  	var consistencyLevelQ string
    64  	if o.ConsistencyLevel != nil {
    65  		consistencyLevelQ = *o.ConsistencyLevel
    66  	}
    67  	if consistencyLevelQ != "" {
    68  		qs.Set("consistency_level", consistencyLevelQ)
    69  	}
    70  
    71  	_result.RawQuery = qs.Encode()
    72  
    73  	return &_result, nil
    74  }
    75  
    76  // Must is a helper function to panic when the url builder returns an error
    77  func (o *BatchReferencesCreateURL) Must(u *url.URL, err error) *url.URL {
    78  	if err != nil {
    79  		panic(err)
    80  	}
    81  	if u == nil {
    82  		panic("url can't be nil")
    83  	}
    84  	return u
    85  }
    86  
    87  // String returns the string representation of the path with query string
    88  func (o *BatchReferencesCreateURL) String() string {
    89  	return o.Must(o.Build()).String()
    90  }
    91  
    92  // BuildFull builds a full url with scheme, host, path and query string
    93  func (o *BatchReferencesCreateURL) BuildFull(scheme, host string) (*url.URL, error) {
    94  	if scheme == "" {
    95  		return nil, errors.New("scheme is required for a full url on BatchReferencesCreateURL")
    96  	}
    97  	if host == "" {
    98  		return nil, errors.New("host is required for a full url on BatchReferencesCreateURL")
    99  	}
   100  
   101  	base, err := o.Build()
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  
   106  	base.Scheme = scheme
   107  	base.Host = host
   108  	return base, nil
   109  }
   110  
   111  // StringFull returns the string representation of a complete url
   112  func (o *BatchReferencesCreateURL) StringFull(scheme, host string) string {
   113  	return o.Must(o.BuildFull(scheme, host)).String()
   114  }