/*
Edge Application API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

API version: 2.0.0
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package edgeapplications

import (
	"bytes"
	"context"
	"io"
	"net/http"
	"net/url"
	"strings"
)


// EdgeApplicationsDeviceGroupsAPIService EdgeApplicationsDeviceGroupsAPI service
type EdgeApplicationsDeviceGroupsAPIService service

type ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteRequest struct {
	ctx context.Context
	ApiService *EdgeApplicationsDeviceGroupsAPIService
	edgeApplicationId int64
	deviceGroupId int64
	accept *string
}

// The id of the Device Groups that you plan to delete.
func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteRequest) Accept(accept string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteRequest {
	r.accept = &accept
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteRequest) Execute() (*http.Response, error) {
	return r.ApiService.EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteExecute(r)
}

/*
EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDelete /edge_applications/{edge_application_id}/device_groups/{device_group_id}

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @param edgeApplicationId
 @param deviceGroupId
 @return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteRequest
*/
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDelete(ctx context.Context, edgeApplicationId int64, deviceGroupId int64) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteRequest {
	return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteRequest{
		ApiService: a,
		ctx: ctx,
		edgeApplicationId: edgeApplicationId,
		deviceGroupId: deviceGroupId,
	}
}

// Execute executes the request
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteExecute(r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDeleteRequest) (*http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodDelete
		localVarPostBody     interface{}
		formFiles            []formFile
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EdgeApplicationsDeviceGroupsAPIService.EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdDelete")
	if err != nil {
		return nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/edge_applications/{edge_application_id}/device_groups/{device_group_id}"
	localVarPath = strings.Replace(localVarPath, "{"+"edge_application_id"+"}", url.PathEscape(parameterValueToString(r.edgeApplicationId, "edgeApplicationId")), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"device_group_id"+"}", url.PathEscape(parameterValueToString(r.deviceGroupId, "deviceGroupId")), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	if r.accept != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept", r.accept, "simple", "")
	}
	if r.ctx != nil {
		// API Key Authentication
		if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
			if apiKey, ok := auth["tokenAuth"]; ok {
				var key string
				if apiKey.Prefix != "" {
					key = apiKey.Prefix + " " + apiKey.Key
				} else {
					key = apiKey.Key
				}
				localVarHeaderParams["Authorization"] = key
			}
		}
	}
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarHTTPResponse, newErr
	}

	return localVarHTTPResponse, nil
}

type ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetRequest struct {
	ctx context.Context
	ApiService *EdgeApplicationsDeviceGroupsAPIService
	edgeApplicationId int64
	deviceGroupId int64
	accept *string
}

