-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from box/bulk-groups
Bulk groups
- Loading branch information
Showing
13 changed files
with
485 additions
and
32 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
BoxCLI/CommandUtilities/CsvModels/BoxGroupMembershipMap.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using Box.V2.Models; | ||
using CsvHelper.Configuration; | ||
|
||
namespace BoxCLI.CommandUtilities.CsvModels | ||
{ | ||
public class BoxGroupMembershipMap : CsvClassMap<BoxGroupMembership> | ||
{ | ||
public BoxGroupMembershipMap() | ||
{ | ||
Map(m => m.Id); | ||
References<BoxUserOnObjectMap>(m => m.User); | ||
References<BoxGroupMap>(m => m.Group); | ||
Map(m => m.CreatedAt); | ||
Map(m => m.ModifiedAt); | ||
Map(m => m.Role); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
BoxCLI/CommandUtilities/CsvModels/BoxGroupMembershipRequestMap.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using Box.V2.Models; | ||
using Box.V2.Models.Request; | ||
using CsvHelper.Configuration; | ||
|
||
namespace BoxCLI.CommandUtilities.CsvModels | ||
{ | ||
public class BoxGroupMembershipRequestMap : CsvClassMap<BoxGroupMembershipRequest> | ||
{ | ||
public BoxGroupMembershipRequestMap() | ||
{ | ||
Map(m => m.Role); | ||
Map(m => m.User).ConvertUsing<BoxRequestEntity>(row => | ||
{ | ||
var field = row.GetField("BoxUserId"); | ||
if (string.IsNullOrEmpty(field)) | ||
{ | ||
return null; | ||
} | ||
else | ||
{ | ||
return new BoxRequestEntity() | ||
{ | ||
Id = field | ||
}; | ||
} | ||
}); | ||
Map(m => m.Group).ConvertUsing<BoxGroupRequest>(row => | ||
{ | ||
var field = row.GetField("BoxGroupId"); | ||
if (string.IsNullOrEmpty(field)) | ||
{ | ||
return null; | ||
} | ||
else | ||
{ | ||
return new BoxGroupRequest() | ||
{ | ||
Id = field | ||
}; | ||
} | ||
}); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
BoxCLI/CommandUtilities/CsvModels/BoxGroupMembershipUpdateRequestMap.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using Box.V2.Models; | ||
using Box.V2.Models.Request; | ||
using CsvHelper.Configuration; | ||
|
||
namespace BoxCLI.CommandUtilities.CsvModels | ||
{ | ||
public class BoxGroupMembershipUpdateRequestMap : CsvClassMap<BoxGroupMembership> | ||
{ | ||
public BoxGroupMembershipUpdateRequestMap() | ||
{ | ||
Map(m => m.Id); | ||
Map(m => m.Role); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
BoxCLI/CommandUtilities/CsvModels/BoxGroupUpdateRequestMap.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using Box.V2.Models.Request; | ||
using CsvHelper.Configuration; | ||
|
||
namespace BoxCLI.CommandUtilities.CsvModels | ||
{ | ||
public class BoxGroupUpdateRequestMap : CsvClassMap<BoxGroupRequest> | ||
{ | ||
public BoxGroupUpdateRequestMap() | ||
{ | ||
Map(m => m.Id); | ||
Map(m => m.Name).Default(""); | ||
Map(m => m.InvitabilityLevel).Default(""); | ||
Map(m => m.MemberViewabilityLevel).Default(""); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.