predictorsdk

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 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"
	predictorclient "github.com/PredictorSDK/sdk-go/client"
	"github.com/PredictorSDK/sdk-go/option"
)

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

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

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,
		}
	},
	402: func(apiError *core.APIError) error {
		return &PaymentRequiredError{
			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,
		}
	},
	502: func(apiError *core.APIError) error {
		return &BadGatewayError{
			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 BadGatewayError added in v0.2.0

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

Bad gateway

func (*BadGatewayError) MarshalJSON added in v0.2.0

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

func (*BadGatewayError) UnmarshalJSON added in v0.2.0

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

func (*BadGatewayError) Unwrap added in v0.2.0

func (b *BadGatewayError) Unwrap() error

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 CryptoPriceItem added in v0.2.0

type CryptoPriceItem struct {
	// Trading pair in lowercase (e.g. `btcusdt`).
	Symbol string `json:"symbol" url:"symbol"`
	// Close price for the 1-second interval.
	Value float64 `json:"value" url:"value"`
	// Unix timestamp in milliseconds for the start of the 1-second interval.
	Timestamp int64 `json:"timestamp" url:"timestamp"`
	// contains filtered or unexported fields
}

func (*CryptoPriceItem) GetExtraProperties added in v0.2.0

func (c *CryptoPriceItem) GetExtraProperties() map[string]interface{}

func (*CryptoPriceItem) GetSymbol added in v0.2.0

func (c *CryptoPriceItem) GetSymbol() string

func (*CryptoPriceItem) GetTimestamp added in v0.2.0

func (c *CryptoPriceItem) GetTimestamp() int64

func (*CryptoPriceItem) GetValue added in v0.2.0

func (c *CryptoPriceItem) GetValue() float64

func (*CryptoPriceItem) MarshalJSON added in v0.2.0

func (c *CryptoPriceItem) MarshalJSON() ([]byte, error)

func (*CryptoPriceItem) SetSymbol added in v0.2.0

func (c *CryptoPriceItem) SetSymbol(symbol string)

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

func (*CryptoPriceItem) SetTimestamp added in v0.2.0

func (c *CryptoPriceItem) SetTimestamp(timestamp int64)

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

func (*CryptoPriceItem) SetValue added in v0.2.0

func (c *CryptoPriceItem) SetValue(value float64)

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

func (*CryptoPriceItem) String added in v0.2.0

func (c *CryptoPriceItem) String() string

func (*CryptoPriceItem) UnmarshalJSON added in v0.2.0

func (c *CryptoPriceItem) UnmarshalJSON(data []byte) error

type CryptoPricesResponse added in v0.2.0

type CryptoPricesResponse struct {
	Prices []*CryptoPriceItem `json:"prices" url:"prices"`
	// Base64-encoded cursor for fetching the next page. Absent when there are no more results.
	PaginationKey *string `json:"pagination_key,omitempty" url:"pagination_key,omitempty"`
	// Number of prices in this response page. Omitted on empty responses for unknown symbols.
	Total *int `json:"total,omitempty" url:"total,omitempty"`
	// contains filtered or unexported fields
}

func (*CryptoPricesResponse) GetExtraProperties added in v0.2.0

func (c *CryptoPricesResponse) GetExtraProperties() map[string]interface{}

func (*CryptoPricesResponse) GetPaginationKey added in v0.2.0

func (c *CryptoPricesResponse) GetPaginationKey() *string

func (*CryptoPricesResponse) GetPrices added in v0.2.0

func (c *CryptoPricesResponse) GetPrices() []*CryptoPriceItem

func (*CryptoPricesResponse) GetTotal added in v0.2.0

func (c *CryptoPricesResponse) GetTotal() *int

func (*CryptoPricesResponse) MarshalJSON added in v0.2.0

func (c *CryptoPricesResponse) MarshalJSON() ([]byte, error)

func (*CryptoPricesResponse) SetPaginationKey added in v0.2.0

func (c *CryptoPricesResponse) SetPaginationKey(paginationKey *string)

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

func (*CryptoPricesResponse) SetPrices added in v0.2.0

func (c *CryptoPricesResponse) SetPrices(prices []*CryptoPriceItem)

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

func (*CryptoPricesResponse) SetTotal added in v0.2.0

func (c *CryptoPricesResponse) SetTotal(total *int)

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

func (*CryptoPricesResponse) String added in v0.2.0

func (c *CryptoPricesResponse) String() string

func (*CryptoPricesResponse) UnmarshalJSON added in v0.2.0

func (c *CryptoPricesResponse) UnmarshalJSON(data []byte) error

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error" url:"error"`
	// Additional detail about the error. May be present, including on some validation errors.
	Message    *string `json:"message,omitempty" url:"message,omitempty"`
	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) GetMessage added in v0.2.0

func (e *ErrorResponse) GetMessage() *string

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) SetMessage added in v0.2.0

