Go library for Funpay.
Important
This library is currently developing! But may used to handle user and lots. Use [Funpay.Request] and [Funpay.RequestHTML] to make your own modules.
go get github.com/kostromin59/funpayfunc main() {
goldenKey := "gk"
userAgent := "ua"
fp := funpay.New(goldenKey, userAgent)
// Update account info, csrf token and cookies
// Should be called every 40-60 minutes
if err := fp.Update(context.TODO()); err != nil {
log.Println(err.Error())
return
}
log.Printf("account id: %d", fp.UserID())
log.Printf("username: %q", fp.Username())
log.Printf("balance: %d", fp.Balance())
log.Printf("locale: %q", fp.Locale())
}func main() {
fp := funpay.New("golden key", "user agent")
if err := fp.Update(context.TODO()); err != nil {
panic(err)
}
fpLots := lots.New(fp)
// Load lots for current user
if err := fpLots.Update(context.TODO()); err != nil {
log.Println(err.Error())
return
}
// Returns [nodeID]: []string{offerIDs...}
lotsList := fpLots.List()
log.Printf("count of nodes: %d", len(lotsList))
// Returns all fields with values to update lot (offer)
fields, err := fpLots.FieldsByOfferID(context.TODO(), "", "some_id")
if err != nil {
log.Println(err.Error())
return
}
// Change field
fields["price"] = lots.Field{
Value: "1500",
}
// Save lot (offer)
if err := fpLots.Save(context.Background(), fields); err != nil {
log.Println(err.Error())
return
}
// Returns all fields of lot by node (category) without values
// 2852 - Accounts Call of Duty: Black Ops 6
fields, err = fpLots.FieldsByNodeID(context.Background(), "2852")
if err != nil {
log.Println(err.Error())
return
}
offerID := fields["offer_id"]
log.Println(offerID.Value == "0") // true
}This list may grow while developing.
- Other
- Use single entrypoint as base (funpay.New)
- Dedicated
lotsmodule
- Requests
- Request with account data
- Proxy support
- Locale support (
setlocalequery param and path param foren) - Auto load locale
- Account
- Info
- Username
- Balance (from badge)
- Updating cookies
- CSRF Token
- Substituting base url (for testing)
- Proxy support
- Info
- Messages
- Getting all messages
- Getting new messages
- Sending
- Lots
- Get fields
- Get lots
- Update lot
- Delete lot
- Create lot
- Deploy
- Deploy into pkg.go.dev
- Improve documentation
- Tests