示例#1
0
        public void ExecuteUserKey_v2()
        {
            UserKeyRequest request = new UserKeyRequest();
            request.mobile_key = "!@#$%^&*()";
            request.app_key = this.app_key;

            UserKeyResponse rsp = api.PostRequest<UserKeyRequest, UserKeyResponse>("user.key", request);

            Assert.AreEqual(rsp.status, "FAIL");
        }
示例#2
0
        /// <summary>
        /// Give the user's key of the given mobile key's user.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>OK, user_key. Error message on failure.</returns>
        public UserKeyResponse Key(UserKeyRequest request)
        {
            using (var client = GetDefaultClient())
            {
                // build form data post
                HttpMultipartMimeForm form = new HttpMultipartMimeForm();
                form.Add("app_key", this.AppKey);
                form.Add("mobile_key", request.mobile_key);

                // call method
                using (HttpResponseMessage response = client.Post("user.key", form.CreateHttpContent()))
                {
                    response.EnsureStatusIsSuccessful();
                    return response.Content.ReadAsXmlSerializable<UserKeyResponse>();
                }
            }
        }
示例#3
0
        public void ExecuteUserKey_v1()
        {
            UserKeyRequest request = new UserKeyRequest();
            request.mobile_key = "123";

            UserKeyResponse rsp = api.Key(request);

            Assert.AreEqual(rsp.status, "FAIL");
        }