api

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 8 Imported by: 0

README

sdk-go

The official Go client for the PredictorSDK matching markets API.

Installation

go get github.com/PredictorSDK/sdk-go

Usage

package main

import (
	"context"
	"fmt"

	predictorsdk "github.com/PredictorSDK/sdk-go"
	"github.com/PredictorSDK/sdk-go/option"
)

func main() {
	client := predictorsdk.NewClient(option.WithToken("your-api-key"))

	response, err := client.GetSportsMatchingMarkets(context.TODO(), &predictorsdk.GetSportsMatchingMarketsRequest{
		KalshiEventTicker: predictorsdk.String("KXMLB-25-NYM-COL-2025-04-03"),
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(response)
}

Documentation

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Environments = struct {
	Production string
}{
	Production: "https://api.predictorsdk.com",
}

Environments defines all of the API environments. These values can be used with the WithBaseURL RequestOption to override the client's default environment, if any.

View Source
var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{
	400: func(apiError *core.APIError) error {
		return &BadRequestError{
			APIError: apiError,
		}
	},
	401: func(apiError *core.APIError) error {
		return &UnauthorizedError{
			APIError: apiError,
		}
	},
	403: func(apiError *core.APIError) error {
		return &ForbiddenError{
			APIError: apiError,
		}
	},
	429: func(apiError *core.APIError) error {
		return &TooManyRequestsError{
			APIError: apiError,
		}
	},
	503: func(apiError *core.APIError) error {
		return &ServiceUnavailableError{
			APIError: apiError,
		}
	},
}

Functions

func Bool

func Bool(b bool) *bool

Bool returns a pointer to the given bool value.

func Byte

func Byte(b byte) *byte

Byte returns a pointer to the given byte value.

func Bytes

func Bytes(b []byte) *[]byte

Bytes returns a pointer to the given []byte value.

func Complex64

func Complex64(c complex64) *complex64

Complex64 returns a pointer to the given complex64 value.

func Complex128

func Complex128(c complex128) *complex128

Complex128 returns a pointer to the given complex128 value.

func Float32

func Float32(f float32) *float32

Float32 returns a pointer to the given float32 value.

func Float64

func Float64(f float64) *float64

Float64 returns a pointer to the given float64 value.

func Int

func Int(i int) *int

Int returns a pointer to the given int value.

func Int8

func Int8(i int8) *int8

Int8 returns a pointer to the given int8 value.

func Int16

func Int16(i int16) *int16

Int16 returns a pointer to the given int16 value.

func Int32

func Int32(i int32) *int32

Int32 returns a pointer to the given int32 value.

func Int64

func Int64(i int64) *int64

Int64 returns a pointer to the given int64 value.

func MustParseDate

func MustParseDate(date string) time.Time

MustParseDate attempts to parse the given string as a date time.Time, and panics upon failure.

func MustParseDateTime

func MustParseDateTime(datetime string) time.Time

MustParseDateTime attempts to parse the given string as a datetime time.Time, and panics upon failure.

func Rune

func Rune(r rune) *rune

Rune returns a pointer to the given rune value.

func String

func String(s string) *string

String returns a pointer to the given string value.

func Time

func Time(t time.Time) *time.Time

Time returns a pointer to the given time.Time value.

func UUID

func UUID(u uuid.UUID) *uuid.UUID

UUID returns a pointer to the given uuid.UUID value.

func Uint

func Uint(u uint) *uint

Uint returns a pointer to the given uint value.

func Uint8

func Uint8(u uint8) *uint8

Uint8 returns a pointer to the given uint8 value.

func Uint16

func Uint16(u uint16) *uint16

Uint16 returns a pointer to the given uint16 value.

func Uint32

func Uint32(u uint32) *uint32

Uint32 returns a pointer to the given uint32 value.

func Uint64

func Uint64(u uint64) *uint64

Uint64 returns a pointer to the given uint64 value.

func Uintptr

func Uintptr(u uintptr) *uintptr

Uintptr returns a pointer to the given uintptr value.

Types

type BadRequestError

type BadRequestError struct {
	*core.APIError
	Body *ErrorResponse
}

Invalid query parameters (e.g. combining multiple filter types)

func (*BadRequestError) MarshalJSON

func (b *BadRequestError) MarshalJSON() ([]byte, error)

func (*BadRequestError) UnmarshalJSON

func (b *BadRequestError) UnmarshalJSON(data []byte) error

func (*BadRequestError) Unwrap

func (b *BadRequestError) Unwrap() error

type ErrorResponse

type ErrorResponse struct {
	Error      string `json:"error" url:"error"`
	StatusCode int    `json:"status_code" url:"status_code"`
	// contains filtered or unexported fields
}

func (*ErrorResponse) GetError

func (e *ErrorResponse) GetError() string

func (*ErrorResponse) GetExtraProperties

func (e *ErrorResponse) GetExtraProperties() map[string]interface{}

func (*ErrorResponse) GetStatusCode

func (e *ErrorResponse) GetStatusCode() int

func (*ErrorResponse) MarshalJSON

func (e *ErrorResponse) MarshalJSON() ([]byte, error)

func (*ErrorResponse) SetError

func (e *ErrorResponse) SetError(error_ string)

SetError sets the Error field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ErrorResponse) SetStatusCode

func (e *ErrorResponse) SetStatusCode(statusCode int)

SetStatusCode sets the StatusCode field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ErrorResponse) String

