示例#1
0
        /// <summary>
        /// Initialize a new service instance from the specified OAuth client.
        /// </summary>
        /// <param name="client">The OAuth client.</param>
        public static BoxService CreateFromOAuthClient(BoxOAuthClient client) {

            // This should never be null
            if (client == null) throw new ArgumentNullException("client");

            // Initialize the service
            return new BoxService(client);

        }
示例#2
0
        /// <summary>
        /// Initializes a new instance based on the specified refresh token.
        /// </summary>
        /// <param name="clientId">The client ID.</param>
        /// <param name="clientSecret">The client secret.</param>
        /// <param name="refreshToken">The refresh token of the user.</param>
        public static BoxService CreateFromRefreshToken(string clientId, string clientSecret, string refreshToken) {

            // Initialize a new OAuth client
            BoxOAuthClient client = new BoxOAuthClient(clientId, clientSecret);

            // Get an access token from the refresh token.
            BoxTokenResponse response = client.GetAccessTokenFromRefreshToken(refreshToken);

            // Update the OAuth client with the access token
            client.AccessToken = response.Body.AccessToken;

            // Initialize a new service instance
            return new BoxService(client);

        }
示例#3
0
 private BoxService(BoxOAuthClient client) {
     Client = client;
     Folders = new BoxFoldersEndpoint(this);
 }
 internal BoxFoldersRawEndpoint(BoxOAuthClient client) {
     Client = client;
 }