Example #1
0
        public async Task <LocalUser> me()
        {
            // Assuming we're already logged in but want our Authentication object

            // Call Auth, if successful, else error 500
            var url = API.AppendPathSegment("profile");

            dynamic payload = new JObject();

            // See line #467 of TinderPartTwo-FINAL.saz
            payload.discoverable = true;


            // POST /auth HTTP/1.1
            HttpResponseMessage response = await rest.PostAsync(url, RestHelpers.preparePayload(payload));

            if (response.IsSuccessStatusCode)
            {
                LocalUser json = await RestHelpers.responseToObject <LocalUser>(response);

                return(json);
            }

            return(null);
        }
Example #2
0
        public async Task <Authentication> authenticateViaFacebook(TinderOAuthToken fb)
        {
            // Call Auth, if successful, else error 500
            var url = API.AppendPathSegment("auth");

            dynamic payload = new JObject();

            payload.facebook_token = fb.facebook_token;
            payload.facebook_id    = fb.facebook_uid;
            payload.locale         = Locale;

            // POST /auth HTTP/1.1
            HttpResponseMessage response = await rest.PostAsync(url, RestHelpers.preparePayload(payload));

            if (response.IsSuccessStatusCode)
            {
                Authentication json = await RestHelpers.responseToObject <Authentication>(response);

                addXAuthHeader(json.token);

                return(json);
            }

            return(null);
        }
Example #3
0
        public async Task <Status> pass(string id_to_pass)
        {
            // Given the ID of the user to pass,
            var url = API.AppendPathSegments(new string[] { "pass", id_to_pass });

            dynamic payload = new JObject();

            // POST /pass/{id} HTTP/1.1
            HttpResponseMessage response = await rest.PostAsync(url, RestHelpers.preparePayload(payload));

            if (response.IsSuccessStatusCode)
            {
                Status json = await RestHelpers.responseToObject <Status>(response);

                return(json);
            }

            return(null);
        }
Example #4
0
        public async Task <Updates> getUpdates(string last_activity_date)
        {
            var     url     = API.AppendPathSegment("updates");
            dynamic payload = new JObject();

            payload.last_activity_date = last_activity_date;

            // POST /updates HTTP/1.1
            HttpResponseMessage response = await rest.PostAsync(url, RestHelpers.preparePayload(payload));

            if (response.IsSuccessStatusCode)
            {
                Updates json = await RestHelpers.responseToObject <Updates>(response);

                return(json);
            }

            return(null);
        }
Example #5
0
        public async Task <LikeResponse> superlike(string id_to_like)
        {
            // Given the ID of the user to like,
            var url = API.AppendPathSegments(new string[] { "like", id_to_like, "super" });

            dynamic payload = new JObject();

            // POST /like/{id}/super HTTP/1.1
            // Why the superlike is a POST and like is GET, we'll never know!
            HttpResponseMessage response = await rest.PostAsync(url, RestHelpers.preparePayload(payload));

            if (response.IsSuccessStatusCode)
            {
                LikeResponse json = await RestHelpers.responseToObject <LikeResponse>(response);

                return(json);
            }

            return(null);
        }
Example #6
0
        public async Task <Ping> setLocation(double lat, double lon)
        {
            var     url     = API.AppendPathSegments(new string[] { "user", "ping" });
            dynamic payload = new JObject();

            payload.lat = lat;
            payload.lon = lon;

            // POST /user/ping HTTPP/1.1
            HttpResponseMessage response = await rest.PostAsync(url, RestHelpers.preparePayload(payload));

            if (response.IsSuccessStatusCode)
            {
                Ping json = await RestHelpers.responseToObject <Ping>(response);

                return(json);
            }

            return(null);
        }
Example #7
0
        public async Task <Message> sendMessage(string conversation_id, string content)
        {
            // conversation_id is merely the concatenation of:
            // Message.to + Message.from
            var     url     = API.AppendPathSegments(new string[] { "user", "matches", conversation_id });
            dynamic payload = new JObject();

            payload.message = content;

            // POST /user/matches/{_id} HTTP/1.1
            HttpResponseMessage response = await rest.PostAsync(url, RestHelpers.preparePayload(payload));

            if (response.IsSuccessStatusCode)
            {
                Message json = await RestHelpers.responseToObject <Message>(response);

                return(json);
            }

            return(null);
        }