44using System ;
55using System . Collections . Generic ;
66using System . Linq ;
7+ using System . Net ;
78using ZendeskApi_v2 . Extensions ;
89using ZendeskApi_v2 . Models . Organizations ;
910using ZendeskApi_v2 . Models . Shared ;
@@ -33,11 +34,14 @@ public interface IOrganizations : ICore
3334 /// <returns></returns>
3435 GroupOrganizationResponse GetMultipleOrganizationsByExternalIds ( IEnumerable < string > externalIds ) ;
3536 IndividualOrganizationResponse CreateOrganization ( Organization organization ) ;
37+ JobStatusResponse CreateMultipleOrganizations ( IEnumerable < Organization > organizations ) ;
3638 IndividualOrganizationResponse CreateOrUpdateOrganization ( Organization organization ) ;
3739
3840 IndividualOrganizationResponse UpdateOrganization ( Organization organization ) ;
3941 JobStatusResponse UpdateMultipleOrganizations ( IEnumerable < Organization > organizations ) ;
4042 bool DeleteOrganization ( long id ) ;
43+ JobStatusResponse DeleteMultipleOrganizations ( IEnumerable < long > ids ) ;
44+ JobStatusResponse DeleteMultipleOrganizationsByExternalIds ( IEnumerable < string > externalIds ) ;
4145
4246 GroupOrganizationMembershipResponse GetOrganizationMemberships ( int ? perPage = null , int ? page = null ) ;
4347 GroupOrganizationMembershipResponse GetOrganizationMembershipsByUserId ( long userId , int ? perPage = null , int ? page = null ) ;
@@ -77,10 +81,13 @@ public interface IOrganizations : ICore
7781 /// <returns></returns>
7882 Task < GroupOrganizationResponse > GetMultipleOrganizationsByExternalIdsAsync ( IEnumerable < string > externalIds ) ;
7983 Task < IndividualOrganizationResponse > CreateOrganizationAsync ( Organization organization ) ;
84+ Task < JobStatusResponse > CreateMultipleOrganizationsAsync ( IEnumerable < Organization > organizations ) ;
8085 Task < IndividualOrganizationResponse > CreateOrUpdateOrganizationAsync ( Organization organization ) ;
8186 Task < IndividualOrganizationResponse > UpdateOrganizationAsync ( Organization organization ) ;
8287 Task < JobStatusResponse > UpdateMultipleOrganizationsAsync ( IEnumerable < Organization > organizations ) ;
8388 Task < bool > DeleteOrganizationAsync ( long id ) ;
89+ Task < JobStatusResponse > DeleteMultipleOrganizationsAsync ( IEnumerable < long > ids ) ;
90+ Task < JobStatusResponse > DeleteMultipleOrganizationsByExternalIdsAsync ( IEnumerable < string > externalIds ) ;
8491
8592 Task < GroupOrganizationMembershipResponse > GetOrganizationMembershipsAsync ( int ? perPage = null , int ? page = null ) ;
8693 Task < GroupOrganizationMembershipResponse > GetOrganizationMembershipsByUserIdAsync ( long userId , int ? perPage = null , int ? page = null ) ;
@@ -151,6 +158,11 @@ public IndividualOrganizationResponse CreateOrganization(Organization organizati
151158 return GenericPost < IndividualOrganizationResponse > ( "organizations.json" , body ) ;
152159 }
153160
161+ public JobStatusResponse CreateMultipleOrganizations ( IEnumerable < Organization > organizations )
162+ {
163+ return GenericPost < JobStatusResponse > ( "organizations/create_many.json" , new { organizations } ) ;
164+ }
165+
154166 public IndividualOrganizationResponse CreateOrUpdateOrganization ( Organization organization )
155167 {
156168 var body = new { organization } ;
@@ -173,6 +185,17 @@ public bool DeleteOrganization(long id)
173185 return GenericDelete ( $ "organizations/{ id } .json") ;
174186 }
175187
188+ public JobStatusResponse DeleteMultipleOrganizations ( IEnumerable < long > ids )
189+ {
190+ return GenericDelete < JobStatusResponse > ( $ "organizations/destroy_many.json?ids={ string . Join ( "," , ids ) } ") ;
191+ }
192+
193+ public JobStatusResponse DeleteMultipleOrganizationsByExternalIds ( IEnumerable < string > externalIds )
194+ {
195+ var encodedIds = WebUtility . UrlEncode ( string . Join ( "," , externalIds ) ) ;
196+ return GenericDelete < JobStatusResponse > ( $ "organizations/destroy_many.json?external_ids={ encodedIds } ") ;
197+ }
198+
176199 public GroupOrganizationMembershipResponse GetOrganizationMemberships ( int ? perPage = null , int ? page = null )
177200 {
178201 return GenericPagedGet < GroupOrganizationMembershipResponse > ( "organization_memberships.json" , perPage , page ) ;
@@ -276,6 +299,11 @@ public async Task<IndividualOrganizationResponse> GetOrganizationAsync(long id)
276299 return await GenericGetAsync < IndividualOrganizationResponse > ( $ "organizations/{ id } .json") ;
277300 }
278301
302+ public async Task < JobStatusResponse > CreateMultipleOrganizationsAsync ( IEnumerable < Organization > organizations )
303+ {
304+ return await GenericPostAsync < JobStatusResponse > ( "organizations/create_many.json" , new { organizations } ) ;
305+ }
306+
279307 public async Task < GroupOrganizationResponse > GetMultipleOrganizationsAsync ( IEnumerable < long > ids )
280308 {
281309 return await GenericGetAsync < GroupOrganizationResponse > ( $ "organizations/show_many.json?ids={ ids . ToCsv ( ) } ") ;
@@ -311,6 +339,17 @@ public async Task<bool> DeleteOrganizationAsync(long id)
311339 return await GenericDeleteAsync ( $ "organizations/{ id } .json") ;
312340 }
313341
342+ public async Task < JobStatusResponse > DeleteMultipleOrganizationsAsync ( IEnumerable < long > ids )
343+ {
344+ return await GenericDeleteAsync < JobStatusResponse > ( $ "organizations/destroy_many.json?ids={ string . Join ( "," , ids ) } ") ;
345+ }
346+
347+ public async Task < JobStatusResponse > DeleteMultipleOrganizationsByExternalIdsAsync ( IEnumerable < string > externalIds )
348+ {
349+ var encodedIds = WebUtility . UrlEncode ( string . Join ( "," , externalIds ) ) ;
350+ return await GenericDeleteAsync < JobStatusResponse > ( $ "organizations/destroy_many.json?external_ids={ encodedIds } ") ;
351+ }
352+
314353 public async Task < GroupOrganizationMembershipResponse > GetOrganizationMembershipsAsync ( int ? perPage = null , int ? page = null )
315354 {
316355 return await GenericPagedGetAsync < GroupOrganizationMembershipResponse > ( "organization_memberships.json" , perPage , page ) ;
0 commit comments