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