예제 #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);
        }
예제 #2
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;
        }