Skip to content

Commit

Permalink
Added dart placeholder files
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoboss committed Jan 27, 2024
1 parent 8391409 commit 4cd9ec1
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Kiota.Builder/GenerationLanguage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ public enum GenerationLanguage
Go,
Swift,
Ruby,
CLI
CLI,
Dart,
}
17 changes: 17 additions & 0 deletions src/Kiota.Builder/PathSegmenters/DartPathSegmenter.cs
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();
}
17 changes: 17 additions & 0 deletions src/Kiota.Builder/Writers/Dart/CodeBlockEndWriter.cs
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 src/Kiota.Builder/Writers/Dart/CodeClassDeclarationWriter.cs
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();
}
}
12 changes: 12 additions & 0 deletions src/Kiota.Builder/Writers/Dart/CodeEnumWriter.cs
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();
}
}
12 changes: 12 additions & 0 deletions src/Kiota.Builder/Writers/Dart/CodeIndexerWriter.cs
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();
}
}
19 changes: 19 additions & 0 deletions src/Kiota.Builder/Writers/Dart/CodeMethodWriter.cs
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();
}
}
12 changes: 12 additions & 0 deletions src/Kiota.Builder/Writers/Dart/CodePropertyWriter.cs
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();
}
}
51 changes: 51 additions & 0 deletions src/Kiota.Builder/Writers/Dart/DartConventionService.cs
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;
}
}
19 changes: 19 additions & 0 deletions src/Kiota.Builder/Writers/Dart/DartWriter.cs
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));
}
}
2 changes: 2 additions & 0 deletions src/Kiota.Builder/Writers/LanguageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Kiota.Builder.PathSegmenters;
using Kiota.Builder.Writers.Cli;
using Kiota.Builder.Writers.CSharp;
using Kiota.Builder.Writers.Dart;
using Kiota.Builder.Writers.Go;
using Kiota.Builder.Writers.Java;
using Kiota.Builder.Writers.Php;
Expand Down Expand Up @@ -186,6 +187,7 @@ public static LanguageWriter GetLanguageWriter(GenerationLanguage language, stri
GenerationLanguage.Go => new GoWriter(outputPath, clientNamespaceName, excludeBackwardCompatible),
GenerationLanguage.CLI => new CliWriter(outputPath, clientNamespaceName),
GenerationLanguage.Swift => new SwiftWriter(outputPath, clientNamespaceName),
GenerationLanguage.Dart => new DartWriter(outputPath, clientNamespaceName),
_ => throw new InvalidEnumArgumentException($"{language} language currently not supported."),
};
}
Expand Down

0 comments on commit 4cd9ec1

Please sign in to comment.