File tree Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Text ;
4
+ using System . Threading . Tasks ;
5
+ using GitLabApiClient . Internal . Http ;
6
+ using GitLabApiClient . Models . Markdown . Request ;
7
+ using GitLabApiClient . Models . Markdown . Response ;
8
+
9
+ namespace GitLabApiClient
10
+ {
11
+ /// <summary>
12
+ /// Used to render a markdown document.
13
+ /// </summary>
14
+ public sealed class MarkdownClient
15
+ {
16
+ private readonly GitLabHttpFacade _httpFacade ;
17
+
18
+ internal MarkdownClient ( GitLabHttpFacade httpFacade ) =>
19
+ _httpFacade = httpFacade ;
20
+
21
+ public async Task < Markdown > RenderAsync ( RenderMarkdownRequest request ) =>
22
+ await _httpFacade . Post < Markdown > ( $ "api/v4/markdown", request ) ;
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Text ;
4
+ using GitLabApiClient . Internal . Utilities ;
5
+ using Newtonsoft . Json ;
6
+
7
+ namespace GitLabApiClient . Models . Markdown . Request
8
+ {
9
+ /// <summary>
10
+ /// Used to render a markdown document
11
+ /// </summary>
12
+ public sealed class RenderMarkdownRequest
13
+ {
14
+ /// <summary>
15
+ /// The markdown text to render
16
+ /// </summary>
17
+ [ JsonProperty ( "text" ) ]
18
+ public string Text { get ; set ; }
19
+
20
+ /// <summary>
21
+ /// Render text using GitLab Flavored Markdown
22
+ /// </summary>
23
+ [ JsonProperty ( "gfm" ) ]
24
+ public bool ? FlavoredMarkdown { get ; set ; } = false ;
25
+
26
+ /// <summary>
27
+ /// Use as a context when creating references using GitLab Flavored Markdown. Authentication is required if a project is not public.
28
+ /// </summary>
29
+ [ JsonProperty ( "project" ) ]
30
+ public string Project { get ; set ; }
31
+
32
+ public RenderMarkdownRequest ( string text )
33
+ {
34
+ Guard . NotEmpty ( text , nameof ( text ) ) ;
35
+ Text = text ;
36
+ }
37
+ }
38
+ }
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Text ;
4
+ using Newtonsoft . Json ;
5
+
6
+ namespace GitLabApiClient . Models . Markdown . Response
7
+ {
8
+ public sealed class Markdown
9
+ {
10
+ [ JsonProperty ( "html" ) ]
11
+ public string Html { get ; set ; }
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments