-
Notifications
You must be signed in to change notification settings - Fork 38
🐱🐶Petstore Samples #993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
🐱🐶Petstore Samples #993
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
03c95b0
🐱🐶Petstore Samples
PureKrome 88f7b37
💄
PureKrome 69c6e94
Merge branch 'main' of https://github.com/microsoft/kiota-samples int…
PureKrome 1c9f349
Merge branch 'main' into petstore
baywet 7e5eebd
- updates dotnet petstore sample
baywet 687795f
- cleans up ruby graph files
baywet 6655348
- adds pet store go example
baywet 9259824
- removes ruby and php
baywet 570c04c
- adds pet store java example
baywet 4439553
- adds pet store typescript example
baywet e3807af
Apply suggestions from code review
baywet 75579b9
- adds dependabot configuration for petstore examples
baywet 861b5ee
Merge branch 'petstore' of https://github.com/PureKrome/kiota-samples…
baywet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Swagger Petstore samples | ||
|
|
||
| The following section showcases client SDK generated using the [OpenApi 'Swagger Petstore'](https://petstore.swagger.io/) using Kiota. | ||
|
|
||
| NOTE: Kiota version 1.0.1 was used to generate these SDK's. | ||
|
|
||
| ## Table of content | ||
|
|
||
| | Language | Command line | | ||
| | -------- | ------------ | | ||
| | [dotnet](./dotnet) | `kiota generate --openapi https://petstore.swagger.io/v2/swagger.json --additional-data false --language csharp -o PetstoreClient -c PetstoreApiClient --log-level information --clean-output true --namespace-name KiotaSamples.PetStoreSdk` | | ||
| | [java](./java) | `kiota generate --openapi https://petstore.swagger.io/v2/swagger.json --language java -o utilities/src/main/java/petstore/utilities -n petstore.utilities` | | ||
| | [typescript](./typescript) | | | ||
| | [go](./go) | | `kiota generate --openapi https://petstore.swagger.io/v2/swagger.json --language go -o utilities -n github.com/microsoft/kiota-samples/petstore/go/utilities/` | ||
|
|
||
| ## Example of data retrieved | ||
|
|
||
| This is a dotnet example that shows how the data looks, after generation AND the target api is called: | ||
|
|
||
|  | ||
|
|
||
|
|
||
| ## How to generate an SDK against the Swagger Petstore | ||
|
|
||
| These steps are all based on the official docs for [generating dotnet Kiota SDK's](https://microsoft.github.io/kiota/get-started/dotnet.html): | ||
|
|
||
| - Create a new project or solution. | ||
| e.g. | ||
| ``` | ||
| dotnet new console -o petstore | ||
| cd petstore | ||
| ``` | ||
| - Add the nuget dependencies, which we will need for the SDK generated code to work: | ||
| e.g. | ||
| ``` | ||
| dotnet add package Microsoft.Kiota.Abstractions | ||
| dotnet add package Microsoft.Kiota.Http.HttpClientLibrary | ||
| dotnet add package Microsoft.Kiota.Serialization.Json | ||
| dotnet add package Microsoft.Kiota.Serialization.Text | ||
| dotnet add package Microsoft.Kiota.Serialization.Form | ||
| ``` | ||
| - Create the Petstore SDK using Kiota and [the custom params](https://microsoft.github.io/kiota/using.html): | ||
| e.g. | ||
| ``` | ||
| kiota generate \ | ||
| --openapi https://petstore.swagger.io/v2/swagger.json \ | ||
| --additional-data false \ | ||
| --language csharp \ | ||
| --output src\PetstoreClient \ | ||
| --class-name PetstoreApiClient \ | ||
| --log-level information \ | ||
| --clean-output true \ | ||
| --namespace-name KiotaSamples.PetStoreSdk | ||
| ``` | ||
| - And that's it! you're ready to go! So, lets grab some pets: | ||
| ``` | ||
| var pet = await client.Pet["69"].GetAsync(); | ||
| ``` | ||
|
|
||
| -- end of readme -- | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.