github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/objects/objects_references_update_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 objects
    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  	"strings"
    24  
    25  	"github.com/go-openapi/strfmt"
    26  )
    27  
    28  // ObjectsReferencesUpdateURL generates an URL for the objects references update operation
    29  type ObjectsReferencesUpdateURL struct {
    30  	ID           strfmt.UUID
    31  	PropertyName string
    32  
    33  	Tenant *string
    34  
    35  	_basePath string
    36  	// avoid unkeyed usage
    37  	_ struct{}
    38  }
    39  
    40  // WithBasePath sets the base path for this url builder, only required when it's different from the
    41  // base path specified in the swagger spec.
    42  // When the value of the base path is an empty string
    43  func (o *ObjectsReferencesUpdateURL) WithBasePath(bp string) *ObjectsReferencesUpdateURL {
    44  	o.SetBasePath(bp)
    45  	return o
    46  }
    47  
    48  // SetBasePath sets the base path for this url builder, only required when it's different from the
    49  // base path specified in the swagger spec.
    50  // When the value of the base path is an empty string
    51  func (o *ObjectsReferencesUpdateURL) SetBasePath(bp string) {
    52  	o._basePath = bp
    53  }
    54  
    55  // Build a url path and query string
    56  func (o *ObjectsReferencesUpdateURL) Build() (*url.URL, error) {
    57  	var _result url.URL
    58  
    59  	var _path = "/objects/{id}/references/{propertyName}"
    60  
    61  	id := o.ID.String()
    62  	if id != "" {
    63  		_path = strings.Replace(_path, "{id}", id, -1)
    64  	} else {
    65  		return nil, errors.New("id is required on ObjectsReferencesUpdateURL")
    66  	}
    67  
    68  	propertyName := o.PropertyName
    69  	if propertyName != "" {
    70  		_path = strings.Replace(_path, "{propertyName}", propertyName, -1)
    71  	} else {
    72  		return nil, errors.New("propertyName is required on ObjectsReferencesUpdateURL")
    73  	}
    74  
    75  	_basePath := o._basePath
    76  	if _basePath == "" {
    77  		_basePath = "/v1"
    78  	}
    79  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    80  
    81  	qs := make(url.Values)
    82  
    83  	var tenantQ string
    84  	if o.Tenant != nil {
    85  		tenantQ = *o.Tenant
    86  	}
    87  	if tenantQ != "" {
    88  		qs.Set("tenant", tenantQ)
    89  	}
    90  
    91  	_result.RawQuery = qs.Encode()
    92  
    93  	return &_result, nil
    94  }
    95  
    96  // Must is a helper function to panic when the url builder returns an error
    97  func (o *ObjectsReferencesUpdateURL) Must(u *url.URL, err error) *url.URL {
    98  	if err != nil {
    99  		panic(err)
   100  	}
   101  	if u == nil {
   102  		panic("url can't be nil")
   103  	}
   104  	return u
   105  }
   106  
   107  // String returns the string representation of the path with query string
   108  func (o *ObjectsReferencesUpdateURL) String() string {
   109  	return o.Must(o.Build()).String()
   110  }
   111  
   112  // BuildFull builds a full url with scheme, host, path and query string
   113  func (o *ObjectsReferencesUpdateURL) BuildFull(scheme, host string) (*url.URL, error) {
   114  	if scheme == "" {
   115  		return nil, errors.New("scheme is required for a full url on ObjectsReferencesUpdateURL")
   116  	}
   117  	if host == "" {
   118  		return nil, errors.New("host is required for a full url on ObjectsReferencesUpdateURL")
   119  	}
   120  
   121  	base, err := o.Build()
   122  	if err != nil {
   123  		return nil, err
   124  	}
   125  
   126  	base.Scheme = scheme
   127  	base.Host = host
   128  	return base, nil
   129  }
   130  
   131  // StringFull returns the string representation of a complete url
   132  func (o *ObjectsReferencesUpdateURL) StringFull(scheme, host string) string {
   133  	return o.Must(o.BuildFull(scheme, host)).String()
   134  }