forked from microsoft/kiota
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8391409
commit 4cd9ec1
Showing
11 changed files
with
178 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -9,5 +9,6 @@ public enum GenerationLanguage | |
Go, | ||
Swift, | ||
Ruby, | ||
CLI | ||
CLI, | ||
Dart, | ||
} |
This file contains 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,17 @@ | ||
using Kiota.Builder.CodeDOM; | ||
using Kiota.Builder.Extensions; | ||
|
||
namespace Kiota.Builder.PathSegmenters; | ||
|
||
public class DartPathSegmenter : CommonPathSegmenter | ||
{ | ||
public DartPathSegmenter(string rootPath, string clientNamespaceName) : base(rootPath, clientNamespaceName) { } | ||
public override string FileSuffix => ".dart"; | ||
|
||
public override string NormalizeNamespaceSegment(string segmentName) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string NormalizeFileName(CodeElement currentElement) => GetLastFileNameSegment(currentElement).ToCamelCase(); | ||
} |
This file contains 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,17 @@ | ||
using System; | ||
using Kiota.Builder.CodeDOM; | ||
|
||
namespace Kiota.Builder.Writers.Dart; | ||
public class CodeBlockEndWriter : BaseElementWriter<BlockEnd, DartConventionService> | ||
{ | ||
public CodeBlockEndWriter(DartConventionService conventionService) : base(conventionService) { } | ||
public override void WriteCodeElement(BlockEnd codeElement, LanguageWriter writer) | ||
{ | ||
ArgumentNullException.ThrowIfNull(writer); | ||
writer.CloseBlock(); | ||
if (codeElement?.Parent is CodeClass) | ||
{ | ||
writer.CloseBlock(); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Kiota.Builder/Writers/Dart/CodeClassDeclarationWriter.cs
This file contains 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,15 @@ | ||
using Kiota.Builder.CodeDOM; | ||
|
||
namespace Kiota.Builder.Writers.Dart; | ||
|
||
public class CodeClassDeclarationWriter : BaseElementWriter<ClassDeclaration, DartConventionService> | ||
{ | ||
public CodeClassDeclarationWriter(DartConventionService conventionService) : base(conventionService) | ||
{ | ||
} | ||
|
||
public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWriter writer) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
} |
This file contains 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,12 @@ | ||
using System; | ||
using Kiota.Builder.CodeDOM; | ||
|
||
namespace Kiota.Builder.Writers.Dart; | ||
public class CodeEnumWriter : BaseElementWriter<CodeEnum, DartConventionService> | ||
{ | ||
public CodeEnumWriter(DartConventionService conventionService) : base(conventionService) { } | ||
public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter writer) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains 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,12 @@ | ||
using System; | ||
using Kiota.Builder.CodeDOM; | ||
|
||
namespace Kiota.Builder.Writers.Dart; | ||
public class CodeIndexerWriter : BaseElementWriter<CodeIndexer, DartConventionService> | ||
{ | ||
public CodeIndexerWriter(DartConventionService conventionService) : base(conventionService) { } | ||
public override void WriteCodeElement(CodeIndexer codeElement, LanguageWriter writer) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains 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,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Kiota.Builder.CodeDOM; | ||
using Kiota.Builder.Extensions; | ||
using Kiota.Builder.OrderComparers; | ||
|
||
namespace Kiota.Builder.Writers.Dart; | ||
public class CodeMethodWriter : BaseElementWriter<CodeMethod, DartConventionService> | ||
{ | ||
public CodeMethodWriter(DartConventionService conventionService) : base(conventionService) | ||
{ | ||
} | ||
|
||
public override void WriteCodeElement(CodeMethod codeElement, LanguageWriter writer) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains 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,12 @@ | ||
using System; | ||
using Kiota.Builder.CodeDOM; | ||
|
||
namespace Kiota.Builder.Writers.Dart; | ||
public class CodePropertyWriter : BaseElementWriter<CodeProperty, DartConventionService> | ||
{ | ||
public CodePropertyWriter(DartConventionService conventionService) : base(conventionService) { } | ||
public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter writer) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains 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,51 @@ | ||
using Kiota.Builder.CodeDOM; | ||
|
||
namespace Kiota.Builder.Writers.Dart; | ||
|
||
public class DartConventionService : CommonLanguageConventionService | ||
{ | ||
public override string GetAccessModifier(AccessModifier access) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string TranslateType(CodeType type) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override void WriteShortDescription(string description, LanguageWriter writer) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string GetParameterSignature(CodeParameter parameter, CodeElement targetElement, LanguageWriter? writer = null) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string GetTypeString(CodeTypeBase code, CodeElement targetElement, bool includeCollectionInformation = true, | ||
LanguageWriter? writer = null) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string StreamTypeName | ||
{ | ||
get; | ||
} | ||
|
||
public override string VoidTypeName => "void"; | ||
|
||
public override string DocCommentPrefix => "///"; | ||
|
||
public override string ParseNodeInterfaceName | ||
{ | ||
get; | ||
} | ||
|
||
public override string TempDictionaryVarName | ||
{ | ||
get; | ||
} | ||
} |
This file contains 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,19 @@ | ||
using Kiota.Builder.PathSegmenters; | ||
|
||
namespace Kiota.Builder.Writers.Dart; | ||
|
||
public class DartWriter : LanguageWriter | ||
{ | ||
public DartWriter(string outputPath, string clientNamespaceName) | ||
{ | ||
PathSegmenter = new DartPathSegmenter(outputPath, clientNamespaceName); | ||
var conventionService = new DartConventionService(); | ||
AddOrReplaceCodeElementWriter(new CodeClassDeclarationWriter(conventionService)); | ||
AddOrReplaceCodeElementWriter(new CodeBlockEndWriter(conventionService)); | ||
AddOrReplaceCodeElementWriter(new CodeEnumWriter(conventionService)); | ||
AddOrReplaceCodeElementWriter(new CodeIndexerWriter(conventionService)); | ||
AddOrReplaceCodeElementWriter(new CodeMethodWriter(conventionService)); | ||
AddOrReplaceCodeElementWriter(new CodePropertyWriter(conventionService)); | ||
AddOrReplaceCodeElementWriter(new CodeTypeWriter(conventionService)); | ||
} | ||
} |
This file contains 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