Commit e10faad4 authored by Michel Roy's avatar Michel Roy Committed by Kevin Di Lallo
Browse files

loc service notif api swagger update

parent 99adc191
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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
+47 −26
Original line number Diff line number Diff line
@@ -10,13 +10,12 @@
package client

import (
	"context"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"

	"golang.org/x/net/context"
)

// Linger please
@@ -26,12 +25,15 @@ var (

type NotificationsApiService service

/* NotificationsApiService This operation is used by the AdvantEDGE Location Service to issue a callback notification towards an ME application with a zonal or user tracking subscription
/*
NotificationsApiService This operation is used by the AdvantEDGE Location Service to issue a callback notification towards an ME application with a zonal or user tracking subscription
Zonal or User location tracking subscription notification
* @param ctx context.Context for authentication, logging, tracing, etc.
@param subscriptionId Identity of a notification subscription (user or zonal)
@param notification Zonal or User Tracking Notification
@return */
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param subscriptionId Identity of a notification subscription (user or zonal)
 * @param notification Zonal or User Tracking Notification


*/
func (a *NotificationsApiService) PostTrackingNotification(ctx context.Context, subscriptionId string, notification TrackingNotification) (*http.Response, error) {
	var (
		localVarHttpMethod = strings.ToUpper("Post")
@@ -58,9 +60,7 @@ func (a *NotificationsApiService) PostTrackingNotification(ctx context.Context,
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{
		"application/json",
	}
	localVarHttpHeaderAccepts := []string{"application/json"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
@@ -78,21 +78,34 @@ func (a *NotificationsApiService) PostTrackingNotification(ctx context.Context,
	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
}

/* NotificationsApiService This operation is used by the AdvantEDGE Location Service to issue a callback notification towards an ME application with a zone status tracking subscription
/*
NotificationsApiService This operation is used by the AdvantEDGE Location Service to issue a callback notification towards an ME application with a zone status tracking subscription
Zone status tracking subscription notification
* @param ctx context.Context for authentication, logging, tracing, etc.
@param subscriptionId Identity of a notification subscription (user or zonal)
@param notification Zone Status Notification
@return */
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param subscriptionId Identity of a notification subscription (user or zonal)
 * @param notification Zone Status Notification


*/
func (a *NotificationsApiService) PostZoneStatusNotification(ctx context.Context, subscriptionId string, notification ZoneStatusNotification) (*http.Response, error) {
	var (
		localVarHttpMethod = strings.ToUpper("Post")
@@ -119,9 +132,7 @@ func (a *NotificationsApiService) PostZoneStatusNotification(ctx context.Context
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{
		"application/json",
	}
	localVarHttpHeaderAccepts := []string{"application/json"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
@@ -139,11 +150,21 @@ func (a *NotificationsApiService) PostZoneStatusNotification(ctx context.Context
	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
}
+41 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ package client

import (
	"bytes"
	"context"
	"encoding/json"
	"encoding/xml"
	"errors"
@@ -28,7 +29,6 @@ import (
	"time"
	"unicode/utf8"

	"golang.org/x/net/context"
	"golang.org/x/oauth2"
)

@@ -44,6 +44,7 @@ type APIClient struct {
	common service // Reuse a single struct instead of allocating one for each service on the heap.

	// API Services

	NotificationsApi *NotificationsApiService
}

@@ -298,6 +299,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)
@@ -332,6 +348,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) {
@@ -422,3 +440,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
}
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ Zonal or User location tracking subscription notification

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ctx** | **context.Context** | context for logging, tracing, authentication, etc.
 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
  **subscriptionId** | **string**| Identity of a notification subscription (user or zonal) | 
  **notification** | [**TrackingNotification**](TrackingNotification.md)| Zonal or User Tracking Notification | 

@@ -47,7 +47,7 @@ Zone status tracking subscription notification

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ctx** | **context.Context** | context for logging, tracing, authentication, etc.
 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
  **subscriptionId** | **string**| Identity of a notification subscription (user or zonal) | 
  **notification** | [**ZoneStatusNotification**](ZoneStatusNotification.md)| Zone Status Notification | 

+0 −2
Original line number Diff line number Diff line
@@ -11,10 +11,8 @@ package client

// Link to other resources
type Link struct {

	// Describes the relationship between the URI and the resource.
	Rel *interface{} `json:"rel"`

	// URI
	Href *interface{} `json:"href"`
}
Loading