From 54fc7aeba6273091d0b99aea565442e679a5b0e0 Mon Sep 17 00:00:00 2001 From: "devopsarr[bot]" <127950054+devopsarr[bot]@users.noreply.github.com> Date: Sun, 19 Jan 2025 21:15:15 +0000 Subject: [PATCH] feat: remove broken root api path --- README.md | 1 - docs/StaticResourceAPI.md | 67 ------------------- sonarr/api_static_resource.go | 118 ---------------------------------- 3 files changed, 186 deletions(-) diff --git a/README.md b/README.md index d65517c..c0efccf 100644 --- a/README.md +++ b/README.md @@ -289,7 +289,6 @@ Class | Method | HTTP request | Description *SeriesFolderAPI* | [**GetSeriesFolder**](docs/SeriesFolderAPI.md#getseriesfolder) | **Get** /api/v3/series/{id}/folder | *SeriesImportAPI* | [**CreateSeriesImport**](docs/SeriesImportAPI.md#createseriesimport) | **Post** /api/v3/series/import | *SeriesLookupAPI* | [**ListSeriesLookup**](docs/SeriesLookupAPI.md#listserieslookup) | **Get** /api/v3/series/lookup | -*StaticResourceAPI* | [**Get**](docs/StaticResourceAPI.md#get) | **Get** / | *StaticResourceAPI* | [**GetByPath**](docs/StaticResourceAPI.md#getbypath) | **Get** /{path} | *StaticResourceAPI* | [**GetContentByPath**](docs/StaticResourceAPI.md#getcontentbypath) | **Get** /content/{path} | *StaticResourceAPI* | [**GetLogin**](docs/StaticResourceAPI.md#getlogin) | **Get** /login | diff --git a/docs/StaticResourceAPI.md b/docs/StaticResourceAPI.md index 4965518..9d333a5 100644 --- a/docs/StaticResourceAPI.md +++ b/docs/StaticResourceAPI.md @@ -4,79 +4,12 @@ All URIs are relative to *http://localhost:8989* Method | HTTP request | Description ------------- | ------------- | ------------- -[**Get**](StaticResourceAPI.md#Get) | **Get** / | [**GetByPath**](StaticResourceAPI.md#GetByPath) | **Get** /{path} | [**GetContentByPath**](StaticResourceAPI.md#GetContentByPath) | **Get** /content/{path} | [**GetLogin**](StaticResourceAPI.md#GetLogin) | **Get** /login | -## Get - -> Get(ctx, path).Execute() - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - sonarrClient "github.com/devopsarr/sonarr-go/sonarr" -) - -func main() { - path := "path_example" // string | - - configuration := sonarrClient.NewConfiguration() - apiClient := sonarrClient.NewAPIClient(configuration) - r, err := apiClient.StaticResourceAPI.Get(context.Background(), path).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `StaticResourceAPI.Get``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**path** | **string** | | - -### Other Parameters - -Other parameters are passed through a pointer to a apiGetRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - -### Return type - - (empty response body) - -### Authorization - -[apikey](../README.md#apikey), [X-Api-Key](../README.md#X-Api-Key) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - ## GetByPath > GetByPath(ctx, path).Execute() diff --git a/sonarr/api_static_resource.go b/sonarr/api_static_resource.go index 1732a48..e9591fe 100644 --- a/sonarr/api_static_resource.go +++ b/sonarr/api_static_resource.go @@ -23,124 +23,6 @@ import ( // StaticResourceAPIService StaticResourceAPI service type StaticResourceAPIService service -type ApiGetRequest struct { - ctx context.Context - ApiService *StaticResourceAPIService - path string -} - -func (r ApiGetRequest) Execute() (*http.Response, error) { - return r.ApiService.GetExecute(r) -} - -/* -Get Method for Get - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param path - @return ApiGetRequest -*/ -func (a *StaticResourceAPIService) Get(ctx context.Context, path string) ApiGetRequest { - return ApiGetRequest{ - ApiService: a, - ctx: ctx, - path: path, - } -} - -// Execute executes the request -func (a *StaticResourceAPIService) GetExecute(r ApiGetRequest) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StaticResourceAPIService.Get") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/" - localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", url.PathEscape(parameterValueToString(r.path, "path")), -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.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apikey"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarQueryParams.Add("apikey", key) - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["X-Api-Key"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["X-Api-Key"] = 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 ApiGetByPathRequest struct { ctx context.Context ApiService *StaticResourceAPIService