Loading go-packages/meep-mg-manager-client/README.md +2 −2 Original line number Diff line number Diff line Loading @@ -11,8 +11,8 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge ## Installation Put the package under your project folder and add the following in import: ``` "./client" ```golang import "./client" ``` ## Documentation for API Endpoints Loading go-packages/meep-mg-manager-client/api/swagger.yaml +0 −3 Original line number Diff line number Diff line Loading @@ -438,9 +438,6 @@ definitions: type: "string" description: "Mobility Group Application State for provided UE" description: "Mobility Group Application State" example: ueState: "ueState" ueId: "ueId" parameters: appId: name: "appId" Loading go-packages/meep-mg-manager-client/membership_api.go→go-packages/meep-mg-manager-client/api_membership.go +352 −173 File changed and moved.Preview size limit exceeded, changes collapsed. Show changes go-packages/meep-mg-manager-client/state_transfer_api.go→go-packages/meep-mg-manager-client/api_state_transfer.go +25 −15 Original line number Diff line number Diff line Loading @@ -10,13 +10,12 @@ package client import ( "context" "fmt" "io/ioutil" "net/http" "net/url" "strings" "golang.org/x/net/context" ) // Linger please Loading @@ -26,13 +25,16 @@ var ( type StateTransferApiService service /* StateTransferApiService Send state to transfer to peers /* StateTransferApiService Send state to transfer to peers * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param mgName Mobility Group name * @param appId Mobility Group App Id * @param appState Mobility Group App State to transfer * @param ctx context.Context for authentication, logging, tracing, etc. @param mgName Mobility Group name @param appId Mobility Group App Id @param appState Mobility Group App State to transfer @return */ */ func (a *StateTransferApiService) TransferAppState(ctx context.Context, mgName string, appId string, appState MobilityGroupAppState) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") Loading Loading @@ -60,9 +62,7 @@ func (a *StateTransferApiService) TransferAppState(ctx context.Context, mgName s } // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", } localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) Loading @@ -80,11 +80,21 @@ func (a *StateTransferApiService) TransferAppState(ctx context.Context, mgName s if err != nil || localVarHttpResponse == nil { return localVarHttpResponse, err } defer localVarHttpResponse.Body.Close() localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarHttpResponse, err } if localVarHttpResponse.StatusCode >= 300 { bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, err return localVarHttpResponse, newErr } return localVarHttpResponse, nil } go-packages/meep-mg-manager-client/api_client.go→go-packages/meep-mg-manager-client/client.go +43 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ package client import ( "bytes" "context" "encoding/json" "encoding/xml" "errors" Loading @@ -28,7 +29,6 @@ import ( "time" "unicode/utf8" "golang.org/x/net/context" "golang.org/x/oauth2" ) Loading @@ -44,7 +44,9 @@ type APIClient struct { common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services MembershipApi *MembershipApiService StateTransferApi *StateTransferApiService } Loading Loading @@ -300,6 +302,21 @@ func (c *APIClient) prepareRequest( return localVarRequest, nil } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { if strings.Contains(contentType, "application/xml") { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } else if strings.Contains(contentType, "application/json") { if err = json.Unmarshal(b, v); err != nil { return err } return nil } return errors.New("undefined response type") } // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { file, err := os.Open(path) Loading Loading @@ -334,6 +351,8 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { Loading Loading @@ -424,3 +443,25 @@ func CacheExpires(r *http.Response) time.Time { func strlen(s string) int { return utf8.RuneCountInString(s) } // GenericSwaggerError Provides access to the body, error and model on returned errors. type GenericSwaggerError struct { body []byte error string model interface{} } // Error returns non-empty string if there was an error. func (e GenericSwaggerError) Error() string { return e.error } // Body returns the raw bytes of the response func (e GenericSwaggerError) Body() []byte { return e.body } // Model returns the unpacked model of the error func (e GenericSwaggerError) Model() interface{} { return e.model } Loading
go-packages/meep-mg-manager-client/README.md +2 −2 Original line number Diff line number Diff line Loading @@ -11,8 +11,8 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge ## Installation Put the package under your project folder and add the following in import: ``` "./client" ```golang import "./client" ``` ## Documentation for API Endpoints Loading
go-packages/meep-mg-manager-client/api/swagger.yaml +0 −3 Original line number Diff line number Diff line Loading @@ -438,9 +438,6 @@ definitions: type: "string" description: "Mobility Group Application State for provided UE" description: "Mobility Group Application State" example: ueState: "ueState" ueId: "ueId" parameters: appId: name: "appId" Loading
go-packages/meep-mg-manager-client/membership_api.go→go-packages/meep-mg-manager-client/api_membership.go +352 −173 File changed and moved.Preview size limit exceeded, changes collapsed. Show changes
go-packages/meep-mg-manager-client/state_transfer_api.go→go-packages/meep-mg-manager-client/api_state_transfer.go +25 −15 Original line number Diff line number Diff line Loading @@ -10,13 +10,12 @@ package client import ( "context" "fmt" "io/ioutil" "net/http" "net/url" "strings" "golang.org/x/net/context" ) // Linger please Loading @@ -26,13 +25,16 @@ var ( type StateTransferApiService service /* StateTransferApiService Send state to transfer to peers /* StateTransferApiService Send state to transfer to peers * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param mgName Mobility Group name * @param appId Mobility Group App Id * @param appState Mobility Group App State to transfer * @param ctx context.Context for authentication, logging, tracing, etc. @param mgName Mobility Group name @param appId Mobility Group App Id @param appState Mobility Group App State to transfer @return */ */ func (a *StateTransferApiService) TransferAppState(ctx context.Context, mgName string, appId string, appState MobilityGroupAppState) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") Loading Loading @@ -60,9 +62,7 @@ func (a *StateTransferApiService) TransferAppState(ctx context.Context, mgName s } // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", } localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) Loading @@ -80,11 +80,21 @@ func (a *StateTransferApiService) TransferAppState(ctx context.Context, mgName s if err != nil || localVarHttpResponse == nil { return localVarHttpResponse, err } defer localVarHttpResponse.Body.Close() localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarHttpResponse, err } if localVarHttpResponse.StatusCode >= 300 { bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, err return localVarHttpResponse, newErr } return localVarHttpResponse, nil }
go-packages/meep-mg-manager-client/api_client.go→go-packages/meep-mg-manager-client/client.go +43 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ package client import ( "bytes" "context" "encoding/json" "encoding/xml" "errors" Loading @@ -28,7 +29,6 @@ import ( "time" "unicode/utf8" "golang.org/x/net/context" "golang.org/x/oauth2" ) Loading @@ -44,7 +44,9 @@ type APIClient struct { common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services MembershipApi *MembershipApiService StateTransferApi *StateTransferApiService } Loading Loading @@ -300,6 +302,21 @@ func (c *APIClient) prepareRequest( return localVarRequest, nil } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { if strings.Contains(contentType, "application/xml") { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } else if strings.Contains(contentType, "application/json") { if err = json.Unmarshal(b, v); err != nil { return err } return nil } return errors.New("undefined response type") } // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { file, err := os.Open(path) Loading Loading @@ -334,6 +351,8 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { Loading Loading @@ -424,3 +443,25 @@ func CacheExpires(r *http.Response) time.Time { func strlen(s string) int { return utf8.RuneCountInString(s) } // GenericSwaggerError Provides access to the body, error and model on returned errors. type GenericSwaggerError struct { body []byte error string model interface{} } // Error returns non-empty string if there was an error. func (e GenericSwaggerError) Error() string { return e.error } // Body returns the raw bytes of the response func (e GenericSwaggerError) Body() []byte { return e.body } // Model returns the unpacked model of the error func (e GenericSwaggerError) Model() interface{} { return e.model }