001package com.box.sdk; 002 003/** 004 * Listener to listen to Box API connection events. 005 */ 006public interface BoxAPIConnectionListener { 007 008 /** 009 * Called when the Box API connection refreshes its tokens. 010 * 011 * <p>The provided connection is guaranteed to not be auto-refreshed or modified by another listener until this 012 * method returns.</p> 013 * 014 * @param api the API connection that was refreshed. 015 */ 016 void onRefresh(BoxAPIConnection api); 017 018 /** 019 * Called when an error occurs while attempting to refresh the Box API connection's tokens. 020 * 021 * <p>The provided connection is guaranteed to not be auto-refreshed or modified by another listener until this 022 * method returns.</p> 023 * 024 * @param api the API connection that encountered an error. 025 * @param error the error that occurred. 026 */ 027 void onError(BoxAPIConnection api, BoxAPIException error); 028}