Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#389 virtual model properties for mocking accessibility #603

Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Box.V2/Box.V2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<Compile Include="Auth\Token\ActorTokenBuilder.cs" />
<Compile Include="Auth\Token\TokenExchange.cs" />
<Compile Include="BoxClient.cs" />
<Compile Include="IBoxClient.cs" />
<Compile Include="Converter\BoxZipConflictConverter.cs" />
<Compile Include="JWTAuth\BoxJWTAuth.cs" />
<Compile Include="Converter\BoxItemConverter.cs" />
Expand All @@ -87,6 +88,28 @@
<Compile Include="Managers\BoxLegalHoldPoliciesManager.cs" />
<Compile Include="Managers\BoxRecentItemsManager.cs" />
<Compile Include="Managers\BoxWebLinksManager.cs" />
<Compile Include="Managers\IBoxCollaborationsManager.cs" />
<Compile Include="Managers\IBoxCollaborationWhitelistManager.cs" />
<Compile Include="Managers\IBoxCollectionsManager.cs" />
<Compile Include="Managers\IBoxCommentsManager.cs" />
<Compile Include="Managers\IBoxDevicePinManager.cs" />
<Compile Include="Managers\IBoxEventsManager.cs" />
<Compile Include="Managers\IBoxFilesManager.cs" />
<Compile Include="Managers\IBoxFoldersManager.cs" />
<Compile Include="Managers\IBoxGroupsManager.cs" />
<Compile Include="Managers\IBoxLegalHoldPoliciesManager.cs" />
<Compile Include="Managers\IBoxMetadataCascadePolicyManager.cs" />
<Compile Include="Managers\IBoxMetadataManager.cs" />
<Compile Include="Managers\IBoxRecentItemsManager.cs" />
<Compile Include="Managers\IBoxRetentionPoliciesManager.cs" />
<Compile Include="Managers\IBoxSearchManager.cs" />
<Compile Include="Managers\IBoxSharedItemsManager.cs" />
<Compile Include="Managers\IBoxStoragePoliciesManager.cs" />
<Compile Include="Managers\IBoxTasksManager.cs" />
<Compile Include="Managers\IBoxTermsOfServiceManager.cs" />
<Compile Include="Managers\IBoxUsersManager.cs" />
<Compile Include="Managers\IBoxWebhooksManager.cs" />
<Compile Include="Managers\IBoxWebLinksManager.cs" />
<Compile Include="Models\BoxApplication.cs" />
<Compile Include="Models\BoxAssignmentCounts.cs" />
<Compile Include="Models\BoxClassification.cs" />
Expand Down
50 changes: 25 additions & 25 deletions Box.V2/BoxClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Box.V2.Auth;
using Box.V2.Auth;
using Box.V2.Config;
using Box.V2.Converter;
using Box.V2.Managers;
Expand All @@ -13,7 +13,7 @@ namespace Box.V2
/// The central entrypoint for all SDK interaction. The BoxClient houses all of the API endpoints and are represented
/// as resource managers for each distinct endpoint
/// </summary>
public class BoxClient
public class BoxClient : IBoxClient
{
protected readonly IBoxService _service;
protected readonly IBoxConverter _converter;
Expand Down Expand Up @@ -147,7 +147,7 @@ private void InitManagers()
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public BoxClient AddResourcePlugin<T>() where T : BoxResourceManager
public IBoxClient AddResourcePlugin<T>() where T : BoxResourceManager
{
ResourcePlugins.Register<T>(() => (T)Activator.CreateInstance(typeof(T), Config, _service, _converter, Auth, _asUser, _suppressNotifications));
return this;
Expand All @@ -161,72 +161,72 @@ public BoxClient AddResourcePlugin<T>() where T : BoxResourceManager
/// <summary>
/// The manager that represents the files endpoint
/// </summary>
public BoxFilesManager FilesManager { get; private set; }
public IBoxFilesManager FilesManager { get; private set; }

/// <summary>
/// The manager that represents the folders endpoint
/// </summary>
public BoxFoldersManager FoldersManager { get; private set; }
public IBoxFoldersManager FoldersManager { get; private set; }

/// <summary>
/// The manager that represents the comments endpoint
/// </summary>
public BoxCommentsManager CommentsManager { get; private set; }
public IBoxCommentsManager CommentsManager { get; private set; }

/// <summary>
/// The manager that represents the collaboration endpoint
/// </summary>
public BoxCollaborationsManager CollaborationsManager { get; private set; }
public IBoxCollaborationsManager CollaborationsManager { get; private set; }

/// <summary>
/// The manager that represents the search endpoint
/// </summary>
public BoxSearchManager SearchManager { get; private set; }
public IBoxSearchManager SearchManager { get; private set; }

/// <summary>
/// The manager that represents the events endpoint
/// </summary>
public BoxEventsManager EventsManager { get; private set; }
public IBoxEventsManager EventsManager { get; private set; }

/// <summary>
/// The manager that represents the users endpoint
/// </summary>
public BoxUsersManager UsersManager { get; private set; }
public IBoxUsersManager UsersManager { get; private set; }

/// <summary>
/// The manager that represents the groups endpoint
/// </summary>
public BoxGroupsManager GroupsManager { get; private set; }
public IBoxGroupsManager GroupsManager { get; private set; }

/// <summary>
/// The manager that represents the retention policies endpoint
/// </summary>
public BoxRetentionPoliciesManager RetentionPoliciesManager { get; private set; }
public IBoxRetentionPoliciesManager RetentionPoliciesManager { get; private set; }

/// <summary>
/// The manager that represents the file and folder metadata endpoint
/// </summary>
public BoxMetadataManager MetadataManager { get; private set; }
public IBoxMetadataManager MetadataManager { get; private set; }

/// <summary>
/// The manager that represents the webhooks V2 endpoint
/// </summary>
public BoxWebhooksManager WebhooksManager { get; private set; }
public IBoxWebhooksManager WebhooksManager { get; private set; }

/// <summary>
/// The manager that represents the recent items endpoint
/// </summary>
public BoxRecentItemsManager RecentItemsManager { get; private set; }
public IBoxRecentItemsManager RecentItemsManager { get; private set; }

/// <summary>
/// The manager that represents the tasks endpoint
/// </summary>
public BoxTasksManager TasksManager { get; private set; }
public IBoxTasksManager TasksManager { get; private set; }

/// <summary>
/// The manager that represents the legal hold policies endpoint
/// </summary>
public BoxLegalHoldPoliciesManager LegalHoldPoliciesManager { get; private set; }
public IBoxLegalHoldPoliciesManager LegalHoldPoliciesManager { get; private set; }

/// <summary>
/// The Auth repository that holds the auth session
Expand All @@ -241,40 +241,40 @@ public BoxClient AddResourcePlugin<T>() where T : BoxResourceManager
/// <summary>
/// The manager that represents the shared items endpoint
/// </summary>
public BoxSharedItemsManager SharedItemsManager { get; private set; }
public IBoxSharedItemsManager SharedItemsManager { get; private set; }

/// <summary>
/// The manager that represents the collections endpoint
/// </summary>
public BoxCollectionsManager CollectionsManager { get; private set; }
public IBoxCollectionsManager CollectionsManager { get; private set; }

/// <summary>
/// The manager that represents the device pin endpoint
/// </summary>
public BoxDevicePinManager DevicePinManager { get; private set; }
public IBoxDevicePinManager DevicePinManager { get; private set; }

/// <summary>
/// The manager that represents the weblinks endpoint
/// </summary>
public BoxWebLinksManager WebLinksManager { get; private set; }
public IBoxWebLinksManager WebLinksManager { get; private set; }

/// <summary>
/// The manager that represents the collaboration whitelist endpoint
/// </summary>
public BoxCollaborationWhitelistManager CollaborationWhitelistManager { get; private set; }
public IBoxCollaborationWhitelistManager CollaborationWhitelistManager { get; private set; }

/// <summary>
/// The manager that represents the terms of service endpoint
/// </summary>
public BoxTermsOfServiceManager TermsOfServiceManager { get; private set; }
public IBoxTermsOfServiceManager TermsOfServiceManager { get; private set; }

/// <summary>
/// The manager that represents the metadata cascade policy endpoint
/// </summary>
public BoxMetadataCascadePolicyManager MetadataCascadePolicyManager { get; private set; }
public IBoxMetadataCascadePolicyManager MetadataCascadePolicyManager { get; private set; }

/// The manager that represents the storage policies endpoint
/// </summary>
public BoxStoragePoliciesManager StoragePoliciesManager { get; private set; }
public IBoxStoragePoliciesManager StoragePoliciesManager { get; private set; }
}
}
146 changes: 146 additions & 0 deletions Box.V2/IBoxClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
using Box.V2.Auth;
using Box.V2.Config;
using Box.V2.Managers;
using Box.V2.Plugins;