func (e *ErrorResponse) SetMessage(message *string)

SetMessage sets the Message 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 GetBinanceCryptoPricesRequest added in v0.2.0

type GetBinanceCryptoPricesRequest struct {
	// Binance trading pair (e.g. `btcusdt`, `ethusdt`, `solusdt`). Must contain only alphanumeric characters (no hyphens, underscores, or other separators). Uppercase is accepted and automatically lowercased (e.g. `BTCUSDT` → `btcusdt`). Must be a valid Binance symbol; unknown symbols return `200` with an empty `prices` array.
	Currency string `json:"-" url:"currency"`
	// Start of the time range as a Unix timestamp in milliseconds (inclusive). Negative values are clamped to 0.
	StartTime *int64 `json:"-" url:"start_time,omitempty"`
	// End of the time range as a Unix timestamp in milliseconds (inclusive). Negative values are clamped to 0.
	EndTime *int64 `json:"-" url:"end_time,omitempty"`
	// Maximum number of prices to return. Defaults to 100 when a time range is present. Values above 100 are silently clamped to 100. Without a time range, this parameter is ignored — the endpoint always returns the single latest price.
	Limit *int `json:"-" url:"limit,omitempty"`
	// Base64-encoded cursor from a previous response to fetch the next page of results.
	PaginationKey *string `json:"-" url:"pagination_key,omitempty"`
	// contains filtered or unexported fields
}

func (*GetBinanceCryptoPricesRequest) SetCurrency added in v0.2.0

func (g *GetBinanceCryptoPricesRequest) SetCurrency(currency string)

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

func (*GetBinanceCryptoPricesRequest) SetEndTime added in v0.2.0

func (g *GetBinanceCryptoPricesRequest) SetEndTime(endTime *int64)

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

func (*GetBinanceCryptoPricesRequest) SetLimit added in v0.2.0

func (g *GetBinanceCryptoPricesRequest) SetLimit(limit *int)

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

func (*GetBinanceCryptoPricesRequest) SetPaginationKey added in v0.2.0

func (g *GetBinanceCryptoPricesRequest) SetPaginationKey(paginationKey *string)

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

func (*GetBinanceCryptoPricesRequest) SetStartTime added in v0.2.0

func (g *GetBinanceCryptoPricesRequest) SetStartTime(startTime *int64)

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

type GetMarketsRequest added in v0.3.0

type GetMarketsRequest struct {
	// Maximum number of markets to return per page. Range 1–100, default 25.
	Limit *int `json:"-" url:"limit,omitempty"`
	// Opaque cursor from a previous response's `pagination.nextCursor` in the SDKs (raw JSON: `pagination.next_cursor`).
	Cursor *string `json:"-" url:"cursor,omitempty"`
	// contains filtered or unexported fields
}

func (*GetMarketsRequest) SetCursor added in v0.3.0

func (g *GetMarketsRequest) SetCursor(cursor *string)

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

func (*GetMarketsRequest) SetLimit added in v0.3.0

func (g *GetMarketsRequest) SetLimit(limit *int)

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

type GetSportsMatchingMarketsRequest

