예제 #1
0
        public static async Task <MatchResponse> SuperLike(this TinderClient client, string userId)
        {
            var url      = SuperLikeEndpoint.Replace("{UserId}", userId);
            var response = await new RestClient(url, client.XAuthToken).Post <MatchResponse>();

            return(response);
        }
예제 #2
0
        public static async Task <MatchResponse> Like(this TinderClient client, string userId, long sNumber)
        {
            var url      = LikeEndpoint.Replace("{UserId}", userId);
            var content  = new StringContent("{\"s_number\":" + sNumber + "}");
            var response = await new RestClient(url, client.XAuthToken).Post <MatchResponse>(content);

            return(response);
        }
예제 #3
0
        public static async Task <MatchedPerson> GetMatchProfile(this TinderClient client, string userId)
        {
            var url = UserEndpoint.Replace("{UserId}", userId);

            var response = await new RestClient(url, client.XAuthToken).Get <MatchedPerson>();

            return(response);
        }
예제 #4
0
        public static async Task <Message> SendSongMessage(this TinderClient client, string matchId, ISongMessage song)
        {
            var url      = Message.Replace("{MatchId}", matchId);
            var response = await new RestClient(url, client.XAuthToken).Post <Message>(
                new { message = song.GetUri(), track_id = song.GetSongId(), type = "song" });

            return(response);
        }
예제 #5
0
        public static async Task <Message> SendMessage(this TinderClient client, string matchId, string msg)
        {
            var url = Message.Replace("{MatchId}", matchId);

            var response = await new RestClient(url, client.XAuthToken).Post <Message>(new { message = msg });

            return(response);
        }
예제 #6
0
        public static async Task MarkMessageAsSeen(this TinderClient client, string matchId, string messageId)
        {
            string url = SeenMessage
                         .Replace("{MatchId}", matchId)
                         .Replace("{MessageId}", messageId);

            await new RestClient(url, client.XAuthToken).Post();
        }
예제 #7
0
        public static async Task <IList <MatchResponse.Match> > GetMessagedMatches(this TinderClient client, UrlQuery query)
        {
            query.Add("message", "1");
            var url = CurrentMatchesEndpoint + query.Generate();

            var response = await new RestClient(url, client.XAuthToken).Get <MatchesWrapper>();

            return(response.Matches);
        }
예제 #8
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Sharp Tinder");

            client = new TinderClient();

            Login();
            GetUpdates();
        }
예제 #9
0
        public static async Task <Message> SendGifMessage(this TinderClient client, string matchId, Uri GiphyLink)
        {
            var    url      = Message.Replace("{MatchId}", matchId);
            var    regex    = Regex.Match(GiphyLink.AbsoluteUri, @"https:\/\/media1\.giphy\.com\/media\/(.+)\/giphy\.gif");
            string gifId    = regex.Groups[1].Value;
            var    response = await new RestClient(url, client.XAuthToken).Post <Message>(
                new { message = GiphyLink, gif_id = gifId, type = "gif" });

            return(response);
        }
예제 #10
0
        public static async Task <Profile> ChangeSearchPreferences(this TinderClient client, SearchPreferences pref)
        {
            var url      = ProfileEndpoint;
            var response = await new RestClient(url, client.XAuthToken).Post <Profile>(new
            {
                user = pref
            });

            return(response);
        }
예제 #11
0
        public static async Task <Update> GetUpdates(this TinderClient client, DateTime updatedFrom = default(DateTime))
        {
            var obj = new
            {
                nudge = true,
                last_activity_date = updatedFrom.ToTinderString()
            };
            var response = await new RestClient(UpdatesEndpoint, client.XAuthToken).Post <Update>(obj);

            return(response);
        }
예제 #12
0
        public static async Task <MessagePage> GetMessages(this TinderClient client, string matchId, UrlQuery query = null)
        {
            string url = Message.Replace("{MatchId}", matchId);

            if (query != null)
            {
                url += query.Generate();
            }

            var response = await new RestClient(url, client.XAuthToken).Get <MessagePage>();

            return(response);
        }
예제 #13
0
        private static void ConfigureServices(HostBuilderContext hostContext, IServiceCollection services)
        {
            var tinderAuthToken = hostContext.Configuration.GetValue <string>("TinderClient:Token"); // X-Auth-Token

            if (string.IsNullOrEmpty(tinderAuthToken) || !Guid.TryParse(tinderAuthToken, out Guid tinderAuthTokenGuid))
            {
                throw new Exception("TinderClient:Token is missing in appsettings.json or the token is malformed");
            }

            var tinderClient = new TinderClient(tinderAuthTokenGuid);

            services.AddSingleton <ITinderClient>(tinderClient);
            services.AddHostedService <Worker>();
        }
예제 #14
0
        static async Task Main(string[] args)
        {
            var client = new TinderClient("");

            // var resp = client.GetProfile();
            var metadata = await client.GetMetadata();

            var profile = await client.GetProfile();

            var recommendations = await client.GetMatchRecommendations();

            var matches = await client.GetMatches(new UrlQueryBuilder().AddMatchesCount(10).Build());

            var moreMatches = await client.GetMessagedMatches(new UrlQueryBuilder().AddMatchesCount(10).Build());

            var update = await client.GetUpdates(DateTime.Now.AddMonths(-5));
        }
예제 #15
0
        public static async Task <Metadata> GetMetadata(this TinderClient tinderClient)
        {
            var response = await new RestClient(MetadataEndpoint, tinderClient.XAuthToken).Get <Metadata>();

            return(response);
        }
예제 #16
0
 public static async Task ChangeUsername(this TinderClient client, string newUsername)
 {
     await new RestClient(UsernameEndpoint, client.XAuthToken).Put(new { username = newUsername });
 }
예제 #17
0
 public static async Task ResetUsername(this TinderClient client)
 {
     await new RestClient(UsernameEndpoint, client.XAuthToken).Delete();
 }
예제 #18
0
        public static async Task Unmatch(this TinderClient client, string matchID)
        {
            var url = UnmatchEndpoint.Replace("{MatchId}", matchID);

            await new RestClient(url, client.XAuthToken).Delete();
        }
예제 #19
0
        public static async Task <Profile> GetProfile(this TinderClient tinderClient)
        {
            var response = await new RestClient(ProfileEndpoint, tinderClient.XAuthToken).Get <Profile>();

            return(response);
        }
예제 #20
0
        public static async Task Pass(this TinderClient client, string userId)
        {
            var url = PassEndpoint.Replace("{UserId}", userId);

            await new RestClient(url, client.XAuthToken).Post();
        }
예제 #21
0
        public static async Task <IList <RecommendedMatch> > GetMatchRecommendations(this TinderClient client)
        {
            var response = await new RestClient(MatchRecommendationsEndpoint, client.XAuthToken).Get <RecommendedMatches>();

            return(response.Results);
        }