// The id of the Device Groups that you plan to query.
func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetRequest) Accept(accept string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetRequest {
	r.accept = &accept
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetRequest) Execute() (*DeviceGroupsIdResponse, *http.Response, error) {
	return r.ApiService.EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetExecute(r)
}

/*
EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGet /edge_applications/{edge_application_id}/device_groups/{device_group_id}

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @param edgeApplicationId
 @param deviceGroupId
 @return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetRequest
*/
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGet(ctx context.Context, edgeApplicationId int64, deviceGroupId int64) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetRequest {
	return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetRequest{
		ApiService: a,
		ctx: ctx,
		edgeApplicationId: edgeApplicationId,
		deviceGroupId: deviceGroupId,
	}
}

// Execute executes the request
//  @return DeviceGroupsIdResponse
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetExecute(r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGetRequest) (*DeviceGroupsIdResponse, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodGet
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *DeviceGroupsIdResponse
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EdgeApplicationsDeviceGroupsAPIService.EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdGet")
	if err != nil {
		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/edge_applications/{edge_application_id}/device_groups/{device_group_id}"
	localVarPath = strings.Replace(localVarPath, "{"+"edge_application_id"+"}", url.PathEscape(parameterValueToString(r.edgeApplicationId, "edgeApplicationId")), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"device_group_id"+"}", url.PathEscape(parameterValueToString(r.deviceGroupId, "deviceGroupId")), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{"application/json; version=3"}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	if r.accept != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept", r.accept, "simple", "")
	}
	if r.ctx != nil {
		// API Key Authentication
		if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
			if apiKey, ok := auth["tokenAuth"]; ok {
				var key string
				if apiKey.Prefix != "" {
					key = apiKey.Prefix + " " + apiKey.Key
				} else {
					key = apiKey.Key
				}
				localVarHeaderParams["Authorization"] = key
			}
		}
	}
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
	if err != nil {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: err.Error(),
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	return localVarReturnValue, localVarHTTPResponse, nil
}

type ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest struct {
	ctx context.Context
	ApiService *EdgeApplicationsDeviceGroupsAPIService
	edgeApplicationId int64
	deviceGroupId int64
	accept *string
	contentType *string
	patchDeviceGroupsRequest *PatchDeviceGroupsRequest
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest) Accept(accept string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest {
	r.accept = &accept
	return r
}

// The type of coding used in the Body (application/json). &lt;br&gt;  Example: Content-Type: application/json
func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest) ContentType(contentType string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest {
	r.contentType = &contentType
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest) PatchDeviceGroupsRequest(patchDeviceGroupsRequest PatchDeviceGroupsRequest) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest {
	r.patchDeviceGroupsRequest = &patchDeviceGroupsRequest
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest) Execute() (*DeviceGroupsIdResponse, *http.Response, error) {
	return r.ApiService.EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchExecute(r)
}

/*
EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatch /edge_applications/{edge_application_id}/device_groups/{device_group_id}

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @param edgeApplicationId
 @param deviceGroupId
 @return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest
*/
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatch(ctx context.Context, edgeApplicationId int64, deviceGroupId int64) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest {
	return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest{
		ApiService: a,
		ctx: ctx,
		edgeApplicationId: edgeApplicationId,
		deviceGroupId: deviceGroupId,
	}
}

// Execute executes the request
//  @return DeviceGroupsIdResponse
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchExecute(r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatchRequest) (*DeviceGroupsIdResponse, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPatch
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *DeviceGroupsIdResponse
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EdgeApplicationsDeviceGroupsAPIService.EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPatch")
	if err != nil {
		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/edge_applications/{edge_application_id}/device_groups/{device_group_id}"
	localVarPath = strings.Replace(localVarPath, "{"+"edge_application_id"+"}", url.PathEscape(parameterValueToString(r.edgeApplicationId, "edgeApplicationId")), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"device_group_id"+"}", url.PathEscape(parameterValueToString(r.deviceGroupId, "deviceGroupId")), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{"application/json; version=3"}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{"application/json; version=3"}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	if r.accept != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept", r.accept, "simple", "")
	}
	if r.contentType != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Content-Type", r.contentType, "simple", "")
	}
	// body params
	localVarPostBody = r.patchDeviceGroupsRequest
	if r.ctx != nil {
		// API Key Authentication
		if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
			if apiKey, ok := auth["tokenAuth"]; ok {
				var key string
				if apiKey.Prefix != "" {
					key = apiKey.Prefix + " " + apiKey.Key
				} else {
					key = apiKey.Key
				}
				localVarHeaderParams["Authorization"] = key
			}
		}
	}
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
	if err != nil {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: err.Error(),
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	return localVarReturnValue, localVarHTTPResponse, nil
}

type ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest struct {
	ctx context.Context
	ApiService *EdgeApplicationsDeviceGroupsAPIService
	edgeApplicationId int64
	deviceGroupId int64
	accept *string
	contentType *string
	updateDeviceGroupsRequest *UpdateDeviceGroupsRequest
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest) Accept(accept string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest {
	r.accept = &accept
	return r
}

// The type of coding used in the Body (application/json). &lt;br&gt;  Example: Content-Type: application/json
func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest) ContentType(contentType string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest {
	r.contentType = &contentType
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest) UpdateDeviceGroupsRequest(updateDeviceGroupsRequest UpdateDeviceGroupsRequest) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest {
	r.updateDeviceGroupsRequest = &updateDeviceGroupsRequest
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest) Execute() (*DeviceGroupsIdResponse, *http.Response, error) {
	return r.ApiService.EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutExecute(r)
}

/*
EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPut /edge_applications/{edge_application_id}/device_groups/{device_group_id}

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @param edgeApplicationId
 @param deviceGroupId
 @return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest
*/
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPut(ctx context.Context, edgeApplicationId int64, deviceGroupId int64) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest {
	return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest{
		ApiService: a,
		ctx: ctx,
		edgeApplicationId: edgeApplicationId,
		deviceGroupId: deviceGroupId,
	}
}

// Execute executes the request
//  @return DeviceGroupsIdResponse
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutExecute(r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPutRequest) (*DeviceGroupsIdResponse, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPut
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *DeviceGroupsIdResponse
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EdgeApplicationsDeviceGroupsAPIService.EdgeApplicationsEdgeApplicationIdDeviceGroupsDeviceGroupIdPut")
	if err != nil {
		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/edge_applications/{edge_application_id}/device_groups/{device_group_id}"
	localVarPath = strings.Replace(localVarPath, "{"+"edge_application_id"+"}", url.PathEscape(parameterValueToString(r.edgeApplicationId, "edgeApplicationId")), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"device_group_id"+"}", url.PathEscape(parameterValueToString(r.deviceGroupId, "deviceGroupId")), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{"application/json; version=3"}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{"application/json; version=3"}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	if r.accept != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept", r.accept, "simple", "")
	}
	if r.contentType != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Content-Type", r.contentType, "simple", "")
	}
	// body params
	localVarPostBody = r.updateDeviceGroupsRequest
	if r.ctx != nil {
		// API Key Authentication
		if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
			if apiKey, ok := auth["tokenAuth"]; ok {
				var key string
				if apiKey.Prefix != "" {
					key = apiKey.Prefix + " " + apiKey.Key
				} else {
					key = apiKey.Key
				}
				localVarHeaderParams["Authorization"] = key
			}
		}
	}
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
	if err != nil {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: err.Error(),
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	return localVarReturnValue, localVarHTTPResponse, nil
}

type ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest struct {
	ctx context.Context
	ApiService *EdgeApplicationsDeviceGroupsAPIService
	edgeApplicationId int64
	page *int64
	pageSize *int64
	filter *string
	orderBy *string
	sort *string
	accept *string
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest) Page(page int64) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest {
	r.page = &page
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest) PageSize(pageSize int64) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest {
	r.pageSize = &pageSize
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest) Filter(filter string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest {
	r.filter = &filter
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest) OrderBy(orderBy string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest {
	r.orderBy = &orderBy
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest) Sort(sort string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest {
	r.sort = &sort
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest) Accept(accept string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest {
	r.accept = &accept
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest) Execute() (*DeviceGroupsResponse, *http.Response, error) {
	return r.ApiService.EdgeApplicationsEdgeApplicationIdDeviceGroupsGetExecute(r)
}

/*
EdgeApplicationsEdgeApplicationIdDeviceGroupsGet /edge_applications/{edge_application_id}/device_groups

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @param edgeApplicationId
 @return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest
*/
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsGet(ctx context.Context, edgeApplicationId int64) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest {
	return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest{
		ApiService: a,
		ctx: ctx,
		edgeApplicationId: edgeApplicationId,
	}
}

// Execute executes the request
//  @return DeviceGroupsResponse
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsGetExecute(r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsGetRequest) (*DeviceGroupsResponse, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodGet
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *DeviceGroupsResponse
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EdgeApplicationsDeviceGroupsAPIService.EdgeApplicationsEdgeApplicationIdDeviceGroupsGet")
	if err != nil {
		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/edge_applications/{edge_application_id}/device_groups"
	localVarPath = strings.Replace(localVarPath, "{"+"edge_application_id"+"}", url.PathEscape(parameterValueToString(r.edgeApplicationId, "edgeApplicationId")), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if r.page != nil {
		parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "")
	}
	if r.pageSize != nil {
		parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "form", "")
	}
	if r.filter != nil {
		parameterAddToHeaderOrQuery(localVarQueryParams, "filter", r.filter, "form", "")
	}
	if r.orderBy != nil {
		parameterAddToHeaderOrQuery(localVarQueryParams, "order_by", r.orderBy, "form", "")
	}
	if r.sort != nil {
		parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "")
	}
	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{"application/json; version=3"}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	if r.accept != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept", r.accept, "simple", "")
	}
	if r.ctx != nil {
		// API Key Authentication
		if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
			if apiKey, ok := auth["tokenAuth"]; ok {
				var key string
				if apiKey.Prefix != "" {
					key = apiKey.Prefix + " " + apiKey.Key
				} else {
					key = apiKey.Key
				}
				localVarHeaderParams["Authorization"] = key
			}
		}
	}
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
	if err != nil {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: err.Error(),
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	return localVarReturnValue, localVarHTTPResponse, nil
}

type ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest struct {
	ctx context.Context
	ApiService *EdgeApplicationsDeviceGroupsAPIService
	edgeApplicationId int64
	accept *string
	contentType *string
	createDeviceGroupsRequest *CreateDeviceGroupsRequest
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest) Accept(accept string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest {
	r.accept = &accept
	return r
}

// The type of coding used in the Body (application/json). &lt;br&gt;  Example: Content-Type: application/json
func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest) ContentType(contentType string) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest {
	r.contentType = &contentType
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest) CreateDeviceGroupsRequest(createDeviceGroupsRequest CreateDeviceGroupsRequest) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest {
	r.createDeviceGroupsRequest = &createDeviceGroupsRequest
	return r
}

func (r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest) Execute() (*DeviceGroupsIdResponse, *http.Response, error) {
	return r.ApiService.EdgeApplicationsEdgeApplicationIdDeviceGroupsPostExecute(r)
}

/*
EdgeApplicationsEdgeApplicationIdDeviceGroupsPost /edge_applications/{edge_application_id}/device_groups

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @param edgeApplicationId
 @return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest
*/
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsPost(ctx context.Context, edgeApplicationId int64) ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest {
	return ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest{
		ApiService: a,
		ctx: ctx,
		edgeApplicationId: edgeApplicationId,
	}
}

// Execute executes the request
//  @return DeviceGroupsIdResponse
func (a *EdgeApplicationsDeviceGroupsAPIService) EdgeApplicationsEdgeApplicationIdDeviceGroupsPostExecute(r ApiEdgeApplicationsEdgeApplicationIdDeviceGroupsPostRequest) (*DeviceGroupsIdResponse, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPost
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *DeviceGroupsIdResponse
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EdgeApplicationsDeviceGroupsAPIService.EdgeApplicationsEdgeApplicationIdDeviceGroupsPost")
	if err != nil {
		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/edge_applications/{edge_application_id}/device_groups"
	localVarPath = strings.Replace(localVarPath, "{"+"edge_application_id"+"}", url.PathEscape(parameterValueToString(r.edgeApplicationId, "edgeApplicationId")), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{"application/json; version=3"}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{"application/json; version=3"}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	if r.accept != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Accept", r.accept, "simple", "")
	}
	if r.contentType != nil {
		parameterAddToHeaderOrQuery(localVarHeaderParams, "Content-Type", r.contentType, "simple", "")
	}
	// body params
	localVarPostBody = r.createDeviceGroupsRequest
	if r.ctx != nil {
		// API Key Authentication
		if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
			if apiKey, ok := auth["tokenAuth"]; ok {
				var key string
				if apiKey.Prefix != "" {
					key = apiKey.Prefix + " " + apiKey.Key
				} else {
					key = apiKey.Key
				}
				localVarHeaderParams["Authorization"] = key
			}
		}
	}
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
	if err != nil {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: err.Error(),
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	return localVarReturnValue, localVarHTTPResponse, nil
}