type GetSportsMatchingMarketsRequest struct {
	// Maximum number of matched events to return per page. Range 1–100, default 25. Ignored when a platform-ID filter is supplied.
	Limit *int `json:"-" url:"limit,omitempty"`
	// Opaque cursor from a previous response's `pagination.nextCursor` in the SDKs (raw JSON: `pagination.next_cursor`). Must be used with the same filter set — a cursor from `include_settled=true` cannot be replayed against `include_settled=false` and will return `400`.
	Cursor *string `json:"-" url:"cursor,omitempty"`
	// When `true`, include settled/archived events alongside currently live matches. Defaults to `false`.
	IncludeSettled *bool `json:"-" url:"include_settled,omitempty"`
	// 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. Lookup mode — pagination parameters are ignored.
	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. Lookup mode — pagination parameters are ignored.
	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. Lookup mode — pagination parameters are ignored.
	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. Lookup mode — pagination parameters are ignored.
	SxbetMarketID []*string `json:"-" url:"sxbet_market_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetSportsMatchingMarketsRequest) SetCursor added in v0.3.0

func (g *GetSportsMatchingMarketsRequest) SetCursor(cursor *string)

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

func (*GetSportsMatchingMarketsRequest) SetIncludeSettled added in v0.3.0

func (g *GetSportsMatchingMarketsRequest) SetIncludeSettled(includeSettled *bool)

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

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) SetLimit added in v0.3.0

func (g *GetSportsMatchingMarketsRequest) SetLimit(limit *int)

SetLimit sets the Limit 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 MarketsListResponse added in v0.3.0

type MarketsListResponse struct {
	// Array of markets for the current page.
	Data []*UnifiedMarket `json:"data" url:"data"`
	// Pagination metadata for the current page.
	Pagination *PaginationBlock `json:"pagination" url:"pagination"`
	// contains filtered or unexported fields
}

func (*MarketsListResponse) GetData added in v0.3.0

func (m *MarketsListResponse) GetData() []*UnifiedMarket

func (*MarketsListResponse) GetExtraProperties added in v0.3.0

func (m *MarketsListResponse) GetExtraProperties() map[string]interface{}

func (*MarketsListResponse) GetPagination added in v0.3.0

func (m *MarketsListResponse) GetPagination() *PaginationBlock

func (*MarketsListResponse) MarshalJSON added in v0.3.0

func (m *MarketsListResponse) MarshalJSON() ([]byte, error)

func (*MarketsListResponse) SetData added in v0.3.0

func (m *MarketsListResponse) SetData(data []*UnifiedMarket)

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

func (*MarketsListResponse) SetPagination added in v0.3.0

func (m *MarketsListResponse) SetPagination(pagination *PaginationBlock)

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

func (*MarketsListResponse) String added in v0.3.0

func (m *MarketsListResponse) String() string

func (*MarketsListResponse) UnmarshalJSON added in v0.3.0

func (m *MarketsListResponse) UnmarshalJSON(data []byte) error

type PaginationBlock added in v0.3.0

type PaginationBlock struct {
	// Number of items requested per page (echoes the `limit` query param).
	Limit int `json:"limit" url:"limit"`
	// Total matching items across all pages.
	Total int `json:"total" url:"total"`
	// Whether additional pages exist beyond this one.
	HasMore bool `json:"has_more" url:"has_more"`
	// Opaque cursor for fetching the next page. Pass back via the `cursor` query parameter. Omitted when `has_more` is `false`. Clients must preserve the same filter set when re-using a cursor — mismatches return `400`.
	NextCursor *string `json:"next_cursor,omitempty" url:"next_cursor,omitempty"`
	// contains filtered or unexported fields
}

func (*PaginationBlock) GetExtraProperties added in v0.3.0

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

func (*PaginationBlock) GetHasMore added in v0.3.0

func (p *PaginationBlock) GetHasMore() bool

func (*PaginationBlock) GetLimit added in v0.3.0

func (p *PaginationBlock) GetLimit() int

func (*PaginationBlock) GetNextCursor added in v0.3.0

func (p *PaginationBlock) GetNextCursor() *string

func (*PaginationBlock) GetTotal added in v0.3.0

func (p *PaginationBlock) GetTotal() int

func (*PaginationBlock) MarshalJSON added in v0.3.0

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

func (*PaginationBlock) SetHasMore added in v0.3.0

func (p *PaginationBlock) SetHasMore(hasMore bool)

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

func (*PaginationBlock) SetLimit added in v0.3.0

func (p *PaginationBlock) SetLimit(limit int)

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

func (*PaginationBlock) SetNextCursor added in v0.3.0

func (p *PaginationBlock) SetNextCursor(nextCursor *string)

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

func (*PaginationBlock) SetTotal added in v0.3.0

func (p *PaginationBlock) SetTotal(total int)

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

func (*PaginationBlock) String added in v0.3.0

func (p *PaginationBlock) String() string

func (*PaginationBlock) UnmarshalJSON added in v0.3.0

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

type PaymentRequiredError added in v0.3.1

type PaymentRequiredError struct {
	*core.APIError
	Body *PaymentRequiredErrorBody
}

Endpoint requires a higher plan, the caller's paid subscription is in a payment-recovery state, or (for the Free tier) the monthly request allowance is exhausted.

func (*PaymentRequiredError) MarshalJSON added in v0.3.1

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

func (*PaymentRequiredError) UnmarshalJSON added in v0.3.1

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

func (*PaymentRequiredError) Unwrap added in v0.3.1

func (p *PaymentRequiredError) Unwrap() error

type PaymentRequiredErrorAction added in v0.3.1

type PaymentRequiredErrorAction string

Recommended client action for this 402.

const (
	PaymentRequiredErrorActionUpgradePlan    PaymentRequiredErrorAction = "upgrade_plan"
	PaymentRequiredErrorActionResolvePayment PaymentRequiredErrorAction = "resolve_payment"
)

func NewPaymentRequiredErrorActionFromString added in v0.3.1

func NewPaymentRequiredErrorActionFromString(s string) (PaymentRequiredErrorAction, error)

func (PaymentRequiredErrorAction) Ptr added in v0.3.1

type PaymentRequiredErrorBody added in v0.3.1

type PaymentRequiredErrorBody struct {
	Error string `json:"error" url:"error"`
	// Additional detail about the error.
	Message    *string `json:"message,omitempty" url:"message,omitempty"`
	StatusCode int     `json:"status_code" url:"status_code"`
	// Recommended client action for this 402.
	Action PaymentRequiredErrorAction `json:"action" url:"action"`
	// Billing tier that would satisfy the gate (e.g. `starter`, `pro`, `business`, `enterprise`).
	RequiredTier string `json:"required_tier" url:"required_tier"`
	// Billing tier currently associated with the caller.
	CurrentTier string `json:"current_tier" url:"current_tier"`
	// Monthly Free-tier allowance. Present only when the 402 is caused by the Free cap.
	IncludedRequestsPerMonth *int64 `json:"included_requests_per_month,omitempty" url:"included_requests_per_month,omitempty"`
	// Requests the Free caller has made in the current calendar month. Present only when the 402 is caused by the Free cap.
	CurrentPeriodRequests *int64 `json:"current_period_requests,omitempty" url:"current_period_requests,omitempty"`
	// contains filtered or unexported fields
}

func (*PaymentRequiredErrorBody) GetAction added in v0.3.1

func (*PaymentRequiredErrorBody) GetCurrentPeriodRequests added in v0.3.1

func (p *PaymentRequiredErrorBody) GetCurrentPeriodRequests() *int64

func (*PaymentRequiredErrorBody) GetCurrentTier added in v0.3.1

func (p *PaymentRequiredErrorBody) GetCurrentTier() string

func (*PaymentRequiredErrorBody) GetError added in v0.3.1

func (p *PaymentRequiredErrorBody) GetError() string

func (*PaymentRequiredErrorBody) GetExtraProperties added in v0.3.1

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

func (*PaymentRequiredErrorBody) GetIncludedRequestsPerMonth added in v0.3.1

func (p *PaymentRequiredErrorBody) GetIncludedRequestsPerMonth() *int64

func (*PaymentRequiredErrorBody) GetMessage added in v0.3.1

func (p *PaymentRequiredErrorBody) GetMessage() *string

func (*PaymentRequiredErrorBody) GetRequiredTier added in v0.3.1

func (p *PaymentRequiredErrorBody) GetRequiredTier() string

func (*PaymentRequiredErrorBody) GetStatusCode added in v0.3.1

func (p *PaymentRequiredErrorBody) GetStatusCode() int

func (*PaymentRequiredErrorBody) MarshalJSON added in v0.3.1

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

func (*PaymentRequiredErrorBody) SetAction added in v0.3.1

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

func (*PaymentRequiredErrorBody) SetCurrentPeriodRequests added in v0.3.1

func (p *PaymentRequiredErrorBody) SetCurrentPeriodRequests(currentPeriodRequests *int64)

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

func (*PaymentRequiredErrorBody) SetCurrentTier added in v0.3.1

func (p *PaymentRequiredErrorBody) SetCurrentTier(currentTier string)

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

func (*PaymentRequiredErrorBody) SetError added in v0.3.1

func (p *PaymentRequiredErrorBody) 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 (*PaymentRequiredErrorBody) SetIncludedRequestsPerMonth added in v0.3.1

func (p *PaymentRequiredErrorBody) SetIncludedRequestsPerMonth(includedRequestsPerMonth *int64)

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

func (*PaymentRequiredErrorBody) SetMessage added in v0.3.1

func (p *PaymentRequiredErrorBody) SetMessage(message *string)

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

func (*PaymentRequiredErrorBody) SetRequiredTier added in v0.3.1

func (p *PaymentRequiredErrorBody) SetRequiredTier(requiredTier string)

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

func (*PaymentRequiredErrorBody) SetStatusCode added in v0.3.1

func (p *PaymentRequiredErrorBody) 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 (*PaymentRequiredErrorBody) String added in v0.3.1

func (p *PaymentRequiredErrorBody) String() string

func (*PaymentRequiredErrorBody) UnmarshalJSON added in v0.3.1

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

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"`
	// Pagination metadata for the current page. Present in list mode (no platform-ID filter). Absent in lookup mode since the response is bounded by the filter.
	Pagination *PaginationBlock `json:"pagination,omitempty" url:"pagination,omitempty"`
	// 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) GetPagination added in v0.3.0

func (s *SportsMatchingResponse) GetPagination() *PaginationBlock

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) SetPagination added in v0.3.0

