1212using Certify . Models . Hub ;
1313using Certify . Models . Config . Migration ;
1414using Certify . Shared ;
15- using FileResult = Microsoft . AspNetCore . Mvc . FileResult ;
1615
1716#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
1817#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
@@ -4582,15 +4581,15 @@ public virtual async System.Threading.Tasks.Task<ActionResult> RemoveManagedChal
45824581
45834582 /// <returns>OK</returns>
45844583 /// <exception cref="ApiException">A server side error occurred.</exception>
4585- public virtual System . Threading . Tasks . Task < FileResponse > GetPreviewAsMarkdownAsync ( ManagedCertificate body )
4584+ public virtual System . Threading . Tasks . Task < string > GetPreviewAsMarkdownAsync ( ManagedCertificate body )
45864585 {
45874586 return GetPreviewAsMarkdownAsync ( body , System . Threading . CancellationToken . None ) ;
45884587 }
45894588
45904589 /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
45914590 /// <returns>OK</returns>
45924591 /// <exception cref="ApiException">A server side error occurred.</exception>
4593- public virtual async System . Threading . Tasks . Task < FileResponse > GetPreviewAsMarkdownAsync ( ManagedCertificate body , System . Threading . CancellationToken cancellationToken )
4592+ public virtual async System . Threading . Tasks . Task < string > GetPreviewAsMarkdownAsync ( ManagedCertificate body , System . Threading . CancellationToken cancellationToken )
45944593 {
45954594 var client_ = _httpClient ;
45964595 var disposeClient_ = false ;
@@ -4603,7 +4602,7 @@ public virtual async System.Threading.Tasks.Task<FileResponse> GetPreviewAsMarkd
46034602 content_ . Headers . ContentType = System . Net . Http . Headers . MediaTypeHeaderValue . Parse ( "application/json" ) ;
46044603 request_ . Content = content_ ;
46054604 request_ . Method = new System . Net . Http . HttpMethod ( "POST" ) ;
4606- request_ . Headers . Accept . Add ( System . Net . Http . Headers . MediaTypeWithQualityHeaderValue . Parse ( "text/html " ) ) ;
4605+ request_ . Headers . Accept . Add ( System . Net . Http . Headers . MediaTypeWithQualityHeaderValue . Parse ( "text/plain " ) ) ;
46074606
46084607 var urlBuilder_ = new System . Text . StringBuilder ( ) ;
46094608 if ( ! string . IsNullOrEmpty ( _baseUrl ) ) urlBuilder_ . Append ( _baseUrl ) ;
@@ -4633,12 +4632,11 @@ public virtual async System.Threading.Tasks.Task<FileResponse> GetPreviewAsMarkd
46334632 ProcessResponse ( client_ , response_ ) ;
46344633
46354634 var status_ = ( int ) response_ . StatusCode ;
4636- if ( status_ == 200 || status_ == 206 )
4635+ if ( status_ == 200 )
46374636 {
4638- var responseStream_ = response_ . Content == null ? System . IO . Stream . Null : await response_ . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) ;
4639- var fileResponse_ = new FileResponse ( status_ , headers_ , responseStream_ , null , response_ ) ;
4640- disposeClient_ = false ; disposeResponse_ = false ; // response and client are disposed by FileResponse
4641- return fileResponse_ ;
4637+ var responseData_ = response_ . Content == null ? null : await response_ . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
4638+ var result_ = ( string ) System . Convert . ChangeType ( responseData_ , typeof ( string ) ) ;
4639+ return result_ ;
46424640 }
46434641 else
46444642 {
@@ -4662,15 +4660,15 @@ public virtual async System.Threading.Tasks.Task<FileResponse> GetPreviewAsMarkd
46624660
46634661 /// <returns>OK</returns>
46644662 /// <exception cref="ApiException">A server side error occurred.</exception>
4665- public virtual System . Threading . Tasks . Task < FileResponse > RenderMarkdownAsync ( string body )
4663+ public virtual System . Threading . Tasks . Task < string > RenderMarkdownAsync ( string body )
46664664 {
46674665 return RenderMarkdownAsync ( body , System . Threading . CancellationToken . None ) ;
46684666 }
46694667
46704668 /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
46714669 /// <returns>OK</returns>
46724670 /// <exception cref="ApiException">A server side error occurred.</exception>
4673- public virtual async System . Threading . Tasks . Task < FileResponse > RenderMarkdownAsync ( string body , System . Threading . CancellationToken cancellationToken )
4671+ public virtual async System . Threading . Tasks . Task < string > RenderMarkdownAsync ( string body , System . Threading . CancellationToken cancellationToken )
46744672 {
46754673 var client_ = _httpClient ;
46764674 var disposeClient_ = false ;
@@ -4713,12 +4711,14 @@ public virtual async System.Threading.Tasks.Task<FileResponse> RenderMarkdownAsy
47134711 ProcessResponse ( client_ , response_ ) ;
47144712
47154713 var status_ = ( int ) response_ . StatusCode ;
4716- if ( status_ == 200 || status_ == 206 )
4714+ if ( status_ == 200 )
47174715 {
4718- var responseStream_ = response_ . Content == null ? System . IO . Stream . Null : await response_ . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) ;
4719- var fileResponse_ = new FileResponse ( status_ , headers_ , responseStream_ , null , response_ ) ;
4720- disposeClient_ = false ; disposeResponse_ = false ; // response and client are disposed by FileResponse
4721- return fileResponse_ ;
4716+ var objectResponse_ = await ReadObjectResponseAsync < string > ( response_ , headers_ , cancellationToken ) . ConfigureAwait ( false ) ;
4717+ if ( objectResponse_ . Object == null )
4718+ {
4719+ throw new ApiException ( "Response was null which was not expected." , status_ , objectResponse_ . Text , headers_ , null ) ;
4720+ }
4721+ return objectResponse_ . Object ;
47224722 }
47234723 else
47244724 {
0 commit comments