Esempio n. 1
0
        /// <summary>
        /// 获取api调用
        /// </summary>
        /// <param name="tokenOpenId">访问令牌+用户身份的标识</param>
        /// <returns>API调用,失败返回null</returns>
        public API GetApi(ref TokenOpenId tokenOpenId)
        {
            if (string.IsNullOrEmpty(tokenOpenId.Token) || string.IsNullOrEmpty(tokenOpenId.OpenId))
            {
                return(null);
            }
            Token token = new Token {
                access_token = tokenOpenId.Token, expires_in = -1
            };
            OpenId openId = new OpenId {
                openid = tokenOpenId.OpenId, client_id = client_id
            };

            return(new API(this, ref token, ref openId));
        }
Esempio n. 2
0
        /// <summary>
        /// 获取api调用
        /// </summary>
        /// <param name="tokenOpenId">访问令牌+用户身份的标识</param>
        /// <returns>API调用,失败返回null</returns>
        public API GetApiByJson(string tokenOpenId)
        {
            TokenOpenId value = new TokenOpenId();

            return(AutoCSer.Json.Parser.Parse(tokenOpenId, ref value) ? GetApi(value) : null);
        }
Esempio n. 3
0
 /// <summary>
 /// 获取api调用
 /// </summary>
 /// <param name="tokenOpenId">访问令牌+用户身份的标识</param>
 /// <returns>API调用,失败返回null</returns>
 public API GetApi(TokenOpenId tokenOpenId)
 {
     return(GetApi(ref tokenOpenId));
 }