func (s *SportsMatchingResponse) SetPagination(pagination *PaginationBlock)

SetPagination sets the Pagination 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

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

type UnifiedMarket added in v0.3.0

type UnifiedMarket struct {
	// Composite market identifier in the format `{provider}:{provider_id}` (e.g. `kalshi:KXNBAGAME-26MAR06INDLAL-LAL`).
	ID string `json:"id" url:"id"`
	// Prediction market provider.
	Provider UnifiedMarketProvider `json:"provider" url:"provider"`
	// Human-readable market title/question.
	Title string `json:"title" url:"title"`
	// contains filtered or unexported fields
}

func (*UnifiedMarket) GetExtraProperties added in v0.3.0

func (u *UnifiedMarket) GetExtraProperties() map[string]interface{}

func (*UnifiedMarket) GetID added in v0.3.0

func (u *UnifiedMarket) GetID() string

func (*UnifiedMarket) GetProvider added in v0.3.0

func (u *UnifiedMarket) GetProvider() UnifiedMarketProvider

func (*UnifiedMarket) GetTitle added in v0.3.0

func (u *UnifiedMarket) GetTitle() string

func (*UnifiedMarket) MarshalJSON added in v0.3.0

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

func (*UnifiedMarket) SetID added in v0.3.0

func (u *UnifiedMarket) SetID(id string)

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

func (*UnifiedMarket) SetProvider added in v0.3.0

func (u *UnifiedMarket) SetProvider(provider UnifiedMarketProvider)

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

func (*UnifiedMarket) SetTitle added in v0.3.0

func (u *UnifiedMarket) SetTitle(title string)

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

func (*UnifiedMarket) String added in v0.3.0

func (u *UnifiedMarket) String() string

func (*UnifiedMarket) UnmarshalJSON added in v0.3.0

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

type UnifiedMarketProvider added in v0.3.0

type UnifiedMarketProvider string

Prediction market provider.

const (
	UnifiedMarketProviderKalshi     UnifiedMarketProvider = "kalshi"
	UnifiedMarketProviderPolymarket UnifiedMarketProvider = "polymarket"
	UnifiedMarketProviderPredict    UnifiedMarketProvider = "predict"
	UnifiedMarketProviderSxbet      UnifiedMarketProvider = "sxbet"
)

func NewUnifiedMarketProviderFromString added in v0.3.0

func NewUnifiedMarketProviderFromString(s string) (UnifiedMarketProvider, error)

func (UnifiedMarketProvider) Ptr added in v0.3.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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