mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-16 18:00:33 +03:00
add code samples
This commit is contained in:
parent
671e41e0a1
commit
8b301a086e
|
@ -109,6 +109,39 @@
|
|||
petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-code-samples:
|
||||
-
|
||||
lang: PHP
|
||||
source: |-
|
||||
$form = new \PetStore\Entities\Pet();
|
||||
$form->setPetType("Dog");
|
||||
$form->setName("Rex");
|
||||
// set other fields
|
||||
|
||||
try {
|
||||
$pet = $client->pets()->create($form);
|
||||
} catch (UnprocessableEntityException $e) {
|
||||
var_dump($e->getErrors());
|
||||
}
|
||||
-
|
||||
lang: C#
|
||||
source: |-
|
||||
PetStore.v1.Pet pet = new PetStore.v1.Pet();
|
||||
pet.setApiKey("your api key");
|
||||
pet.petType = PetStore.v1.Pet.TYPE_DOG;
|
||||
pet.name = "Rex";
|
||||
// set other fields
|
||||
|
||||
PetStoreResponse response = pet.create();
|
||||
if (response.statusCode == HttpStatusCode.Created)
|
||||
{
|
||||
// Successfully created
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something wrong -- check response for errors
|
||||
Console.WriteLine(response.getRawResponse());
|
||||
}
|
||||
put:
|
||||
tags:
|
||||
- "pet"
|
||||
|
@ -743,6 +776,7 @@
|
|||
required:
|
||||
- "name"
|
||||
- "photoUrls"
|
||||
- "petType"
|
||||
discriminator: "petType"
|
||||
properties:
|
||||
petType:
|
||||
|
|
Loading…
Reference in New Issue
Block a user