Example #1
0
        /// <summary>
        /// After the user opens the URL generated with Auth.GetAuthURL
        /// you pass the "code" (access code) with your API keys to this
        /// method. This logs you in and you can start accessing vimeo.
        /// YOU DON'T NEED TO CALL GetAccessToken AS IT WILL BE CALLED HERE.
        /// 
        /// If getting access token fails, it will throw different HTTP errors,
        /// one of which is 404. Surround with try/catch to handle it.
        /// </summary>
        /// <param name="authCode">Auth code that you get after opening the URL from Auth.GetAuthURL</param>
        /// <param name="cid">Your Client/Application ID</param>
        /// <param name="secret">Your Client/Application Secret</param>
        /// <param name="redirect">The Redirect URL That You Specified In API Page</param>
        /// <param name="apiRoot">API Endpoint (optional)</param>
        public static VimeoClient Authorize(
        string authCode,
        string cid,
        string secret,
        string redirect,
        string apiRoot = "https://api.vimeo.com")
        {
            VimeoClient vc = new VimeoClient();
            vc.clientId = cid;
            vc.secret = secret;
            vc.apiRoot = apiRoot;

            vc.AccessJson = Auth.GetAccessToken(authCode, cid, secret, redirect, apiRoot);
            vc.loadAccessData();

            return vc;
        }
Example #2
0
 /// <summary>
 /// Relogin with an existing access token.
 /// </summary>
 /// <param name="accessToken">An access token that you have already acquired.</param>
 /// <param name="cid">Your Client/Application ID</param>
 /// <param name="secret">Your Client/Application Secret</param>
 /// <param name="apiRoot">API Endpoint (optional)</param>
 public static VimeoClient ReAuthorize(
     string accessToken,
     string cid,
     string secret,
     string apiRoot = "https://api.vimeo.com")
 {
     VimeoClient vc = new VimeoClient();
     vc.clientId = cid;
     vc.secret = secret;
     vc.AccessToken = accessToken;
     vc.apiRoot = apiRoot;
     vc.User = vc.Request("/me", null, "GET");
     return vc;
 }