William Cheng 4260c7aaf0
Better tests for php-nextgen (#16569)
* better tests for php nextgen

* add new files
2023-09-13 10:50:29 +08:00

10 KiB

OpenAPI\Client\BodyApi

All URIs are relative to http://localhost:3000, except if the operation defines another base path.

Method HTTP request Description
testBinaryGif() POST /binary/gif Test binary (gif) response body
testBodyApplicationOctetstreamBinary() POST /body/application/octetstream/binary Test body parameter(s)
testBodyMultipartFormdataArrayOfBinary() POST /body/application/octetstream/array_of_binary Test array of binary in multipart mime
testEchoBodyFreeFormObjectResponseString() POST /echo/body/FreeFormObject/response_string Test free form object
testEchoBodyPet() POST /echo/body/Pet Test body parameter(s)
testEchoBodyPetResponseString() POST /echo/body/Pet/response_string Test empty response body
testEchoBodyTagResponseString() POST /echo/body/Tag/response_string Test empty json (request body)

testBinaryGif()

testBinaryGif(): \SplFileObject

Test binary (gif) response body

Test binary (gif) response body

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\BodyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);

try {
    $result = $apiInstance->testBinaryGif();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BodyApi->testBinaryGif: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\SplFileObject

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: image/gif

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

testBodyApplicationOctetstreamBinary()

testBodyApplicationOctetstreamBinary($body): string

Test body parameter(s)

Test body parameter(s)

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\BodyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$body = "/path/to/file.txt"; // \SplFileObject

try {
    $result = $apiInstance->testBodyApplicationOctetstreamBinary($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BodyApi->testBodyApplicationOctetstreamBinary: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
body \SplFileObject**\SplFileObject** [optional]

Return type

string

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/octet-stream
  • Accept: text/plain

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

testBodyMultipartFormdataArrayOfBinary()

testBodyMultipartFormdataArrayOfBinary($files): string

Test array of binary in multipart mime

Test array of binary in multipart mime

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\BodyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$files = array("/path/to/file.txt"); // \SplFileObject[]

try {
    $result = $apiInstance->testBodyMultipartFormdataArrayOfBinary($files);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BodyApi->testBodyMultipartFormdataArrayOfBinary: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
files \SplFileObject[]

Return type

string

Authorization

No authorization required

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: text/plain

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

testEchoBodyFreeFormObjectResponseString()

testEchoBodyFreeFormObjectResponseString($body): string

Test free form object

Test free form object

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\BodyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$body = array('key' => new \stdClass); // object | Free form object

try {
    $result = $apiInstance->testEchoBodyFreeFormObjectResponseString($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BodyApi->testEchoBodyFreeFormObjectResponseString: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
body object Free form object [optional]

Return type

string

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: text/plain

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

testEchoBodyPet()

testEchoBodyPet($pet): \OpenAPI\Client\Model\Pet

Test body parameter(s)

Test body parameter(s)

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\BodyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store

try {
    $result = $apiInstance->testEchoBodyPet($pet);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BodyApi->testEchoBodyPet: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
pet \OpenAPI\Client\Model\Pet Pet object that needs to be added to the store [optional]

Return type

\OpenAPI\Client\Model\Pet

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

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

testEchoBodyPetResponseString()

testEchoBodyPetResponseString($pet): string

Test empty response body

Test empty response body

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\BodyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store

try {
    $result = $apiInstance->testEchoBodyPetResponseString($pet);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BodyApi->testEchoBodyPetResponseString: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
pet \OpenAPI\Client\Model\Pet Pet object that needs to be added to the store [optional]

Return type

string

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: text/plain

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

testEchoBodyTagResponseString()

testEchoBodyTagResponseString($tag): string

Test empty json (request body)

Test empty json (request body)

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\BodyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$tag = new \OpenAPI\Client\Model\Tag(); // \OpenAPI\Client\Model\Tag | Tag object

try {
    $result = $apiInstance->testEchoBodyTagResponseString($tag);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BodyApi->testEchoBodyTagResponseString: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
tag \OpenAPI\Client\Model\Tag Tag object [optional]

Return type

string

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: text/plain

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