@@ -71,7 +71,6 @@ public class AddAdditionalDataUri : Uri
71
71
public AddAdditionalDataUri ( Link link )
72
72
: base ( link . Uri , UriKind . Absolute )
73
73
{
74
-
75
74
}
76
75
}
77
76
@@ -144,20 +143,41 @@ public ArchiveNextDocumentsUri(Link link)
144
143
}
145
144
146
145
public ArchiveNextDocumentsUri ( Link link , Dictionary < string , string > searchBy )
147
- : base ( ToUri ( new Uri ( link . Uri , UriKind . Absolute ) , searchBy ) , UriKind . Absolute )
146
+ : base ( ToUri ( new Uri ( link . Uri , UriKind . Absolute ) , searchBy , null , null ) , UriKind . Absolute )
147
+ {
148
+ }
149
+
150
+ public ArchiveNextDocumentsUri ( Link link , DateTime from , DateTime to )
151
+ : base ( ToUri ( new Uri ( link . Uri , UriKind . Absolute ) , new Dictionary < string , string > ( ) , from , to ) , UriKind . Absolute )
152
+ {
153
+ }
154
+
155
+ public ArchiveNextDocumentsUri ( Link link , Dictionary < string , string > searchBy , DateTime from , DateTime to )
156
+ : base ( ToUri ( new Uri ( link . Uri , UriKind . Absolute ) , searchBy , from , to ) , UriKind . Absolute )
148
157
{
158
+
149
159
}
150
160
151
- private static string ToUri ( Uri nextDocumentsUri , Dictionary < string , string > searchBy )
161
+ internal static string ToUri ( Uri nextDocumentsUri , Dictionary < string , string > searchBy , DateTime ? from , DateTime ? to )
152
162
{
153
163
var query = HttpUtility . ParseQueryString ( nextDocumentsUri . Query ) ;
154
- var commaSeparated = string . Join ( "," , searchBy . Select ( x => x . Key + "," + x . Value ) . ToArray ( ) ) ;
155
- var base64 = ToBase64String ( Encoding . UTF8 . GetBytes ( commaSeparated ) ) ;
164
+ if ( searchBy . Count > 0 )
165
+ {
166
+ var commaSeparated = string . Join ( "," , searchBy . Select ( x => x . Key + "," + x . Value ) . ToArray ( ) ) ;
167
+ var base64 = ToBase64String ( Encoding . UTF8 . GetBytes ( commaSeparated ) ) ;
168
+
169
+ query [ "attributes" ] = base64 ;
170
+ }
171
+
172
+ if ( from != null && to != null )
173
+ {
174
+ query [ "fromDate" ] = from . Value . ToString ( "o" ) ;
175
+ query [ "toDate" ] = to . Value . ToString ( "o" ) ;
176
+ }
156
177
157
- query [ "attributes" ] = "" ;
158
178
var uriBuilder = new UriBuilder ( nextDocumentsUri )
159
179
{
160
- Query = query + base64
180
+ Query = query . ToString ( )
161
181
} ;
162
182
return uriBuilder . ToString ( ) ;
163
183
}
@@ -200,7 +220,6 @@ public class DocumentEventsUri : Uri
200
220
public DocumentEventsUri ( Link link , Sender sender , DateTime from , DateTime to , int offset , int maxResults )
201
221
: base ( $ "{ link . Uri } ?sender={ sender . Id } &from={ DatetimeFormatter ( from ) } &to={ DatetimeFormatter ( to ) } &offset={ offset } &maxResults={ maxResults } ", UriKind . Absolute )
202
222
{
203
-
204
223
}
205
224
206
225
private static string DatetimeFormatter ( DateTime ? dt )
0 commit comments