Robert Schweizer 9e07f85eb5
[python] Add tests and fix enum path parameters (#16769)
* test: Tests for enum params in path, query and header

* fix: Get enum ref values correctly in path parameters

Closes #16688

* fix java tests failure

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2023-10-10 17:10:30 +08:00

3.9 KiB

Org.OpenAPITools.Api.PathApi

All URIs are relative to http://localhost:3000

Method HTTP request Description
TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath GET /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} Test path parameter(s)

TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath

string TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath (string pathString, int pathInteger, string enumNonrefStringPath, StringEnumRef enumRefStringPath)

Test path parameter(s)

Test path parameter(s)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost:3000";
            var apiInstance = new PathApi(config);
            var pathString = "pathString_example";  // string | 
            var pathInteger = 56;  // int | 
            var enumNonrefStringPath = "success";  // string | 
            var enumRefStringPath = new StringEnumRef(); // StringEnumRef | 

            try
            {
                // Test path parameter(s)
                string result = apiInstance.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling PathApi.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Test path parameter(s)
    ApiResponse<string> response = apiInstance.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling PathApi.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
pathString string
pathInteger int
enumNonrefStringPath string
enumRefStringPath StringEnumRef

Return type

string

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain

HTTP response details

Status code Description Response headers
200 Successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]