@@ -7,20 +7,20 @@ namespace StarFederation.Datastar.DependencyInjection;
77
88public interface IDatastarService
99{
10- Task StartServerEventStreamAsync ( IEnumerable < KeyValuePair < string , StringValues > > additionalHeaders ) ;
11- Task StartServerEventStreamAsync ( IEnumerable < KeyValuePair < string , string > > additionalHeaders ) ;
10+ Task StartServerEventStreamAsync ( IEnumerable < KeyValuePair < string , StringValues > > ? additionalHeaders = null ) ;
11+ Task StartServerEventStreamAsync ( IEnumerable < KeyValuePair < string , string > > ? additionalHeaders = null ) ;
1212
1313 Task PatchElementsAsync ( string fragments , PatchElementsOptions ? options = null ) ;
1414
15- Task RemoveElementAsync ( string selector , RemoveFragmentOptions ? options = null ) ;
15+ Task RemoveElementAsync ( string selector , RemoveElementOptions ? options = null ) ;
1616
1717 /// <summary>
1818 /// Note: If TType is string then it is assumed that it is an already serialized Signals, otherwise serialize with jsonSerializerOptions
1919 /// </summary>
2020 Task PatchSignalsAsync < TType > ( TType signals , JsonSerializerOptions ? jsonSerializerOptions = null , PatchSignalsOptions ? patchSignalsOptions = null ) ;
2121
2222 /// <summary>
23- /// Execute a JS script on the client. Note: Do NOT include "<script>" encapsulation
23+ /// Execute a JS script on the client. Note: Do NOT include "<script>" encapsulation
2424 /// </summary>
2525 Task ExecuteScriptAsync ( string script , ExecuteScriptOptions ? options = null ) ;
2626
@@ -44,23 +44,23 @@ public interface IDatastarService
4444
4545internal class DatastarService ( Core . ServerSentEventGenerator serverSentEventGenerator ) : IDatastarService
4646{
47- public Task StartServerEventStreamAsync ( IEnumerable < KeyValuePair < string , StringValues > > additionalHeaders ) =>
47+ public Task StartServerEventStreamAsync ( IEnumerable < KeyValuePair < string , StringValues > > ? additionalHeaders ) =>
4848 serverSentEventGenerator . StartServerEventStreamAsync ( additionalHeaders ?? [ ] ) ;
4949
50- public Task StartServerEventStreamAsync ( IEnumerable < KeyValuePair < string , string > > additionalHeaders ) =>
50+ public Task StartServerEventStreamAsync ( IEnumerable < KeyValuePair < string , string > > ? additionalHeaders ) =>
5151 serverSentEventGenerator . StartServerEventStreamAsync ( additionalHeaders ? . Select ( kvp => new KeyValuePair < string , StringValues > ( kvp . Key , new StringValues ( kvp . Value ) ) ) ?? [ ] ) ;
5252
5353 public Task PatchElementsAsync ( string fragments , PatchElementsOptions ? options = null ) =>
54- serverSentEventGenerator . PatchElementsAsync ( fragments , options ?? new ( ) ) ;
54+ serverSentEventGenerator . PatchElementsAsync ( fragments , options ?? Core . PatchElementsOptions . Defaults ) ;
5555
56- public Task RemoveElementAsync ( string selector , RemoveFragmentOptions ? options = null ) =>
57- serverSentEventGenerator . RemoveElementAsync ( selector , options ?? new ( ) ) ;
56+ public Task RemoveElementAsync ( string selector , RemoveElementOptions ? options = null ) =>
57+ serverSentEventGenerator . RemoveElementAsync ( selector , options ?? Core . RemoveElementOptions . Defaults ) ;
5858
5959 public Task PatchSignalsAsync < TType > ( TType signals , JsonSerializerOptions ? jsonSerializerOptions = null , PatchSignalsOptions ? patchSignalsOptions = null ) =>
60- serverSentEventGenerator . PatchSignalsAsync ( signals as string ?? JsonSerializer . Serialize ( signals , jsonSerializerOptions ) , patchSignalsOptions ?? new ( ) ) ;
60+ serverSentEventGenerator . PatchSignalsAsync ( signals as string ?? JsonSerializer . Serialize ( signals , jsonSerializerOptions ) , patchSignalsOptions ?? Core . PatchSignalsOptions . Defaults ) ;
6161
6262 public Task ExecuteScriptAsync ( string script , ExecuteScriptOptions ? options = null ) =>
63- serverSentEventGenerator . ExecuteScriptAsync ( script , options ?? new ( ) ) ;
63+ serverSentEventGenerator . ExecuteScriptAsync ( script , options ?? Core . ExecuteScriptOptions . Defaults ) ;
6464
6565 public Stream GetSignalsStream ( ) => serverSentEventGenerator . GetSignalsStream ( ) ;
6666
0 commit comments