diff --git a/OpenAPI/index.yml b/OpenAPI/index.yml index 1656111..4a68cdf 100644 --- a/OpenAPI/index.yml +++ b/OpenAPI/index.yml @@ -36,13 +36,6 @@ productDirectory: url: ./kiota/quickstarts/dotnet.md - text: Azure auth tutorial url: ./kiota/tutorials/dotnet-azure.md - - title: CLI - imageSrc: /media/common/i_cligeneric.svg - links: - - text: Quick start - url: ./kiota/quickstarts/cli.md - - text: Azure auth tutorial - url: ./kiota/tutorials/cli-azure.md - title: Go imageSrc: /media/logos/logo_Go-lightblue.svg links: diff --git a/OpenAPI/kiota/dependencies.md b/OpenAPI/kiota/dependencies.md index 3ec16ed..7688738 100644 --- a/OpenAPI/kiota/dependencies.md +++ b/OpenAPI/kiota/dependencies.md @@ -38,7 +38,6 @@ The following table provides the list of abstractions package per language. | Language | Package Name | | -------- | ------------ | | C# | Microsoft.Kiota.Abstractions | -| CLI | Microsoft.Kiota.Abstractions | | Go | github.com/microsoft/kiota-abstractions-go | | Java | com.microsoft.kiota:microsoft-kiota-abstractions | | PHP | microsoft/kiota-abstractions | @@ -62,7 +61,6 @@ The following table provides the list of serialization package per language. | Language | Package Name | Relies on | | -------- | ------------ | --------- | | C# | Microsoft.Kiota.Serialization.Json | System.Text.Json | -| CLI | Microsoft.Kiota.Serialization.Json | System.Text.Json | | Go | github.com/microsoft/kiota-serialization-json-go | None | | Java | com.microsoft.kiota:microsoft-kiota-serialization-json | Gson | | PHP | microsoft/kiota-serialization-json | None | @@ -80,7 +78,6 @@ The following table provides the list of serialization package per language. | Language | Package Name | Relies on | | -------- | ------------ | --------- | | C# | Microsoft.Kiota.Serialization.Multipart | None | -| CLI | Microsoft.Kiota.Serialization.Multipart | None | | Go | github.com/microsoft/kiota-serialization-multipart-go | None | | Java | com.microsoft.kiota:microsoft-kiota-serialization-multipart | None | | PHP | microsoft/kiota-serialization-multipart | None | @@ -98,7 +95,6 @@ The following table provides the list of serialization package per language. | Language | Package Name | Relies on | | -------- | ------------ | --------- | | C# | Microsoft.Kiota.Serialization.Form | None | -| CLI | Microsoft.Kiota.Serialization.Form | None | | Go | github.com/microsoft/kiota-serialization-form-go | None | | Java | com.microsoft.kiota:microsoft-kiota-serialization-form | None | | PHP | microsoft/kiota-serialization-form | None | @@ -116,7 +112,6 @@ The following table provides the list of serialization package per language. | Language | Package Name | Relies on | | -------- | ------------ | --------- | | C# | Microsoft.Kiota.Serialization.Text | None | -| CLI | Microsoft.Kiota.Serialization.Text | None | | Go | github.com/microsoft/kiota-serialization-text-go | None | | Java | com.microsoft.kiota:microsoft-kiota-serialization-text | None | | PHP | microsoft/kiota-serialization-text | None | @@ -136,7 +131,6 @@ The following table provides the list of HTTP package per language. | Language | Package Name | Relies on | | -------- | ------------ | --------- | | C# | Microsoft.Kiota.Http.HttpClientLibrary | System.Net.Http | -| CLI | Microsoft.Kiota.Http.HttpClientLibrary | System.Net.Http | | Go | github.com/microsoft/kiota-http-go | net/http | | Java | com.microsoft.kiota:microsoft-kiota-http-okHttp | None | | PHP | microsoft/kiota-http-guzzle | None | @@ -160,7 +154,6 @@ The following table provides the list of authentication package per language. | Language | Package Name | Relies on | | -------- | ------------ | --------- | | C# | Microsoft.Kiota.Authentication.Azure | Azure.Identity | -| CLI | Microsoft.Kiota.Authentication.Azure | Azure.Identity | | Go | github.com/microsoft/kiota-authentication-azure-go | github.com/Azure/azure-sdk-for-go/sdk/azidentity | | Java | com.microsoft.kiota:microsoft-kiota-authentication-azure | com.azure:azure-identity | | PHP | microsoft/kiota-authentication-phpleague | phpleague | @@ -178,7 +171,6 @@ The following table provides the list of additional package per language. | Language | Package Name | Type | | -------- | ------------ | ---- | | C# | None | | -| CLI | Microsoft.Kiota.CLI.Commons, System.CommandLine | Build and runtime | | Go | None | | | Java | jakarta.annotation:jakarta.annotation-api:2.0.0 | Build | | PHP | None | | @@ -196,7 +188,6 @@ The following table provides the list of bundle package per language. | Language | Package Name | | -------- | ------------ | | C# | Microsoft.Kiota.Bundle | -| CLI | Microsoft.Kiota.Bundle | | Go | github.com/microsoft/kiota-bundle-go | | Java | com.microsoft.kiota:microsoft-kiota-bundle | | PHP | Not available | diff --git a/OpenAPI/kiota/index.yml b/OpenAPI/kiota/index.yml index 5625e79..2fd2e4c 100644 --- a/OpenAPI/kiota/index.yml +++ b/OpenAPI/kiota/index.yml @@ -42,8 +42,6 @@ landingContent: links: - text: Build API clients for .NET url: quickstarts/dotnet.md - - text: Build API clients for CLI - url: quickstarts/cli.md - text: Build API clients for Dart url: quickstarts/dart.md - text: Build API clients for Go @@ -63,8 +61,6 @@ landingContent: links: - text: .NET tutorial url: tutorials/dotnet-azure.md - - text: CLI tutorial - url: tutorials/cli-azure.md - text: Go tutorial url: tutorials/go-azure.md - text: Java tutorial diff --git a/OpenAPI/kiota/models.md b/OpenAPI/kiota/models.md index 9f2585a..c8a225e 100644 --- a/OpenAPI/kiota/models.md +++ b/OpenAPI/kiota/models.md @@ -198,7 +198,6 @@ To produce a more idiomatic output for specific languages, mangling is applied t | Language | Property name | Property accessors | | ---------- | ------------- | ------------------ | | CSharp | `PascalCase` | - | -| CLI | `PascalCase` | - | | Go | - | `PascalCase` | | Java | `camelCase` | `camelCase` | | PHP | - | `camelCase` | diff --git a/OpenAPI/kiota/overview.md b/OpenAPI/kiota/overview.md index 0ebf84a..843bcf8 100644 --- a/OpenAPI/kiota/overview.md +++ b/OpenAPI/kiota/overview.md @@ -18,7 +18,7 @@ Kiota is a command line tool for generating an API client to call any OpenAPI-de ## Features -- Provides support for a wide range of languages: C#, CLI, Go, Java, PHP, Python, Ruby, and TypeScript +- Provides support for a wide range of languages: C#, Go, Java, PHP, Python, Ruby, and TypeScript - Uses the full capabilities of OpenAPI descriptions - Enables low effort implementation of new language support - Generates only the source code necessary by building on a core library diff --git a/OpenAPI/kiota/quickstarts/cli.md b/OpenAPI/kiota/quickstarts/cli.md deleted file mode 100644 index 38302d9..0000000 --- a/OpenAPI/kiota/quickstarts/cli.md +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: Build API clients for a command line interface (CLI) -description: Learn how use Kiota to build API clients for a CLI. -author: jasonjoh -ms.author: jasonjoh -ms.topic: quickstart -ms.date: 03/24/2023 ---- - -# Build API clients for a command line interface (CLI) - -In this tutorial, you build a sample command line interface (CLI) app that calls a REST API that doesn't require authentication. - -## Required tools - -A command line tool is required. We recommend: - -- [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-us&gl=us) (or equivalent on MacOS/linux) -- [.NET SDK 7.0](https://get.dot.net/7) - -## Create a project - -Run the following command in the directory you want to create a new project. - -```bash -dotnet new console -o KiotaPostsCLI -cd KiotaPostsCLI -dotnet new gitignore -``` - -## Project configuration - -In case you're adding a Kiota client to an existing project, the following configuration is required: - -- ***.csproj** > **TargetFramework** set to "net6" or later. [More information](/dotnet/standard/frameworks) -- ***.csproj** > **LangVersion** set to "latest". [More information](/dotnet/csharp/language-reference/configure-language-version#c-language-version-reference) -- ***.csproj** > **Nullable** set to "enable". - -## Add dependencies - -Before you can compile and run the generated API client, you need to make sure the generated source files are part of a project with the required dependencies. Your project must have a reference to the [bundle package](https://github.com/microsoft/kiota-dotnet) and the [cli-commons package](https://github.com/microsoft/kiota-cli-commons). For more information about Kiota dependencies, see [the dependencies documentation](../dependencies.md). - -For this tutorial, use the default implementations. - -Run the following commands to get the required dependencies. - -```bash -dotnet add package Microsoft.Kiota.Bundle -dotnet add package Microsoft.Kiota.Cli.Commons --prerelease -``` - -## Generate the API client - -Kiota generates API clients from OpenAPI documents. Create a file named **posts-api.yml** and add the following. - -:::code language="yaml" source="~/code-snippets/get-started/quickstart/posts-api.yml"::: - -This file is a minimal OpenAPI description that describes how to call the `/posts` endpoint in the [JSONPlaceholder REST API](https://jsonplaceholder.typicode.com/). - -You can then use the Kiota command line tool to generate the API client classes. - -```bash -kiota generate -l CLI -c PostsClient -n KiotaPostsCLI.Client -d ./posts-api.yml -o ./src/Client -``` - -> [!TIP] -> Add [`--exclude-backward-compatible`](../using.md#--exclude-backward-compatible---ebc) -> if you want to reduce the size of the generated client and are not concerned about -> potentially source breaking changes with future versions of Kiota when updating the client. - -## Create the client application - -The final step is to update the **Program.cs** file that was generated as part of the console application, replacing its contents with the following code. - -:::code language="csharp" source="~/code-snippets/get-started/quickstart/cli/src/Program.cs" id="ProgramSnippet"::: - -> [!NOTE] -> The [JSONPlaceholder REST API](https://jsonplaceholder.typicode.com/) doesn't require any authentication, so this sample uses the **AnonymousAuthenticationProvider**. For APIs that require authentication, use an applicable authentication provider. - -## Run the application - -To invoke the CLI app, run the following commands in your project directory. - -### GET /posts - -```bash -dotnet run -- posts list -``` - -### GET /posts/{id} - -```bash -dotnet run -- posts get --post-id 5 -``` - -### POST /posts - -```bash -dotnet run -- posts create --body '{ "userId": 42, "title": "Testing Kiota-generated API client", "body": "Hello world!" }' -``` - -### PATCH /posts/{id} - -```bash -dotnet run -- posts patch --post-id 5 --body '{ "title": "Updated title" }' -``` - -### DELETE /posts/{id} - -```bash -dotnet run -- posts delete --post-id 5 -``` - -## See also - -- [kiota-samples repository](https://github.com/microsoft/kiota-samples/tree/main/get-started/quickstart/cli) contains the code from this guide. -- [Microsoft Graph sample using Microsoft identity platform authentication](https://github.com/microsoft/kiota-samples/tree/main/get-started/azure-auth/cli) -- [ToDoItem Sample API](https://github.com/microsoft/kiota-samples/tree/main/sample-api) implements a sample OpenAPI in ASP.NET Core and sample clients in multiple languages. diff --git a/OpenAPI/kiota/quickstarts/index.md b/OpenAPI/kiota/quickstarts/index.md index 2a3a1a3..de564c6 100644 --- a/OpenAPI/kiota/quickstarts/index.md +++ b/OpenAPI/kiota/quickstarts/index.md @@ -16,7 +16,6 @@ Kiota quick starts are step-by-step exercises that guide you through generating | Quick start | GitHub location | |-------------|-----------------| -| [CLI](cli.md) | [microsoft/kiota-samples/get-started/quickstart/cli](https://github.com/microsoft/kiota-samples/tree/main/get-started/quickstart/cli) | | [.NET](dotnet.md) | [microsoft/kiota-samples/get-started/quickstart/dotnet](https://github.com/microsoft/kiota-samples/tree/main/get-started/quickstart/dotnet) | | [Go](go.md) | [microsoft/kiota-samples/get-started/quickstart/go](https://github.com/microsoft/kiota-samples/tree/main/get-started/quickstart/go) | | [Java](java.md) | [microsoft/kiota-samples/get-started/quickstart/java](https://github.com/microsoft/kiota-samples/tree/main/get-started/quickstart/java) | diff --git a/OpenAPI/kiota/toc.yml b/OpenAPI/kiota/toc.yml index 978d0cf..2fd802f 100644 --- a/OpenAPI/kiota/toc.yml +++ b/OpenAPI/kiota/toc.yml @@ -13,8 +13,6 @@ items: href: quickstarts/index.md - name: .NET href: quickstarts/dotnet.md - - name: CLI - href: quickstarts/cli.md - name: Dart href: quickstarts/dart.md - name: Go @@ -33,8 +31,6 @@ items: items: - name: .NET href: tutorials/dotnet-azure.md - - name: CLI - href: tutorials/cli-azure.md - name: Go href: tutorials/go-azure.md - name: Java diff --git a/OpenAPI/kiota/tutorials/cli-azure.md b/OpenAPI/kiota/tutorials/cli-azure.md deleted file mode 100644 index c8989fc..0000000 --- a/OpenAPI/kiota/tutorials/cli-azure.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: Build API clients for a command line interface (CLI) with Microsoft identity authentication -description: Learn how use Kiota to build API clients for a CLI to access APIs that require Microsoft identity authentication. -author: jasonjoh -ms.author: jasonjoh -ms.topic: tutorial -ms.date: 03/20/2023 ---- - -# Build API clients for a command line interface (CLI) with Microsoft identity authentication - -In this tutorial, you generate an API client that uses [Microsoft identity authentication](/azure/active-directory/fundamentals/auth-oauth2) to access [Microsoft Graph](/graph/overview). - -## Required tools - -A command line tool is required. We recommend: - -- [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-us&gl=us) (or equivalent on MacOS/linux) -- [.NET SDK 8.0](https://get.dot.net/8) - -## Create a project - -Run the following command in the directory you want to create a new project. - -```bash -dotnet new console -o GetUserClient -dotnet new gitignore -``` - -## Add dependencies - -Before you can compile and run the generated API client, you need to make sure the generated source files are part of a project with the required dependencies. Your project must have a reference to the [bundle package](https://github.com/microsoft/kiota-dotnet) and the [cli-commons package](https://github.com/microsoft/kiota-cli-commons). For more information about Kiota dependencies, see [the dependencies documentation](../dependencies.md). - -Run the following commands to get the required dependencies. - -```bash -dotnet add package Microsoft.Kiota.Bundle -dotnet add package Microsoft.Kiota.Cli.Commons --prerelease -dotnet add package Azure.Identity -dotnet add package Microsoft.Extensions.DependencyInjection -dotnet add package Microsoft.Extensions.Hosting -``` - -## Generate the API client - -Kiota generates API clients from OpenAPI documents. Create a file named **get-me.yml** and add the following. - -:::code language="yaml" source="~/code-snippets/get-started/azure-auth/get-me.yml"::: - -You can then use the Kiota command line tool to generate the API client classes. - -```bash -kiota generate --openapi get-me.yml --language CLI -c GetUserApiClient -n GetUserClient.ApiClient -o ./Client -``` - -## Register an application - -[!INCLUDE [register-azure-app-device-code-intro](../includes/register-azure-app-device-code-intro.md)] - - -### [Azure portal](#tab/portal) - -[!INCLUDE [register-azure-app-device-code-portal](../includes/register-azure-app-device-code-portal.md)] - -### [PowerShell](#tab/powershell) - -[!INCLUDE [register-azure-app-device-code-powershell](../includes/register-azure-app-device-code-powershell.md)] - - ---- - -## Create the client application - -The final step is to update the **Program.cs** file that was generated as part of the console application to include the following code. Replace `YOUR_CLIENT_ID` with the client ID from your app registration. - -:::code language="csharp" source="~/code-snippets/get-started/azure-auth/cli/src/Program.cs" id="ProgramSnippet"::: - -> [!NOTE] -> This example uses the **DeviceCodeCredential** class. You can use any of the credential classes from the `Azure.Identity` library. - -## Run the application - -To start the application, run the following command in your project directory. - -```bash -dotnet run -- me get -``` - -## See also - -- [kiota-samples repository](https://github.com/microsoft/kiota-samples/tree/main/get-started/azure-auth/cli) contains the code from this guide. -- [More CLI samples](https://github.com/microsoftgraph/msgraph-cli/tree/main/samples) -- [ToDoItem Sample API](https://github.com/microsoft/kiota-samples/tree/main/sample-api) implements a sample OpenAPI in ASP.NET Core and sample clients in multiple languages. diff --git a/OpenAPI/kiota/using.md b/OpenAPI/kiota/using.md index e47841a..c20f23e 100644 --- a/OpenAPI/kiota/using.md +++ b/OpenAPI/kiota/using.md @@ -455,7 +455,6 @@ kiota info ```bash Language Maturity Level -CLI Preview CSharp Stable Go Stable Java Preview