Go SDK
github.com/serpcheap/serpcheap-go आधिकारिक Go क्लाइंट है — Go 1.21+, केवल मानक लाइब्रेरी,
कॉन्टेक्स्ट-अवेयर।
इंस्टॉल करें
Section titled “इंस्टॉल करें”go get github.com/serpcheap/serpcheap-goक्विकस्टार्ट
Section titled “क्विकस्टार्ट”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) }}विकल्प
Section titled “विकल्प”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