github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/objects/objects_delete_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  // ObjectsDeleteURL generates an URL for the objects delete operation
    29  type ObjectsDeleteURL struct {
    30  	ID strfmt.UUID
    31  
    32  	ConsistencyLevel *string
    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 *ObjectsDeleteURL) WithBasePath(bp string) *ObjectsDeleteURL {
    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 *ObjectsDeleteURL) SetBasePath(bp string) {
    52  	o._basePath = bp
    53  }
    54  
    55  // Build a url path and query string
    56  func (o *ObjectsDeleteURL) Build() (*url.URL, error) {
    57  	var _result url.URL
    58  
    59  	var _path = "/objects/{id}"
    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 ObjectsDeleteURL")
    66  	}
    67  
    68  	_basePath := o._basePath
    69  	if _basePath == "" {
    70  		_basePath = "/v1"
    71  	}
    72  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    73  
    74  	qs := make(url.Values)
    75  
    76  	var consistencyLevelQ string
    77  	if o.ConsistencyLevel != nil {
    78  		consistencyLevelQ = *o.ConsistencyLevel
    79  	}
    80  	if consistencyLevelQ != "" {
    81  		qs.Set("consistency_level", consistencyLevelQ)
    82  	}
    83  
    84  	var tenantQ string
    85  	if o.Tenant != nil {
    86  		tenantQ = *o.Tenant
    87  	}
    88  	if tenantQ != "" {
    89  		qs.Set("tenant", tenantQ)
    90  	}
    91  
    92  	_result.RawQuery = qs.Encode()
    93  
    94  	return &_result, nil
    95  }
    96  
    97  // Must is a helper function to panic when the url builder returns an error
    98  func (o *ObjectsDeleteURL) Must(u *url.URL, err error) *url.URL {
    99  	if err != nil {
   100  		panic(err)
   101  	}
   102  	if u == nil {
   103  		panic("url can't be nil")
   104  	}
   105  	return u
   106  }
   107  
   108  // String returns the string representation of the path with query string
   109  func (o *ObjectsDeleteURL) String() string {
   110  	return o.Must(o.Build()).String()
   111  }
   112  
   113  // BuildFull builds a full url with scheme, host, path and query string
   114  func (o *ObjectsDeleteURL) BuildFull(scheme, host string) (*url.URL, error) {
   115  	if scheme == "" {
   116  		return nil, errors.New("scheme is required for a full url on ObjectsDeleteURL")
   117  	}
   118  	if host == "" {
   119  		return nil, errors.New("host is required for a full url on ObjectsDeleteURL")
   120  	}
   121  
   122  	base, err := o.Build()
   123  	if err != nil {
   124  		return nil, err
   125  	}
   126  
   127  	base.Scheme = scheme
   128  	base.Host = host
   129  	return base, nil
   130  }
   131  
   132  // StringFull returns the string representation of a complete url
   133  func (o *ObjectsDeleteURL) StringFull(scheme, host string) string {
   134  	return o.Must(o.BuildFull(scheme, host)).String()
   135  }