namespace Box.V2
{
/// <summary>
/// The central entrypoint for all SDK interaction. The BoxClient houses all of the API endpoints and are represented
/// as resource managers for each distinct endpoint
/// </summary>
public interface IBoxClient
{
/// <summary>
/// Adds additional resource managers/endpoints to the BoxClient.
/// This is meant to allow for the inclusion of beta APIs or unofficial endpoints
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
IBoxClient AddResourcePlugin<T>() where T : BoxResourceManager;

/// <summary>
/// The configuration parameters used by the Box Service
/// </summary>
IBoxConfig Config { get; }

/// <summary>
/// The manager that represents the files endpoint
/// </summary>
IBoxFilesManager FilesManager { get; }

/// <summary>
/// The manager that represents the folders endpoint
/// </summary>
IBoxFoldersManager FoldersManager { get; }

/// <summary>
/// The manager that represents the comments endpoint
/// </summary>
IBoxCommentsManager CommentsManager { get; }

/// <summary>
/// The manager that represents the collaboration endpoint
/// </summary>
IBoxCollaborationsManager CollaborationsManager { get; }

/// <summary>
/// The manager that represents the search endpoint
/// </summary>
IBoxSearchManager SearchManager { get; }

/// <summary>
/// The manager that represents the events endpoint
/// </summary>
IBoxEventsManager EventsManager { get; }

/// <summary>
/// The manager that represents the users endpoint
/// </summary>
IBoxUsersManager UsersManager { get; }

/// <summary>
/// The manager that represents the groups endpoint
/// </summary>
IBoxGroupsManager GroupsManager { get; }

/// <summary>
/// The manager that represents the retention policies endpoint
/// </summary>
IBoxRetentionPoliciesManager RetentionPoliciesManager { get; }

/// <summary>
/// The manager that represents the file and folder metadata endpoint
/// </summary>
IBoxMetadataManager MetadataManager { get; }

/// <summary>
/// The manager that represents the webhooks V2 endpoint
/// </summary>
IBoxWebhooksManager WebhooksManager { get; }

/// <summary>
/// The manager that represents the recent items endpoint
/// </summary>
IBoxRecentItemsManager RecentItemsManager { get; }

/// <summary>
/// The manager that represents the tasks endpoint
/// </summary>
IBoxTasksManager TasksManager { get; }

/// <summary>
/// The manager that represents the legal hold policies endpoint
/// </summary>
IBoxLegalHoldPoliciesManager LegalHoldPoliciesManager { get; }

/// <summary>
/// The Auth repository that holds the auth session
/// </summary>
IAuthRepository Auth { get; }

/// <summary>
/// Allows resource managers to be registered and retrieved as plugins
/// </summary>
BoxResourcePlugins ResourcePlugins { get; }

/// <summary>
/// The manager that represents the shared items endpoint
/// </summary>
IBoxSharedItemsManager SharedItemsManager { get; }

/// <summary>
/// The manager that represents the collections endpoint
/// </summary>
IBoxCollectionsManager CollectionsManager { get; }

/// <summary>
/// The manager that represents the device pin endpoint
/// </summary>
IBoxDevicePinManager DevicePinManager { get; }

/// <summary>
/// The manager that represents the weblinks endpoint
/// </summary>
IBoxWebLinksManager WebLinksManager { get; }

/// <summary>
/// The manager that represents the collaboration whitelist endpoint
/// </summary>
IBoxCollaborationWhitelistManager CollaborationWhitelistManager { get; }

/// <summary>
/// The manager that represents the terms of service endpoint
/// </summary>
IBoxTermsOfServiceManager TermsOfServiceManager { get; }

/// <summary>
/// The manager that represents the metadata cascade policy endpoint
/// </summary>
IBoxMetadataCascadePolicyManager MetadataCascadePolicyManager { get; }

/// The manager that represents the storage policies endpoint
/// </summary>
IBoxStoragePoliciesManager StoragePoliciesManager { get; }
}
}
4 changes: 2 additions & 2 deletions Box.V2/Managers/BoxCollaborationWhitelistManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Box.V2.Auth;
using Box.V2.Auth;
using Box.V2.Config;
using Box.V2.Converter;
using Box.V2.Extensions;
Expand All @@ -13,7 +13,7 @@