func (e *ErrorResponse) String() string

func (*ErrorResponse) UnmarshalJSON

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

type FileParam

type FileParam struct {
	io.Reader
	// contains filtered or unexported fields
}

FileParam is a file type suitable for multipart/form-data uploads.

func NewFileParam

func NewFileParam(
	reader io.Reader,
	filename string,
	contentType string,
	opts ...FileParamOption,
) *FileParam

NewFileParam returns a *FileParam type suitable for multipart/form-data uploads. All file upload endpoints accept a simple io.Reader, which is usually created by opening a file via os.Open.

However, some endpoints require additional metadata about the file such as a specific Content-Type or custom filename. FileParam makes it easier to create the correct type signature for these endpoints.

func (*FileParam) ContentType

func (f *FileParam) ContentType() string

func (*FileParam) Name

func (f *FileParam) Name() string

type FileParamOption

type FileParamOption interface {
	// contains filtered or unexported methods
}

FileParamOption adapts the behavior of the FileParam. No options are implemented yet, but this interface allows for future extensibility.

type ForbiddenError

type ForbiddenError struct {
	*core.APIError
	Body *ErrorResponse
}

API key lacks the required permission

func (*ForbiddenError) MarshalJSON

func (f *ForbiddenError) MarshalJSON() ([]byte, error)

func (*ForbiddenError) UnmarshalJSON

func (f *ForbiddenError) UnmarshalJSON(data []byte) error

func (*ForbiddenError) Unwrap

func (f *ForbiddenError) Unwrap() error

type GetSportsMatchingMarketsRequest

