New API version with additional structures and params
[ric-plt/xapp-frame.git] / pkg / restapi / operations / common / unsubscribe_urlbuilder.go
1 // Code generated by go-swagger; DO NOT EDIT.
2
3 package common
4
5 // This file was generated by the swagger tool.
6 // Editing this file might prove futile when you re-run the generate command
7
8 import (
9         "errors"
10         "net/url"
11         golangswaggerpaths "path"
12         "strings"
13 )
14
15 // UnsubscribeURL generates an URL for the unsubscribe operation
16 type UnsubscribeURL struct {
17         SubscriptionID string
18
19         _basePath string
20         // avoid unkeyed usage
21         _ struct{}
22 }
23
24 // WithBasePath sets the base path for this url builder, only required when it's different from the
25 // base path specified in the swagger spec.
26 // When the value of the base path is an empty string
27 func (o *UnsubscribeURL) WithBasePath(bp string) *UnsubscribeURL {
28         o.SetBasePath(bp)
29         return o
30 }
31
32 // SetBasePath sets the base path for this url builder, only required when it's different from the
33 // base path specified in the swagger spec.
34 // When the value of the base path is an empty string
35 func (o *UnsubscribeURL) SetBasePath(bp string) {
36         o._basePath = bp
37 }
38
39 // Build a url path and query string
40 func (o *UnsubscribeURL) Build() (*url.URL, error) {
41         var _result url.URL
42
43         var _path = "/subscriptions/{subscriptionId}"
44
45         subscriptionID := o.SubscriptionID
46         if subscriptionID != "" {
47                 _path = strings.Replace(_path, "{subscriptionId}", subscriptionID, -1)
48         } else {
49                 return nil, errors.New("subscriptionId is required on UnsubscribeURL")
50         }
51
52         _basePath := o._basePath
53         if _basePath == "" {
54                 _basePath = "/ric/v1"
55         }
56         _result.Path = golangswaggerpaths.Join(_basePath, _path)
57
58         return &_result, nil
59 }
60
61 // Must is a helper function to panic when the url builder returns an error
62 func (o *UnsubscribeURL) Must(u *url.URL, err error) *url.URL {
63         if err != nil {
64                 panic(err)
65         }
66         if u == nil {
67                 panic("url can't be nil")
68         }
69         return u
70 }
71
72 // String returns the string representation of the path with query string
73 func (o *UnsubscribeURL) String() string {
74         return o.Must(o.Build()).String()
75 }
76
77 // BuildFull builds a full url with scheme, host, path and query string
78 func (o *UnsubscribeURL) BuildFull(scheme, host string) (*url.URL, error) {
79         if scheme == "" {
80                 return nil, errors.New("scheme is required for a full url on UnsubscribeURL")
81         }
82         if host == "" {
83                 return nil, errors.New("host is required for a full url on UnsubscribeURL")
84         }
85
86         base, err := o.Build()
87         if err != nil {
88                 return nil, err
89         }
90
91         base.Scheme = scheme
92         base.Host = host
93         return base, nil
94 }
95
96 // StringFull returns the string representation of a complete url
97 func (o *UnsubscribeURL) StringFull(scheme, host string) string {
98         return o.Must(o.BuildFull(scheme, host)).String()
99 }