https://github.com/nikiforovall/kiota-getting-started
Kiota + Aspire + .NET 8
https://github.com/nikiforovall/kiota-getting-started
aspire aspnet-core aspnetcore dotnet dotnet8 kiota
Last synced: about 1 year ago
JSON representation
Kiota + Aspire + .NET 8
- Host: GitHub
- URL: https://github.com/nikiforovall/kiota-getting-started
- Owner: NikiforovAll
- Created: 2024-03-21T19:16:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-24T13:49:47.000Z (over 2 years ago)
- Last Synced: 2025-03-27T11:02:39.356Z (over 1 year ago)
- Topics: aspire, aspnet-core, aspnetcore, dotnet, dotnet8, kiota
- Language: C#
- Homepage: https://nikiforovall.github.io/dotnet/aspnetcore/2024/03/24/kiota-guide-deep-dive.html
- Size: 118 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kiota + Aspire [](https://github.com/NikiforovAll/kiota-getting-started/actions/workflows/dotnet.yml)
This demo showcases the integration of Kiota, Aspire, and .NET 8! This project demonstrates how these technologies can work together seamlessly.
## Overview
In this demo, we have an application (`App.Client`) that calls our application's API (`App API`). This application integrates with the Bing REST API. The unique aspect of this project is that every HTTP client is automatically generated based on OpenAPI and Kiota.
### Technologies
- Aspire -
- Kiota -
## Key Features
- **App.Client**: This is our main application that interacts with the `App API`.
- **App**: This is our application's API which serves as the bridge between `App.Client` and the Bing REST API.
- **Bing REST API Integration**: Our application integrates with the Bing REST API to fetch data.
- **Automatic HTTP Client Generation**: We leverage OpenAPI and Kiota to automate the generation of every HTTP client in our application.
## Components
| Component | Description |
| --- | --- |
| `App` | Integrates with Bing REST API |
| `NewsSearch.Sdk` | Generated OpenAPI HTTP Client by Kiota. It's based on externally provided OpenAPI specification |
| `App.Sdk` | Generated OpenAPI HTTP Client by Kiota |
| `App.Client` | Invokes `App` via App.Sdk |
| `App.Client.Sdk` | Generated OpenAPI HTTP Client by Kiota |
| `App.Client.Cli` | Generated CLI Client by Kiota. Convention-based commands based on App.Client OpenAPI specification|
| `App.AppHost` | Aspire Host |
| `App.ServiceDefaults` | Reasonable service defaults provided in 'Aspire' paradigm. |
```mermaid
graph LR
App --> NewsSearchSdk["NewsSearch.Sdk"]
App --> AppServiceDefaults["App.ServiceDefaults"]
AppClient --> AppSdk["App.Sdk"]
AppClient["App.Client"] --> AppServiceDefaults
AppAppHost["App.AppHost"] --> App
AppAppHost --> AppClient
```
## Getting Started
Configure `App` and run Aspire AppHost.
```bash
dotnet user-secrets --project ./src/App set ApiKey ""
dotnet run --project ./src/App.AppHost
```
See what `App.Client.CLI` can do.
```bash
$ dotnet run --project ./src/App.Client.Cli/ -- my trending get -h
# Description:
# Usage:
# App.Client.Cli my trending get [options]
# Options:
# --output [default: JSON]
# --query
# -?, -h, --help Show help and usage information
```
Run:
```bash
$ dotnet run --project ./src/App.Client.Cli/ -- my trending get --output TABLE
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ Value │
# ├───────────────────────────────────────────────────────────────────────────────────┤
# │ US sues Apple │
# │ Sabalenka on Koltsov's death │
# │ US submits UN draft resolution │
# │ Biden cancels $6 billion student debt │
# │ Barron Trump's comment │
# │ Starbucks mugs recalled │
# │ Milwaukee election official convicted │
# │ February home sales │
# │ Demi Moore shares tribute to Bruce Willis │
# │ Congress unveils $1.2 trillion funding bill │
# │ Bacteria found in colon cancer │
# │ Erv Woolsey dies │
# │ Georgia executes man for 1993 murder │
# │ Lukas Gage addresses rumors │
# │ UN resolution on AI │
# │ Dana Carvey apologizes to Sharon Stone │
# │ `House of the Dragon' trailers │
# │ Summerfest 2024 lineup │
# │ Pig's kidney transplanted into a man │
# │ Hayley Erbert, Derek Hough return │
# │ Airline CEOs seek meeting with Boeing directors │
# │ Russia fires missiles at Kyiv │
# │ Airlines passengers' personal information review │
# │ Micron stock jumps │
# │ Rocket Lab launches NRO spy satellites │
# │ Idaho prisoner manhunt day 2 │
# │ US weekly jobless claims │
# │ Hermès targeted in lawsuit │
# │ Powerball winning numbers │
# │ California voters pass Proposition 1 │
# │ Beyoncé to receive Innovator Award │
# │ Maren Morris tour dates │
# │ Meta, Microsoft, X and Match join Epic Games │
# │ Target doubling employee bonuses │
# │ Kevin Durant NBA career scoring list │
# └───────────────────────────────────────────────────────────────────────────────────┘
```
See the trace:
