mirror of
https://github.com/Redocly/redoc.git
synced 2025-07-15 02:32:20 +03:00
add code samples
This commit is contained in:
parent
671e41e0a1
commit
8b301a086e
|
@ -109,6 +109,39 @@
|
||||||
petstore_auth:
|
petstore_auth:
|
||||||
- "write:pets"
|
- "write:pets"
|
||||||
- "read: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:
|
put:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
|
@ -743,6 +776,7 @@
|
||||||
required:
|
required:
|
||||||
- "name"
|
- "name"
|
||||||
- "photoUrls"
|
- "photoUrls"
|
||||||
|
- "petType"
|
||||||
discriminator: "petType"
|
discriminator: "petType"
|
||||||
properties:
|
properties:
|
||||||
petType:
|
petType:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user