@@ -112,6 +112,27 @@ public string CreateEntityFragment<T>(string ownerId = null)
112
112
{
113
113
var type = typeof ( T ) ;
114
114
115
+ return CreateEntityFragment ( type , ownerId ) ;
116
+ }
117
+ public string CreateEntityFragment < T > ( RequestOptions requestOptions )
118
+ {
119
+ var type = typeof ( T ) ;
120
+
121
+ return CreateEntityFragment ( type , requestOptions ) ;
122
+ }
123
+ internal string CreateEntityFragment ( Type type , RequestOptions requestOptions )
124
+ {
125
+ string ownerId = null ;
126
+ if ( requestOptions is { QueryString : not null } )
127
+ {
128
+ ownerId = requestOptions . QueryString . Get ( RedmineKeys . PROJECT_ID ) ??
129
+ requestOptions . QueryString . Get ( RedmineKeys . ISSUE_ID ) ;
130
+ }
131
+
132
+ return CreateEntityFragment ( type , ownerId ) ;
133
+ }
134
+ internal string CreateEntityFragment ( Type type , string ownerId = null )
135
+ {
115
136
if ( type == typeof ( Version ) || type == typeof ( IssueCategory ) || type == typeof ( ProjectMembership ) )
116
137
{
117
138
return ProjectParentFragment ( ownerId , TypeUrlFragments [ type ] ) ;
@@ -129,7 +150,7 @@ public string CreateEntityFragment<T>(string ownerId = null)
129
150
130
151
if ( type == typeof ( Upload ) )
131
152
{
132
- return RedmineKeys . UPLOADS ;
153
+ return $ " { RedmineKeys . UPLOADS } . { Format } " ;
133
154
}
134
155
135
156
if ( type == typeof ( Attachment ) || type == typeof ( Attachments ) )
@@ -144,13 +165,21 @@ public string CreateEntityFragment<T>(string ownerId = null)
144
165
{
145
166
var type = typeof ( T ) ;
146
167
168
+ return GetFragment ( type , id ) ;
169
+ }
170
+ internal string GetFragment ( Type type , string id )
171
+ {
147
172
return $ "{ TypeFragment ( TypeUrlFragments , type ) } /{ id } .{ Format } ";
148
173
}
149
174
150
175
public string PatchFragment < T > ( string ownerId )
151
176
{
152
177
var type = typeof ( T ) ;
153
178
179
+ return PatchFragment ( type , ownerId ) ;
180
+ }
181
+ internal string PatchFragment ( Type type , string ownerId )
182
+ {
154
183
if ( type == typeof ( Attachment ) || type == typeof ( Attachments ) )
155
184
{
156
185
return IssueAttachmentFragment ( ownerId ) ;
@@ -163,13 +192,21 @@ public string DeleteFragment<T>(string id)
163
192
{
164
193
var type = typeof ( T ) ;
165
194
195
+ return DeleteFragment ( type , id ) ;
196
+ }
197
+ internal string DeleteFragment ( Type type , string id )
198
+ {
166
199
return $ "{ TypeFragment ( TypeUrlFragments , type ) } /{ id } .{ Format } ";
167
200
}
168
201
169
202
public string UpdateFragment < T > ( string id )
170
203
{
171
204
var type = typeof ( T ) ;
172
205
206
+ return UpdateFragment ( type , id ) ;
207
+ }
208
+ internal string UpdateFragment ( Type type , string id )
209
+ {
173
210
return $ "{ TypeFragment ( TypeUrlFragments , type ) } /{ id } .{ Format } ";
174
211
}
175
212
@@ -179,8 +216,27 @@ public string UpdateFragment<T>(string id)
179
216
180
217
return GetListFragment ( type , ownerId ) ;
181
218
}
219
+
220
+ public string GetListFragment < T > ( RequestOptions requestOptions ) where T : class , new ( )
221
+ {
222
+ var type = typeof ( T ) ;
223
+
224
+ return GetListFragment ( type , requestOptions ) ;
225
+ }
226
+
227
+ internal string GetListFragment ( Type type , RequestOptions requestOptions )
228
+ {
229
+ string ownerId = null ;
230
+ if ( requestOptions is { QueryString : not null } )
231
+ {
232
+ ownerId = requestOptions . QueryString . Get ( RedmineKeys . PROJECT_ID ) ??
233
+ requestOptions . QueryString . Get ( RedmineKeys . ISSUE_ID ) ;
234
+ }
235
+
236
+ return GetListFragment ( type , ownerId ) ;
237
+ }
182
238
183
- public string GetListFragment ( Type type , string ownerId = null )
239
+ internal string GetListFragment ( Type type , string ownerId = null )
184
240
{
185
241
if ( type == typeof ( Version ) || type == typeof ( IssueCategory ) || type == typeof ( ProjectMembership ) )
186
242
{
0 commit comments