|
1 |
| -using System.Linq; |
| 1 | +using System; |
| 2 | +using System.Linq; |
2 | 3 | using KY.Generator.Angular.Commands;
|
3 | 4 |
|
4 | 5 | namespace KY.Generator.Angular.Fluent
|
5 | 6 | {
|
6 |
| - internal class AngularServiceSyntax : IAngularServiceSyntax |
| 7 | + internal class AngularServiceSyntax : IAngularServiceSyntax, IAngularHttpClientSyntax |
7 | 8 | {
|
8 | 9 | private readonly AngularWriteSyntax syntax;
|
9 | 10 | private readonly AngularServiceCommand command;
|
@@ -44,5 +45,47 @@ public IAngularServiceSyntax Name(string name)
|
44 | 45 | this.command.Parameters.Name = name;
|
45 | 46 | return this;
|
46 | 47 | }
|
| 48 | + |
| 49 | + public IAngularHttpClientSyntax HttpClient(string type, string import) |
| 50 | + { |
| 51 | + this.command.Parameters.HttpClient = type; |
| 52 | + this.command.Parameters.HttpClientUsing = import; |
| 53 | + return this; |
| 54 | + } |
| 55 | + |
| 56 | + public IAngularHttpClientSyntax GetMethod(string name, Action<IAngularHttpClientMethodSyntax> optionsAction = null) |
| 57 | + { |
| 58 | + this.command.Parameters.HttpClientGet = name; |
| 59 | + optionsAction?.Invoke(new AngularHttpClientSyntax(this.command.Parameters.HttpClientGetOptions)); |
| 60 | + return this; |
| 61 | + } |
| 62 | + |
| 63 | + public IAngularHttpClientSyntax PostMethod(string name, Action<IAngularHttpClientMethodSyntax> optionsAction = null) |
| 64 | + { |
| 65 | + this.command.Parameters.HttpClientPost = name; |
| 66 | + optionsAction?.Invoke(new AngularHttpClientSyntax(this.command.Parameters.HttpClientPostOptions)); |
| 67 | + return this; |
| 68 | + } |
| 69 | + |
| 70 | + public IAngularHttpClientSyntax PutMethod(string name, Action<IAngularHttpClientMethodSyntax> optionsAction = null) |
| 71 | + { |
| 72 | + this.command.Parameters.HttpClientPut = name; |
| 73 | + optionsAction?.Invoke(new AngularHttpClientSyntax(this.command.Parameters.HttpClientPutOptions)); |
| 74 | + return this; |
| 75 | + } |
| 76 | + |
| 77 | + public IAngularHttpClientSyntax PatchMethod(string name, Action<IAngularHttpClientMethodSyntax> optionsAction = null) |
| 78 | + { |
| 79 | + this.command.Parameters.HttpClientPatch = name; |
| 80 | + optionsAction?.Invoke(new AngularHttpClientSyntax(this.command.Parameters.HttpClientPatchOptions)); |
| 81 | + return this; |
| 82 | + } |
| 83 | + |
| 84 | + public IAngularHttpClientSyntax DeleteMethod(string name, Action<IAngularHttpClientMethodSyntax> optionsAction = null) |
| 85 | + { |
| 86 | + this.command.Parameters.HttpClientDelete = name; |
| 87 | + optionsAction?.Invoke(new AngularHttpClientSyntax(this.command.Parameters.HttpClientDeleteOptions)); |
| 88 | + return this; |
| 89 | + } |
47 | 90 | }
|
48 | 91 | }
|
0 commit comments