Initialize Tinder API Wrapper with server configuration and Docker setup

This commit is contained in:
2025-03-20 22:19:48 +01:00
commit e99b56e434
17 changed files with 1459 additions and 0 deletions

56
example/example.go Normal file
View File

@@ -0,0 +1,56 @@
package main
import (
"fmt"
"log"
tinder "tinder-api-wrapper"
)
func main() {
// Create a new Tinder client with the API endpoint
client, err := tinder.NewClient("https://tinder.cloonar.com")
if err != nil {
log.Fatalf("Failed to create Tinder client: %v", err)
}
// Example: Get recommendations
fmt.Println("Getting recommendations...")
recs, err := client.GetRecommendations("en")
if err != nil {
log.Fatalf("Failed to get recommendations: %v", err)
}
// Print out the recommendations
fmt.Printf("Found %d recommendations\n", len(recs.Data.Results))
for i, rec := range recs.Data.Results {
fmt.Printf("%d. %s, %s\n", i+1, rec.User.Name, rec.User.Bio)
}
// Example: Like a user
if len(recs.Data.Results) > 0 {
userID := recs.Data.Results[0].User.ID
fmt.Printf("Liking user %s...\n", userID)
likeResp, err := client.LikeUser(userID)
if err != nil {
log.Fatalf("Failed to like user: %v", err)
}
fmt.Printf("Like response: Match=%v, LikesRemaining=%d\n",
likeResp.Match, likeResp.LikesRemaining)
}
// Example: Pass on a user
if len(recs.Data.Results) > 1 {
userID := recs.Data.Results[1].User.ID
fmt.Printf("Passing on user %s...\n", userID)
passResp, err := client.PassUser(userID)
if err != nil {
log.Fatalf("Failed to pass on user: %v", err)
}
fmt.Printf("Pass response: Status=%s\n", passResp.Status)
}
}