From 65e003cb079e978e2997274d944418d26d72b5b9 Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Tue, 8 Oct 2024 14:35:09 +0100 Subject: [PATCH] refactor: construct params in a way to satisfy generation --- api_open_fga.go | 160 +++++++++++++++++++++++++++++------------------- 1 file changed, 98 insertions(+), 62 deletions(-) diff --git a/api_open_fga.go b/api_open_fga.go index 2d89972..b1b5fff 100644 --- a/api_open_fga.go +++ b/api_open_fga.go @@ -866,6 +866,7 @@ func (a *OpenFgaApiService) CheckExecute(r ApiCheckRequest) (CheckResponse, *_ne var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -887,6 +888,8 @@ func (a *OpenFgaApiService) CheckExecute(r ApiCheckRequest) (CheckResponse, *_ne return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1087,12 +1090,11 @@ func (a *OpenFgaApiService) CheckExecute(r ApiCheckRequest) (CheckResponse, *_ne metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "Check", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -1150,6 +1152,7 @@ func (a *OpenFgaApiService) CreateStoreExecute(r ApiCreateStoreRequest) (CreateS var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -1360,11 +1363,11 @@ func (a *OpenFgaApiService) CreateStoreExecute(r ApiCreateStoreRequest) (CreateS metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "CreateStore", - map[string]interface{}{ - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -1418,6 +1421,7 @@ func (a *OpenFgaApiService) DeleteStoreExecute(r ApiDeleteStoreRequest) (*_netht var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -1438,6 +1442,8 @@ func (a *OpenFgaApiService) DeleteStoreExecute(r ApiDeleteStoreRequest) (*_netht return nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1624,12 +1630,11 @@ func (a *OpenFgaApiService) DeleteStoreExecute(r ApiDeleteStoreRequest) (*_netht metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "DeleteStore", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -1742,6 +1747,7 @@ func (a *OpenFgaApiService) ExpandExecute(r ApiExpandRequest) (ExpandResponse, * var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -1763,6 +1769,8 @@ func (a *OpenFgaApiService) ExpandExecute(r ApiExpandRequest) (ExpandResponse, * return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1963,12 +1971,11 @@ func (a *OpenFgaApiService) ExpandExecute(r ApiExpandRequest) (ExpandResponse, * metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "Expand", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -2023,6 +2030,7 @@ func (a *OpenFgaApiService) GetStoreExecute(r ApiGetStoreRequest) (GetStoreRespo var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -2044,6 +2052,8 @@ func (a *OpenFgaApiService) GetStoreExecute(r ApiGetStoreRequest) (GetStoreRespo return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -2239,12 +2249,11 @@ func (a *OpenFgaApiService) GetStoreExecute(r ApiGetStoreRequest) (GetStoreRespo metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "GetStore", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -2313,6 +2322,7 @@ func (a *OpenFgaApiService) ListObjectsExecute(r ApiListObjectsRequest) (ListObj var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -2334,6 +2344,8 @@ func (a *OpenFgaApiService) ListObjectsExecute(r ApiListObjectsRequest) (ListObj return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -2534,12 +2546,11 @@ func (a *OpenFgaApiService) ListObjectsExecute(r ApiListObjectsRequest) (ListObj metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "ListObjects", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -2605,6 +2616,7 @@ func (a *OpenFgaApiService) ListStoresExecute(r ApiListStoresRequest) (ListStore var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -2816,11 +2828,11 @@ func (a *OpenFgaApiService) ListStoresExecute(r ApiListStoresRequest) (ListStore metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "ListStores", - map[string]interface{}{ - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -2891,6 +2903,7 @@ func (a *OpenFgaApiService) ListUsersExecute(r ApiListUsersRequest) (ListUsersRe var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -2912,6 +2925,8 @@ func (a *OpenFgaApiService) ListUsersExecute(r ApiListUsersRequest) (ListUsersRe return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -3112,12 +3127,11 @@ func (a *OpenFgaApiService) ListUsersExecute(r ApiListUsersRequest) (ListUsersRe metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "ListUsers", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -3289,6 +3303,7 @@ func (a *OpenFgaApiService) ReadExecute(r ApiReadRequest) (ReadResponse, *_netht var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -3310,6 +3325,8 @@ func (a *OpenFgaApiService) ReadExecute(r ApiReadRequest) (ReadResponse, *_netht return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -3510,12 +3527,11 @@ func (a *OpenFgaApiService) ReadExecute(r ApiReadRequest) (ReadResponse, *_netht metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "Read", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -3573,6 +3589,7 @@ func (a *OpenFgaApiService) ReadAssertionsExecute(r ApiReadAssertionsRequest) (R var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -3594,11 +3611,15 @@ func (a *OpenFgaApiService) ReadAssertionsExecute(r ApiReadAssertionsRequest) (R return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) if r.authorizationModelId == "" { return localVarReturnValue, nil, reportError("authorizationModelId is required and must be specified") } + params["authorizationModelId"] = r.authorizationModelId + localVarPath = strings.Replace(localVarPath, "{"+"authorization_model_id"+"}", _neturl.PathEscape(parameterToString(r.authorizationModelId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -3794,12 +3815,11 @@ func (a *OpenFgaApiService) ReadAssertionsExecute(r ApiReadAssertionsRequest) (R metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "ReadAssertions", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -3900,6 +3920,7 @@ func (a *OpenFgaApiService) ReadAuthorizationModelExecute(r ApiReadAuthorization var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -3921,11 +3942,15 @@ func (a *OpenFgaApiService) ReadAuthorizationModelExecute(r ApiReadAuthorization return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) if r.id == "" { return localVarReturnValue, nil, reportError("id is required and must be specified") } + params["id"] = r.id + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.PathEscape(parameterToString(r.id, "")), -1) localVarHeaderParams := make(map[string]string) @@ -4121,12 +4146,11 @@ func (a *OpenFgaApiService) ReadAuthorizationModelExecute(r ApiReadAuthorization metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "ReadAuthorizationModel", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -4233,6 +4257,7 @@ func (a *OpenFgaApiService) ReadAuthorizationModelsExecute(r ApiReadAuthorizatio var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -4254,6 +4279,8 @@ func (a *OpenFgaApiService) ReadAuthorizationModelsExecute(r ApiReadAuthorizatio return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -4455,12 +4482,11 @@ func (a *OpenFgaApiService) ReadAuthorizationModelsExecute(r ApiReadAuthorizatio metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "ReadAuthorizationModels", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -4536,6 +4562,7 @@ func (a *OpenFgaApiService) ReadChangesExecute(r ApiReadChangesRequest) (ReadCha var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -4557,6 +4584,8 @@ func (a *OpenFgaApiService) ReadChangesExecute(r ApiReadChangesRequest) (ReadCha return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -4761,12 +4790,11 @@ func (a *OpenFgaApiService) ReadChangesExecute(r ApiReadChangesRequest) (ReadCha metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "ReadChanges", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -4869,6 +4897,7 @@ func (a *OpenFgaApiService) WriteExecute(r ApiWriteRequest) (map[string]interfac var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -4890,6 +4919,8 @@ func (a *OpenFgaApiService) WriteExecute(r ApiWriteRequest) (map[string]interfac return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -5090,12 +5121,11 @@ func (a *OpenFgaApiService) WriteExecute(r ApiWriteRequest) (map[string]interfac metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "Write", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -5158,6 +5188,7 @@ func (a *OpenFgaApiService) WriteAssertionsExecute(r ApiWriteAssertionsRequest) var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -5178,11 +5209,15 @@ func (a *OpenFgaApiService) WriteAssertionsExecute(r ApiWriteAssertionsRequest) return nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) if r.authorizationModelId == "" { return nil, reportError("authorizationModelId is required and must be specified") } + params["authorizationModelId"] = r.authorizationModelId + localVarPath = strings.Replace(localVarPath, "{"+"authorization_model_id"+"}", _neturl.PathEscape(parameterToString(r.authorizationModelId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -5374,12 +5409,11 @@ func (a *OpenFgaApiService) WriteAssertionsExecute(r ApiWriteAssertionsRequest) metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "WriteAssertions", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted, @@ -5484,6 +5518,7 @@ func (a *OpenFgaApiService) WriteAuthorizationModelExecute(r ApiWriteAuthorizati var maxRetry int var minWaitInMs int var requestStarted time.Time = time.Now() + params := map[string]interface{}{} if a.RetryParams != nil { maxRetry = a.RetryParams.MinWaitInMs @@ -5505,6 +5540,8 @@ func (a *OpenFgaApiService) WriteAuthorizationModelExecute(r ApiWriteAuthorizati return localVarReturnValue, nil, reportError("storeId is required and must be specified") } + params["storeId"] = r.storeId + localVarPath = strings.Replace(localVarPath, "{"+"store_id"+"}", _neturl.PathEscape(parameterToString(r.storeId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -5705,12 +5742,11 @@ func (a *OpenFgaApiService) WriteAuthorizationModelExecute(r ApiWriteAuthorizati metrics := telemetry.GetMetrics(telemetry.TelemetryFactoryParameters{Configuration: a.client.cfg.Telemetry}) + params["body"] = localVarPostBody + var attrs, queryDuration, requestDuration, _ = metrics.BuildTelemetryAttributes( "WriteAuthorizationModel", - map[string]interface{}{ - "storeId": r.storeId, - "body": localVarPostBody, - }, + params, req, localVarHTTPResponse, requestStarted,