forked from free5gc/openapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_gpsi_to_supi_translation.go
160 lines (137 loc) · 5.67 KB
/
api_gpsi_to_supi_translation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
* Nudm_SDM
*
* Nudm Subscriber Data Management Service
*
* API version: 2.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package Nudm_SubscriberDataManagement
import (
"context"
"fmt"
"io/ioutil"
"net/url"
"strings"
"github.com/nycu-ucr/gonet/http"
"github.com/antihax/optional"
"github.com/nycu-ucr/openapi"
"github.com/nycu-ucr/openapi/models"
)
// Linger please
var (
_ context.Context
)
type GPSIToSUPITranslationApiService service
/*
GPSIToSUPITranslationApiService retrieve a UE's SUPI
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param gpsi Identifier of the UE
* @param optional nil or *GetIdTranslationResultParamOpts - Optional Parameters:
* @param "SupportedFeatures" (optional.String) - Supported Features
* @param "IfNoneMatch" (optional.String) - Validator for conditional requests, as described in RFC 7232, 3.2
* @param "IfModifiedSince" (optional.String) - Validator for conditional requests, as described in RFC 7232, 3.3
@return models.IdTranslationResult
*/
type GetIdTranslationResultParamOpts struct {
SupportedFeatures optional.String
IfNoneMatch optional.String
IfModifiedSince optional.String
}
func (a *GPSIToSUPITranslationApiService) GetIdTranslationResult(ctx context.Context, gpsi string, localVarOptionals *GetIdTranslationResultParamOpts) (models.IdTranslationResult, *http.Response, error) {
var (
localVarHTTPMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.IdTranslationResult
)
// create path and map variables
localVarPath := a.client.cfg.BasePath() + "/{gpsi}/id-translation-result"
localVarPath = strings.Replace(localVarPath, "{"+"gpsi"+"}", fmt.Sprintf("%v", gpsi), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.SupportedFeatures.IsSet() && localVarOptionals.SupportedFeatures.Value() != "" {
localVarQueryParams.Add("supported-features", openapi.ParameterToString(localVarOptionals.SupportedFeatures.Value(), ""))
}
localVarHTTPContentTypes := []string{"application/json"}
localVarHeaderParams["Content-Type"] = localVarHTTPContentTypes[0] // use the first content type specified in 'consumes'
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := openapi.SelectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.IfNoneMatch.IsSet() && localVarOptionals.IfNoneMatch.Value() != "" {
localVarHeaderParams["If-None-Match"] = openapi.ParameterToString(localVarOptionals.IfNoneMatch.Value(), "")
}
if localVarOptionals != nil && localVarOptionals.IfModifiedSince.IsSet() && localVarOptionals.IfModifiedSince.Value() != "" {
localVarHeaderParams["If-Modified-Since"] = openapi.ParameterToString(localVarOptionals.IfModifiedSince.Value(), "")
}
r, err := openapi.PrepareRequest(ctx, a.client.cfg, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := openapi.CallAPI(a.client.cfg, r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
apiError := openapi.GenericOpenAPIError{
RawBody: localVarBody,
ErrorStatus: localVarHTTPResponse.Status,
}
switch localVarHTTPResponse.StatusCode {
case 200:
err = openapi.Deserialize(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
apiError.ErrorStatus = err.Error()
}
return localVarReturnValue, localVarHTTPResponse, nil
case 400:
var v models.ProblemDetails
err = openapi.Deserialize(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
apiError.ErrorStatus = err.Error()
return localVarReturnValue, localVarHTTPResponse, apiError
}
apiError.ErrorModel = v
return localVarReturnValue, localVarHTTPResponse, apiError
case 404:
var v models.ProblemDetails
err = openapi.Deserialize(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
apiError.ErrorStatus = err.Error()
return localVarReturnValue, localVarHTTPResponse, apiError
}
apiError.ErrorModel = v
return localVarReturnValue, localVarHTTPResponse, apiError
case 500:
var v models.ProblemDetails
err = openapi.Deserialize(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
apiError.ErrorStatus = err.Error()
return localVarReturnValue, localVarHTTPResponse, apiError
}
apiError.ErrorModel = v
return localVarReturnValue, localVarHTTPResponse, apiError
case 503:
var v models.ProblemDetails
err = openapi.Deserialize(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
apiError.ErrorStatus = err.Error()
return localVarReturnValue, localVarHTTPResponse, apiError
}
apiError.ErrorModel = v
return localVarReturnValue, localVarHTTPResponse, apiError
default:
return localVarReturnValue, localVarHTTPResponse, nil
}
}