예제 #1
0
        /// <summary>
        /// Create user BoxClient using a user access token
        /// </summary>
        /// <param name="userToken">User access token</param>
        /// <param name="userId">Id of the user</param>
        /// <returns>BoxClient that uses CCG authentication</returns>
        public IBoxClient UserClient(string userToken, string userId)
        {
            var userSession = Session(userToken);
            var authRepo    = new CCGAuthRepository(userSession, this, userId);
            var userClient  = new BoxClient(_boxConfig, authRepo);

            return(userClient);
        }
예제 #2
0
        /// <summary>
        /// Create admin BoxClient using an admin access token
        /// </summary>
        /// <param name="adminToken">Admin access token</param>
        /// <param name="asUser">The user ID to set as the 'As-User' header parameter; used to make calls in the context of a user using an admin token</param>
        /// <param name="suppressNotifications">Whether or not to suppress both email and webhook notifications. Typically used for administrative API calls. Your application must have “Manage an Enterprise” scope, and the user making the API calls is a co-admin with the correct "Edit settings for your company" permission.</param>
        /// <returns>BoxClient that uses CCG authentication</returns>
        public IBoxClient AdminClient(string adminToken, string asUser = null, bool?suppressNotifications = null)
        {
            var adminSession = Session(adminToken);
            var authRepo     = new CCGAuthRepository(adminSession, this);
            var adminClient  = new BoxClient(_boxConfig, authRepo, asUser: asUser, suppressNotifications: suppressNotifications);

            return(adminClient);
        }