namespace Box.V2.Managers
{
public class BoxCollaborationWhitelistManager : BoxResourceManager
public class BoxCollaborationWhitelistManager : BoxResourceManager, IBoxCollaborationWhitelistManager
{
public BoxCollaborationWhitelistManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth, string asUser = null, bool? suppressNotifications = null)
: base(config, service, converter, auth, asUser, suppressNotifications) { }
Expand Down
4 changes: 2 additions & 2 deletions Box.V2/Managers/BoxCollaborationsManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Box.V2.Auth;
using Box.V2.Auth;
using Box.V2.Config;
using Box.V2.Converter;
using Box.V2.Extensions;
Expand All @@ -12,7 +12,7 @@

namespace Box.V2.Managers
{
public class BoxCollaborationsManager : BoxResourceManager
public class BoxCollaborationsManager : BoxResourceManager, IBoxCollaborationsManager
{

public BoxCollaborationsManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth, string asUser = null, bool? suppressNotifications = null)
Expand Down
4 changes: 2 additions & 2 deletions Box.V2/Managers/BoxCollectionsManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Box.V2.Auth;
using Box.V2.Auth;
using Box.V2.Config;
using Box.V2.Extensions;
using Box.V2.Converter;
Expand All @@ -15,7 +15,7 @@ namespace Box.V2.Managers
/// <summary>
/// Managing collections
/// </summary>
public class BoxCollectionsManager : BoxResourceManager
public class BoxCollectionsManager : BoxResourceManager, IBoxCollectionsManager
{

public BoxCollectionsManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth, string asUser = null, bool? suppressNotifications = null)
Expand Down
Loading