add code samples

This commit is contained in:
Roman Hotsiy 2016-02-01 14:46:43 +02:00
parent 671e41e0a1
commit 8b301a086e

View File

@ -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: