diff --git a/README.md b/README.md index 5207901b89..75859c7193 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The following table provides an overview of the languages supported by Kiota and | PHP | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-php) | [JSON](https://github.com/microsoft/kiota-serialization-json-php), [❌ FORM](https://github.com/microsoft/kiota/issues/2074), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3029), [TEXT](https://github.com/microsoft/kiota-serialization-text-php) | [Anonymous](https://github.com/microsoft/kiota-abstractions-php/blob/main/src/Authentication/AnonymousAuthenticationProvider.php), [✔️ PHP League](https://github.com/microsoft/kiota-authentication-phpleague-php) | [✔](https://github.com/microsoft/kiota-http-guzzle-php) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/php) | | Python | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-python) | [❌ FORM](https://github.com/microsoft/kiota/issues/2075), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3030), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [✔](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) | | Ruby | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-ruby) | [❌ FORM](https://github.com/microsoft/kiota/issues/2077), [JSON](https://github.com/microsoft/kiota-serialization-json-ruby), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3032), [❌ TEXT](https://github.com/microsoft/kiota/issues/1049) | [Anonymous](https://github.com/microsoft/kiota-abstractions-ruby/blob/main/lib/microsoft_kiota_abstractions/authentication/anonymous_authentication_provider.rb), [✔️ OAuth2](https://github.com/microsoft/kiota-authentication-oauth-ruby) | [✔](https://github.com/microsoft/kiota-http-ruby)| [link](https://learn.microsoft.com/openapi/kiota/quickstarts/ruby) | -| Shell | ✔ | (see CSHarp) + [✔](https://github.com/microsoft/kiota-cli-commons) | (see CSHarp) | (see CSharp) | (see CSharp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/cli) | +| Shell | ✔ | (see CSharp) + [✔](https://github.com/microsoft/kiota-cli-commons) | (see CSharp) | (see CSharp) | (see CSharp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/cli) | | Swift | [▶](https://github.com/microsoft/kiota/issues/1449) | [✔](./abstractions/swift) | [❌ FORM](https://github.com/microsoft/kiota/issues/2076), [❌ JSON](https://github.com/microsoft/kiota/issues/1451), [❌ FORM](https://github.com/microsoft/kiota/issues/3033), [❌ TEXT](https://github.com/microsoft/kiota/issues/1452) | [Anonymous](./abstractions/swift/Source/MicrosoftKiotaAbstractions/Authentication/AnonymousAuthenticationProvider.swift), [❌ Azure](https://github.com/microsoft/kiota/issues/1453) | [❌](https://github.com/microsoft/kiota/issues/1454)| | | TypeScript/JavaScript | ✔ | [✔](https://github.com/microsoft/kiota-typescript/tree/main/packages/abstractions) | [FORM](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/form), [JSON](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/json), [MULTIPART](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/multipart), [TEXT](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/text) | [Anonymous](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/authentication/anonymousAuthenticationProvider.ts), [API Key](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/authentication/apiKeyAuthenticationProvider.ts), [Azure](https://github.com/microsoft/kiota-typescript/tree/main/packages/authentication/azure) | [✔](https://github.com/microsoft/kiota-typescript/tree/main/packages/http/fetch) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/typescript) | diff --git a/src/Kiota.Builder/CodeDOM/CodeMethod.cs b/src/Kiota.Builder/CodeDOM/CodeMethod.cs index eeb316bf16..4109ab0ca7 100644 --- a/src/Kiota.Builder/CodeDOM/CodeMethod.cs +++ b/src/Kiota.Builder/CodeDOM/CodeMethod.cs @@ -164,7 +164,7 @@ public PagingInformation? PagingInformation /// /// The combination of the path, query and header parameters for the current URL. - /// Only use this property if the language you are generating for doesn't support fluent API style (e.g. Shell/CLI) + /// Only use this property if the language you are generating for doesn't support fluent API style (e.g. CLI) /// public IEnumerable PathQueryAndHeaderParameters { diff --git a/src/Kiota.Builder/GenerationLanguage.cs b/src/Kiota.Builder/GenerationLanguage.cs index 530aa921d3..dbd236ade7 100644 --- a/src/Kiota.Builder/GenerationLanguage.cs +++ b/src/Kiota.Builder/GenerationLanguage.cs @@ -1,13 +1,13 @@ -namespace Kiota.Builder; -public enum GenerationLanguage -{ - CSharp, - Java, - TypeScript, - PHP, - Python, - Go, - Swift, - Ruby, - Shell -} +namespace Kiota.Builder; +public enum GenerationLanguage +{ + CSharp, + Java, + TypeScript, + PHP, + Python, + Go, + Swift, + Ruby, + CLI +} diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index fa9d03ccea..5e500c0134 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -1263,7 +1263,7 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp var mediaType = operation.Responses.Values.SelectMany(static x => x.Content).First(x => x.Value.Schema == schema).Key; generatorMethod.AcceptedResponseTypes.Add(mediaType); } - if (config.Language == GenerationLanguage.Shell) + if (config.Language == GenerationLanguage.CLI) SetPathAndQueryParameters(generatorMethod, currentNode, operation); AddRequestBuilderMethodParameters(currentNode, operationType, operation, requestConfigClass, generatorMethod); parentClass.AddMethod(generatorMethod); diff --git a/src/Kiota.Builder/Refiners/ILanguageRefiner.cs b/src/Kiota.Builder/Refiners/ILanguageRefiner.cs index 415144ea89..5828b0185d 100644 --- a/src/Kiota.Builder/Refiners/ILanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/ILanguageRefiner.cs @@ -31,7 +31,7 @@ public static async Task Refine(GenerationConfiguration config, CodeNamespace ge case GenerationLanguage.Go: await new GoRefiner(config).Refine(generatedCode, cancellationToken).ConfigureAwait(false); break; - case GenerationLanguage.Shell: + case GenerationLanguage.CLI: await new ShellRefiner(config).Refine(generatedCode, cancellationToken).ConfigureAwait(false); break; case GenerationLanguage.Swift: diff --git a/src/Kiota.Builder/Writers/LanguageWriter.cs b/src/Kiota.Builder/Writers/LanguageWriter.cs index 3319c11052..aa0afd43e7 100644 --- a/src/Kiota.Builder/Writers/LanguageWriter.cs +++ b/src/Kiota.Builder/Writers/LanguageWriter.cs @@ -181,7 +181,7 @@ public static LanguageWriter GetLanguageWriter(GenerationLanguage language, stri GenerationLanguage.PHP => new PhpWriter(outputPath, clientNamespaceName, usesBackingStore), GenerationLanguage.Python => new PythonWriter(outputPath, clientNamespaceName, usesBackingStore), GenerationLanguage.Go => new GoWriter(outputPath, clientNamespaceName), - GenerationLanguage.Shell => new ShellWriter(outputPath, clientNamespaceName), + GenerationLanguage.CLI => new ShellWriter(outputPath, clientNamespaceName), GenerationLanguage.Swift => new SwiftWriter(outputPath, clientNamespaceName), _ => throw new InvalidEnumArgumentException($"{language} language currently not supported."), }; diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index b29f9c0034..942056f97f 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -1238,7 +1238,7 @@ public void Supports_Path_Query_And_Header_Parameters() } }; var mockLogger = new Mock>(); - var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost", Language = GenerationLanguage.Shell }, _httpClient); + var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost", Language = GenerationLanguage.CLI }, _httpClient); var node = builder.CreateUriSpace(document); var codeModel = builder.CreateSourceModel(node); var deviceManagementNS = codeModel.FindNamespaceByName("ApiSdk.deviceManagement"); @@ -1331,7 +1331,7 @@ public void DeduplicatesConflictingParameterNamesForCLI() }, }; var mockLogger = new Mock>(); - var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost", Language = GenerationLanguage.Shell }, _httpClient); + var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost", Language = GenerationLanguage.CLI }, _httpClient); var node = builder.CreateUriSpace(document); var codeModel = builder.CreateSourceModel(node); var resultsNS = codeModel.FindNamespaceByName("ApiSdk.test.item.results"); diff --git a/tests/Kiota.Builder.Tests/Refiners/ShellRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/ShellRefinerTests.cs index 3fe9f02c14..43106397b7 100644 --- a/tests/Kiota.Builder.Tests/Refiners/ShellRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/ShellRefinerTests.cs @@ -71,7 +71,7 @@ public async Task AddsUsingsForCommandTypesUsedInCommandBuilder() IsExternal = true } }).First(); - await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Shell }, root); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CLI }, root); var declaration = requestBuilder.StartBlock; @@ -166,7 +166,7 @@ public async Task CreatesCommandBuilders() SerializerModules = new() { "com.microsoft.kiota.serialization.Serializer" } }); - await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Shell }, root); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CLI }, root); var methods = root.GetChildElements().OfType().SelectMany(c => c.Methods); var methodNames = methods.Select(m => m.Name); @@ -239,7 +239,7 @@ public async Task RemovesRequestAdaptersFromCodeDom() Assert.Contains("adapter", propertyNames); Assert.Contains("adapter", methodParamNames); - await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Shell }, root); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CLI }, root); Assert.DoesNotContain("adapter", propertyNames); Assert.DoesNotContain("adapter", methodParamNames); @@ -285,7 +285,7 @@ public async Task RenamesNavPropertiesInIndexersWithConflicts() }; rootRequestBuilder.AddIndexer(indexer); - await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Shell }, root); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CLI }, root); Assert.Equal("GraphOrgContactNav-ById", idxNavProp.Name); } diff --git a/tests/Kiota.Builder.Tests/Writers/Shell/ShellCodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Shell/ShellCodeMethodWriterTests.cs index c1df4a2625..1f4279a5ea 100644 --- a/tests/Kiota.Builder.Tests/Writers/Shell/ShellCodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Shell/ShellCodeMethodWriterTests.cs @@ -24,7 +24,7 @@ public class ShellCodeMethodWriterTests : IDisposable public ShellCodeMethodWriterTests() { - writer = LanguageWriter.GetLanguageWriter(GenerationLanguage.Shell, DefaultPath, DefaultName); + writer = LanguageWriter.GetLanguageWriter(GenerationLanguage.CLI, DefaultPath, DefaultName); tw = new StringWriter(); writer.SetTextWriter(tw); root = CodeNamespace.InitRootNamespace(); diff --git a/vscode/microsoft-kiota/src/kiotaInterop.ts b/vscode/microsoft-kiota/src/kiotaInterop.ts index 0e3ddd18c0..06aa5db901 100644 --- a/vscode/microsoft-kiota/src/kiotaInterop.ts +++ b/vscode/microsoft-kiota/src/kiotaInterop.ts @@ -86,7 +86,7 @@ export enum KiotaGenerationLanguage { // eslint-disable-next-line @typescript-eslint/naming-convention Ruby = 7, // eslint-disable-next-line @typescript-eslint/naming-convention - Shell = 8, + CLI = 8, } export function generationLanguageToString(language: KiotaGenerationLanguage): string { switch (language) { @@ -106,8 +106,8 @@ export function generationLanguageToString(language: KiotaGenerationLanguage): s return "Swift"; case KiotaGenerationLanguage.Ruby: return "Ruby"; - case KiotaGenerationLanguage.Shell: - return "Shell"; + case KiotaGenerationLanguage.CLI: + return "CLI"; default: throw new Error("unknown language"); } @@ -130,8 +130,8 @@ export function parseGenerationLanguage(value: string): KiotaGenerationLanguage return KiotaGenerationLanguage.Swift; case "Ruby": return KiotaGenerationLanguage.Ruby; - case "Shell": - return KiotaGenerationLanguage.Shell; + case "CLI": + return KiotaGenerationLanguage.CLI; default: throw new Error("unknown language"); } @@ -143,7 +143,7 @@ export const allGenerationLanguages = [ KiotaGenerationLanguage.PHP, KiotaGenerationLanguage.Python, KiotaGenerationLanguage.Ruby, - KiotaGenerationLanguage.Shell, + KiotaGenerationLanguage.CLI, KiotaGenerationLanguage.Swift, KiotaGenerationLanguage.TypeScript, ];