Go SDK
github.com/serpcheap/serpcheap-go, resmi Go istemcisidir — Go 1.21+, yalnızca standart kütüphane,
context’e duyarlı.
Kurulum
Bölüm başlığı “Kurulum”go get github.com/serpcheap/serpcheap-goHızlı başlangıç
Bölüm başlığı “Hızlı başlangıç”package main
import ( "context" "fmt" "log" "time"
serpcheap "github.com/serpcheap/serpcheap-go")
func main() { client, err := serpcheap.New("YOUR_API_KEY", serpcheap.WithTimeout(15*time.Second), serpcheap.WithMaxRetries(2), ) if err != nil { log.Fatal(err) }
res, err := client.Search(context.Background(), serpcheap.SearchParams{ Q: "best running shoes", GL: "us", Page: 1, }) if err != nil { if e, ok := serpcheap.AsError(err); ok { log.Fatalf("[%s] %s (retryable=%v)", e.Code, e.Message, e.Retryable()) } log.Fatal(err) }
for _, r := range res.Organic { fmt.Printf("%d. %s — %s\n", r.Position, r.Title, r.Link) }}Seçenekler
Bölüm başlığı “Seçenekler”serpcheap.WithBaseURL(string) // override API base URLserpcheap.WithTimeout(time.Duration) // per-request timeoutserpcheap.WithMaxRetries(int) // retries on transient errorsserpcheap.WithHTTPClient(*http.Client) // custom HTTP client