type GetSportsMatchingMarketsRequest struct {
	// Kalshi event ticker(s) to find matching markets for (e.g. `KXNFLGAME-25AUG16ARIDEN`). Provide the parameter multiple times for multiple tickers. Only one filter type may be used per request.
	KalshiEventTicker []*string `json:"-" url:"kalshi_event_ticker,omitempty"`
	// Polymarket market slug(s) to find matching markets for (e.g. `nfl-ari-den-2025-08-16`). Provide the parameter multiple times for multiple slugs. Only one filter type may be used per request.
	PolymarketMarketSlug []*string `json:"-" url:"polymarket_market_slug,omitempty"`
	// Predict market ID(s) to find matching markets for (e.g. `110629`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request.
	PredictMarketID []*string `json:"-" url:"predict_market_id,omitempty"`
	// SX Bet market ID(s) to find matching markets for (e.g. `0x4c000abdbf197ef32ecdf15561b1d636f1e5b02629f466678757fd83e2ec3599`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request.
	SxbetMarketID []*string `json:"-" url:"sxbet_market_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetSportsMatchingMarketsRequest) SetKalshiEventTicker

func (g *GetSportsMatchingMarketsRequest) SetKalshiEventTicker(kalshiEventTicker []*string)

SetKalshiEventTicker sets the KalshiEventTicker field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*GetSportsMatchingMarketsRequest) SetPolymarketMarketSlug

func (g *GetSportsMatchingMarketsRequest) SetPolymarketMarketSlug(polymarketMarketSlug []*string)

SetPolymarketMarketSlug sets the PolymarketMarketSlug field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*GetSportsMatchingMarketsRequest) SetPredictMarketID

func (g *GetSportsMatchingMarketsRequest) SetPredictMarketID(predictMarketID []*string)

SetPredictMarketID sets the PredictMarketID field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*GetSportsMatchingMarketsRequest) SetSxbetMarketID

func (g *GetSportsMatchingMarketsRequest) SetSxbetMarketID(sxbetMarketID []*string)

SetSxbetMarketID sets the SxbetMarketID field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

type PlatformMarket

type PlatformMarket struct {
	Platform PlatformMarketPlatform `json:"platform" url:"platform"`
	// Kalshi event ticker. Present when platform is KALSHI.
	EventTicker *string `json:"event_ticker,omitempty" url:"event_ticker,omitempty"`
	// Kalshi market tickers. Present when platform is KALSHI.
	MarketTickers []string `json:"market_tickers,omitempty" url:"market_tickers,omitempty"`
	// Polymarket market slug. Present when platform is POLYMARKET.
	MarketSlug *string `json:"market_slug,omitempty" url:"market_slug,omitempty"`
	// Polymarket token IDs. Present when platform is POLYMARKET.
	TokenIDs []string `json:"token_ids,omitempty" url:"token_ids,omitempty"`
	// Source market ID. Present for platforms other than Kalshi and Polymarket.
	MarketID *string `json:"market_id,omitempty" url:"market_id,omitempty"`
	// Source outcome IDs. Present for platforms that use outcome IDs.
	OutcomeIDs []string `json:"outcome_ids,omitempty" url:"outcome_ids,omitempty"`
	// contains filtered or unexported fields
}

func (*PlatformMarket) GetEventTicker

func (p *PlatformMarket) GetEventTicker() *string

func (*PlatformMarket) GetExtraProperties

func (p *PlatformMarket) GetExtraProperties() map[string]interface{}

func (*PlatformMarket) GetMarketID

func (p *PlatformMarket) GetMarketID() *string

func (*PlatformMarket) GetMarketSlug

func (p *PlatformMarket) GetMarketSlug() *string

func (*PlatformMarket) GetMarketTickers

func (p *PlatformMarket) GetMarketTickers() []string

func (*PlatformMarket) GetOutcomeIDs

func (p *PlatformMarket) GetOutcomeIDs() []string

func (*PlatformMarket) GetPlatform

func (p *PlatformMarket) GetPlatform() PlatformMarketPlatform

func (*PlatformMarket) GetTokenIDs

func (p *PlatformMarket) GetTokenIDs() []string

func (*PlatformMarket) MarshalJSON

func (p *PlatformMarket) MarshalJSON() ([]byte, error)

func (*PlatformMarket) SetEventTicker

func (p *PlatformMarket) SetEventTicker(eventTicker *string)

SetEventTicker sets the EventTicker field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*PlatformMarket) SetMarketID

func (p *PlatformMarket) SetMarketID(marketID *string)

SetMarketID sets the MarketID field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*PlatformMarket) SetMarketSlug

func (p *PlatformMarket) SetMarketSlug(marketSlug *string)

SetMarketSlug sets the MarketSlug field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*PlatformMarket) SetMarketTickers

func (p *PlatformMarket) SetMarketTickers(marketTickers []string)

SetMarketTickers sets the MarketTickers field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*PlatformMarket) SetOutcomeIDs

func (p *PlatformMarket) SetOutcomeIDs(outcomeIDs []string)

SetOutcomeIDs sets the OutcomeIDs field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*PlatformMarket) SetPlatform

func (p *PlatformMarket) SetPlatform(platform PlatformMarketPlatform)

SetPlatform sets the Platform field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*PlatformMarket) SetTokenIDs

func (p *PlatformMarket) SetTokenIDs(tokenIDs []string)

SetTokenIDs sets the TokenIDs field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*PlatformMarket) String

func (p *PlatformMarket) String() string

func (*PlatformMarket) UnmarshalJSON

func (p *PlatformMarket) UnmarshalJSON(data []byte) error

type PlatformMarketPlatform

type PlatformMarketPlatform string
const (
	PlatformMarketPlatformKalshi     PlatformMarketPlatform = "KALSHI"
	PlatformMarketPlatformPolymarket PlatformMarketPlatform = "POLYMARKET"
	PlatformMarketPlatformPredict    PlatformMarketPlatform = "PREDICT"
	PlatformMarketPlatformSxbet      PlatformMarketPlatform = "SXBET"
)

func NewPlatformMarketPlatformFromString

func NewPlatformMarketPlatformFromString(s string) (PlatformMarketPlatform, error)

func (PlatformMarketPlatform) Ptr

type ServiceUnavailableError

type ServiceUnavailableError struct {
	*core.APIError
	Body *ErrorResponse
}

Matching markets reader unavailable

func (*ServiceUnavailableError) MarshalJSON

func (s *ServiceUnavailableError) MarshalJSON() ([]byte, error)

func (*ServiceUnavailableError) UnmarshalJSON

func (s *ServiceUnavailableError) UnmarshalJSON(data []byte) error

func (*ServiceUnavailableError) Unwrap

func (s *ServiceUnavailableError) Unwrap() error

type SportsMatchingResponse

type SportsMatchingResponse struct {
	// Key-value pairs where each key is the queried identifier (Kalshi event ticker, Polymarket slug, or canonical event ID when no filter is provided) and each value is an array of platform market objects.
	Markets map[string][]*PlatformMarket `json:"markets" url:"markets"`
	// contains filtered or unexported fields
}

func (*SportsMatchingResponse) GetExtraProperties

func (s *SportsMatchingResponse) GetExtraProperties() map[string]interface{}

func (*SportsMatchingResponse) GetMarkets

func (s *SportsMatchingResponse) GetMarkets() map[string][]*PlatformMarket

func (*SportsMatchingResponse) MarshalJSON

func (s *SportsMatchingResponse) MarshalJSON() ([]byte, error)

func (*SportsMatchingResponse) SetMarkets

func (s *SportsMatchingResponse) SetMarkets(markets map[string][]*PlatformMarket)

SetMarkets sets the Markets field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*SportsMatchingResponse) String

func (s *SportsMatchingResponse) String() string

func (*SportsMatchingResponse) UnmarshalJSON

func (s *SportsMatchingResponse) UnmarshalJSON(data []byte) error

type TooManyRequestsError

type TooManyRequestsError struct {
	*core.APIError
	Body *ErrorResponse
}

API key exceeded its rate limit or credits

func (*TooManyRequestsError) MarshalJSON

func (t *TooManyRequestsError) MarshalJSON() ([]byte, error)

func (*TooManyRequestsError) UnmarshalJSON

func (t *TooManyRequestsError) UnmarshalJSON(data []byte) error

func (*TooManyRequestsError) Unwrap

func (t *TooManyRequestsError) Unwrap() error

type UnauthorizedError

type UnauthorizedError struct {
	*core.APIError
	Body *ErrorResponse
}

Missing or invalid API key

func (*UnauthorizedError) MarshalJSON

func (u *UnauthorizedError) MarshalJSON() ([]byte, error)

func (*UnauthorizedError) UnmarshalJSON

func (u *UnauthorizedError) UnmarshalJSON(data []byte) error

func (*UnauthorizedError) Unwrap

func (u *UnauthorizedError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL