pereval

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Pereval Go SDK

Build a dating network integration with the Pereval partner API. The SDK covers the 39 HTTP operations in protocol 1.0.1 and the authenticated photo route. It handles HTTP requests, webhook verification and response decoding. Your application owns consent, storage, retries and scheduling.

Get started

Install the SDK with Go 1.23 or later.

go get github.com/pereval-dating/pereval-go@v1.1.0

Import the module as pereval. For production, use the latest stable Go release. See the Go API reference for all services and types.

Keep the partner key on your server. Pass the API origin without a version suffix.

package main

import (
    "context"
    "fmt"
    "log"
    "os"
    "time"

    "github.com/pereval-dating/pereval-go"
)

func main() {
    client, err := pereval.New("https://api.pereval.dating", os.Getenv("PEREVAL_API_KEY"))
    if err != nil { log.Fatal(err) }
    ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
    defer cancel()
    caps, err := client.Capabilities.Get(ctx)
    if err != nil { log.Fatal(err) }
    if caps.Mode != "sandbox" { log.Fatal("expected a sandbox key") }
    fmt.Println(caps.ProtocolVersion, caps.Mode)
}

Run the examples

From a checkout, each command uses local fixtures by default. No account is required.

Command What it demonstrates
go run ./examples/quickstart Check the protocol version and key mode. Add -sandbox to make one read-only API call with PEREVAL_API_KEY.
go run ./examples/messaging Send a message after a mutual like.
go run ./examples/webhook Verify the original request body and handle duplicate deliveries.
go run ./examples/polling Process a page before advancing its cursor.

Choose a service

Client field Use
Capabilities, Languages, Health Discover available features and languages, check readiness
Members, Feed, Photos Sync profiles, fetch candidates and photos, track photo checks
Likes, Matches, Messages Record reactions, manage matches and exchange messages
Moderation Block or report a member
Webhooks, Events Receive signed notifications or poll for events
Commerce Check availability, request quotes and place orders
MCP Make JSON-RPC calls and inspect the tool result, including isError

Use go doc MembersService or go doc MessagesService.Send to inspect signatures. Configure HTTP, WebhookSecret and CommerceKey before sharing the client across goroutines. Use NewClient(Config{...}) only with prevalidated settings. It skips the HTTPS check.

  • Use string external IDs for your members and network IDs for peers. Inspect each result of Members.UpsertBatch for errors.
  • Choose one event delivery mechanism. Pass the raw body and X-Network-Signature to Webhooks.Parse. Acknowledge after durable storage. Polling with Events.List marks events delivered. Start at zero and commit NextAfter with the processed page. Deduplicate by event ID in both cases.
  • Use errors.As with *pereval.Error for HTTP errors and *pereval.RPCError for JSON-RPC failures. The SDK does not schedule retries. Preserve action references, client message IDs and external order references when retrying the same operation.

See the migration notes and development guide.

License

MIT

Transport and logging

Use an existing HTTP client via Config.HTTP or client.HTTP. To compose middleware, call client.HTTP = pereval.WrapHTTP(shared, pereval.SlogLogger(slog.Default()), identify) before sharing the SDK client. Working example.

The wrapper copies the client, reuses its pool and leaves closing idle connections to the owner. Supply any concurrency-safe http.RoundTripper or use RoundTripFunc. Middleware wraps the transport once, with the first layer outermost. Clone a request before changing headers. SDK calls stop at redirects. Configure timeouts on the client or with context deadlines.

Use a custom Logger, LoggerFunc, or any slog handler. Logs contain method, status (zero for transport failure), level and elapsed time to response headers. No URL, payload, credential or error text is logged. The callback runs synchronously, so queue slow log writes.

Documentation

Overview

Package pereval implements the Pereval network partner API.

Index

Constants

This section is empty.

Variables

View Source
var ErrSignature = errors.New("pereval: invalid webhook signature")

ErrSignature indicates a missing secret or an invalid webhook signature.

Functions

func WrapHTTP added in v1.1.0

func WrapHTTP(base *http.Client, logger Logger, layers ...Middleware) *http.Client

WrapHTTP copies a client, sharing its transport and connection pool. The caller owns the pool. A nil client uses http.DefaultTransport and a 20-second timeout. Assign the result to Config.HTTP for every service, including photo downloads.

Types

type Balance

type Balance struct {
	Currency string `json:"currency"`
	TestOnly bool   `json:"test_only"`
	Balance  int64  `json:"balance"`
}

Balance reports the partner account balance and currency.

type BatchError

type BatchError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

BatchError describes a single failed item in a successful batch response.

type BatchMember

type BatchMember struct {
	ExternalID string `json:"external_id"`
	Member
}

BatchMember pairs a local external ID with its profile.

type BatchResult

type BatchResult struct {
	ExternalID string `json:"external_id"`
	MemberResult
	Error *BatchError `json:"error,omitempty"`
}

BatchResult contains either a member result or a per-item error.

type BlockRequest

type BlockRequest struct {
	From  string `json:"from"`
	To    string `json:"to"`
	Erase bool   `json:"erase"`
}

BlockRequest controls whether blocking also erases both users' history.

type BoostState

type BoostState struct {
	Until       *time.Time `json:"boost_until,omitempty"`
	Generation  uuid.UUID  `json:"generation"`
	State       string     `json:"state"`
	StartedAt   time.Time  `json:"started_at"`
	RemainingMS int64      `json:"remaining_ms"`
	Placements  int64      `json:"api_placements"`
}

BoostState reports the remaining visibility boost and placement count.

type Capabilities

type Capabilities struct {
	Mode                 string `json:"mode"`
	CommerceEnabled      bool   `json:"commerce_enabled"`
	CommerceLiveZeroOnly bool   `json:"commerce_live_zero_only"`
	CommercePilot        bool   `json:"commerce_pilot"`
	ProtocolVersion      string `json:"protocol_version"`
	ClientMessageID      bool   `json:"client_message_id"`
	Videos               bool   `json:"videos"`
	PhotoChecks          bool   `json:"photo_checks"`
	ProfileModeration    bool   `json:"profile_moderation"`
}

Capabilities describes the protocol, key mode and features available to this partner.

type CapabilitiesService

type CapabilitiesService struct {
	// contains filtered or unexported fields
}

CapabilitiesService discovers the protocol and features available to a partner.

func (CapabilitiesService) Get

Get rejects missing or unknown modes so callers cannot mistake live data for a sandbox.

type CheckPhoto

type CheckPhoto struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

CheckPhoto identifies a photo submitted for verification.

type City

type City struct {
	Name    string   `json:"name"`
	Country string   `json:"country"`
	Lat     *float64 `json:"lat,omitempty"`
	Lon     *float64 `json:"lon,omitempty"`
}

City keeps the profile city separate from the optional current coordinates.

type Client

type Client struct {
	Config
	Members      MembersService
	Feed         FeedService
	Likes        LikesService
	Matches      MatchesService
	Messages     MessagesService
	Events       EventsService
	Webhooks     WebhooksService
	Photos       PhotosService
	Moderation   ModerationService
	Commerce     CommerceService
	Health       HealthService
	Languages    LanguagesService
	MCP          MCPService
	Capabilities CapabilitiesService
}

Client shares its configuration across services. Construct it with New or NewClient. Do not copy it or change settings while requests are in flight.

func New

func New(baseURL, apiKey string) (*Client, error)

New validates an HTTPS endpoint and partner key before constructing a client.

func NewClient

func NewClient(cfg Config) *Client

NewClient supports prevalidated settings, including private HTTP endpoints and disabled integrations. Call Enabled before using an optional integration.

func (*Client) Enabled

func (c *Client) Enabled() bool

Enabled reports whether an endpoint and partner key are configured.

type CommerceCatalog

type CommerceCatalog struct {
	Currency string            `json:"currency"`
	TestOnly bool              `json:"test_only"`
	Items    []CommerceProduct `json:"items"`
}

CommerceCatalog lists available products in the account's currency.

type CommerceGrant

type CommerceGrant struct {
	ID         uuid.UUID  `json:"id"`
	Capability string     `json:"capability"`
	Quantity   int64      `json:"quantity"`
	Used       int64      `json:"used"`
	ValidFrom  time.Time  `json:"valid_from"`
	ValidUntil *time.Time `json:"valid_until"`
	RevokedAt  *time.Time `json:"revoked_at"`
}

CommerceGrant records the entitlement and its usage.

type CommerceOrder

type CommerceOrder struct {
	CreatedAt  time.Time  `json:"created_at,omitempty"`
	Reference  string     `json:"external_order_ref,omitempty"`
	ID         uuid.UUID  `json:"id"`
	QuoteID    uuid.UUID  `json:"quote_id"`
	Total      int64      `json:"total"`
	Currency   string     `json:"currency"`
	GrantID    uuid.UUID  `json:"grant_id"`
	ValidFrom  time.Time  `json:"valid_from"`
	ValidUntil *time.Time `json:"valid_until"`
}

CommerceOrder describes a purchase and its resulting grant.

type CommerceProduct

type CommerceProduct struct {
	Version     int64  `json:"version,omitempty"`
	Currency    string `json:"currency,omitempty"`
	SKU         string `json:"sku"`
	Capability  string `json:"capability"`
	Unit        string `json:"unit"`
	UnitPrice   int64  `json:"unit_price"`
	MinQuantity int64  `json:"min_quantity"`
	MaxQuantity int64  `json:"max_quantity"`
	Ready       bool   `json:"fulfillment_ready"`
}

CommerceProduct describes a service and its quantity limits.

type CommerceQuote

type CommerceQuote struct {
	CatalogVersion int64     `json:"catalog_version,omitempty"`
	ID             uuid.UUID `json:"id"`
	MemberID       uuid.UUID `json:"member_id"`
	SKU            string    `json:"sku"`
	Capability     string    `json:"capability"`
	Unit           string    `json:"unit"`
	Quantity       int64     `json:"quantity"`
	UnitPrice      int64     `json:"unit_price"`
	Total          int64     `json:"total"`
	ExpiresAt      time.Time `json:"expires_at"`
	Currency       string    `json:"currency"`
}

CommerceQuote locks pricing for the specified quantity until expiry.

type CommerceService

type CommerceService struct {
	// contains filtered or unexported fields
}

CommerceService manages quotes, orders and entitlements.

func (CommerceService) Balance

func (s CommerceService) Balance(ctx context.Context) (Balance, error)

Balance returns the account balance.

func (CommerceService) Boost

func (s CommerceService) Boost(ctx context.Context, member string) (*BoostState, error)

Boost gets the current boost state for a local member.

func (CommerceService) Catalog

Catalog lists services and prices.

func (CommerceService) Grants

func (s CommerceService) Grants(ctx context.Context, member string) ([]CommerceGrant, error)

Grants lists entitlements for a local member.

func (CommerceService) Incognito

func (s CommerceService) Incognito(ctx context.Context, member string, enabled *bool) (bool, error)

Incognito reads the current visibility setting when enabled is nil, or updates it otherwise.

func (CommerceService) Order

func (s CommerceService) Order(ctx context.Context, quoteID uuid.UUID, externalOrderRef string) (*CommerceOrder, error)

Order redeems a quote using the commerce key. Reuse the same external reference on retries.

func (CommerceService) Quote

func (s CommerceService) Quote(ctx context.Context, member string, sku string, quantity int64) (*CommerceQuote, error)

Quote requests a price for a local member and SKU.

func (CommerceService) SetDelivery

func (s CommerceService) SetDelivery(ctx context.Context, format string, enabled bool) (Delivery, error)

SetDelivery sets the delivery format and whether the partner accepts promoted placements.

type Config

type Config struct {
	BaseURL       string
	APIKey        string
	CommerceKey   string
	WebhookSecret string
	HTTP          *http.Client
}

Config holds trusted application settings. Use New for public HTTPS endpoints.

type Consent struct {
	Network       bool      `json:"network"`
	CrossLanguage bool      `json:"cross_language"`
	World         bool      `json:"world"`
	GivenAt       time.Time `json:"given_at"`
	TextVersion   string    `json:"text_version"`
}

Consent records when and how a member opted into network features.

type Delivery

type Delivery struct {
	Format  string `json:"format"`
	Enabled bool   `json:"enabled"`
	Version int    `json:"version"`
}

Delivery describes how promoted profiles are delivered.

type EndMatchRequest

type EndMatchRequest struct {
	MatchID, By  string
	Erase        bool
	CooldownDays int
}

EndMatchRequest controls whether both sides lose history and when they can meet again.

type Error

type Error struct {
	Status int
	Code   string `json:"error"`
	Msg    string `json:"message"`
}

Error contains the HTTP status and the partner API error code and message.

func (*Error) Error

func (e *Error) Error() string

type Event

type Event struct {
	Seq       int64           `json:"seq,omitempty"`
	ID        string          `json:"id"`
	Type      string          `json:"type"`
	CreatedAt time.Time       `json:"created_at"`
	Data      json.RawMessage `json:"data"`
}

Event is shared by polling and webhooks. Only polling sets Seq. Decode Data according to Type.

type EventPage

type EventPage struct {
	Items     []Event `json:"items"`
	NextAfter int64   `json:"next_after"`
}

EventPage holds a batch of events and the next polling cursor.

type EventsService

type EventsService struct {
	// contains filtered or unexported fields
}

EventsService polls for events by sequence number.

func (EventsService) List

func (s EventsService) List(ctx context.Context, after int64, limit int) (EventPage, error)

List marks returned events delivered. Commit NextAfter only after processing all items. A zero limit selects 100.

type FeedPage

type FeedPage struct {
	RemainingToday int       `json:"remaining_today,omitempty"`
	Items          []Profile `json:"items"`
	NextCursor     string    `json:"next_cursor"`
}

FeedPage contains profiles, the remaining allowance and the next page cursor.

type FeedParams

type FeedParams struct {
	AgeMin, AgeMax           int
	Intent, Language, Gender string
	Limit                    int
	Scope                    string
	RadiusKM                 int
	HeightMin, HeightMax     int
	VerifiedOnly             bool
	Lat, Lon                 *float64
	City, Country            string
	Cursor, RequestRef       string
}

FeedParams selects nearby or world profiles. Supply both coordinates or neither.

type FeedService

type FeedService struct {
	// contains filtered or unexported fields
}

FeedService fetches candidate profiles for a member.

func (FeedService) List

func (s FeedService) List(ctx context.Context, externalID string, f FeedParams) (FeedPage, error)

List returns a page of profiles for a local external ID.

type HealthService

type HealthService struct {
	// contains filtered or unexported fields
}

HealthService checks service liveness and readiness.

func (HealthService) Live

func (s HealthService) Live(ctx context.Context) error

Live checks process liveness without sending credentials.

func (HealthService) Ready

func (s HealthService) Ready(ctx context.Context) error

Ready checks database readiness without sending credentials.

type IncomingLike

type IncomingLike struct {
	From    Profile   `json:"from"`
	LikedAt time.Time `json:"liked_at"`
}

IncomingLike describes a pending like received by a local member.

type LanguagesService

type LanguagesService struct {
	// contains filtered or unexported fields
}

LanguagesService lists supported languages.

func (LanguagesService) List

func (s LanguagesService) List(ctx context.Context) ([]string, error)

List returns language codes supported for translation.

type LikeRequest

type LikeRequest struct {
	From      string `json:"from"`
	To        string `json:"to"`
	Super     bool   `json:"super,omitempty"`
	Message   string `json:"message,omitempty"`
	ActionRef string `json:"-"`
}

LikeRequest sends a like or, with Super set, a superlike with an optional message. Reuse ActionRef only for retries of the same action.

type LikeResult

type LikeResult struct {
	Matched bool   `json:"matched"`
	MatchID string `json:"match_id"`
}

LikeResult reports whether a like created a match.

type LikesService

type LikesService struct {
	// contains filtered or unexported fields
}

LikesService manages reactions and incoming likes.

func (LikesService) Create

func (s LikesService) Create(ctx context.Context, req LikeRequest) (*LikeResult, error)

Create records a like and reports whether a new match was made.

func (LikesService) Dislike

func (s LikesService) Dislike(ctx context.Context, from, to string) error

Dislike skips a profile for the current member.

func (LikesService) DislikeBatch

func (s LikesService) DislikeBatch(ctx context.Context, pairs []Pair) error

DislikeBatch submits multiple skips in a single request.

func (LikesService) List

func (s LikesService) List(ctx context.Context, member string, limit int) ([]IncomingLike, error)

List returns incoming likes awaiting a response.

func (LikesService) UndoDislike

func (s LikesService) UndoDislike(ctx context.Context, from, to string, actionRef string) error

UndoDislike returns a skipped profile to the feed.

func (LikesService) Withdraw

func (s LikesService) Withdraw(ctx context.Context, from, to string, actionRef string) error

Withdraw retracts a pending like. A completed match cannot be withdrawn this way.

type LogEntry added in v1.1.0

type LogEntry struct {
	Method   string
	Status   int
	Duration time.Duration
	Level    slog.Level
}

LogEntry describes the exchange up to response headers. Status is zero on transport failure. The SDK never includes URLs, headers, bodies or raw errors in the entry.

type Logger added in v1.1.0

type Logger interface {
	LogHTTP(context.Context, LogEntry)
}

Logger receives HTTP metadata. Implementations must be concurrency-safe.

func SlogLogger added in v1.1.0

func SlogLogger(l *slog.Logger) Logger

SlogLogger connects a standard structured logger or any compatible slog.Handler.

type LoggerFunc added in v1.1.0

type LoggerFunc func(context.Context, LogEntry)

LoggerFunc adapts a callback to Logger.

func (LoggerFunc) LogHTTP added in v1.1.0

func (f LoggerFunc) LogHTTP(ctx context.Context, entry LogEntry)

type MCPService

type MCPService struct {
	// contains filtered or unexported fields
}

MCPService calls JSON-RPC methods.

func (MCPService) Call

func (s MCPService) Call(ctx context.Context, method string, params, result any) error

Call performs a stateless JSON-RPC request. For tools/call, check the result's isError field as well as the returned error.

type Match

type Match struct {
	MatchID      string    `json:"match_id"`
	With         Profile   `json:"with"`
	CreatedAt    time.Time `json:"created_at"`
	Frozen       bool      `json:"frozen"`
	FreezeReason string    `json:"freeze_reason,omitempty"`
}

Match describes the other member and whether the conversation is frozen.

type MatchesService

type MatchesService struct {
	// contains filtered or unexported fields
}

MatchesService lists matches and manages shared history.

func (MatchesService) ClearHistory

func (s MatchesService) ClearHistory(ctx context.Context, matchID, as string) error

ClearHistory clears history for the specified participant only.

func (MatchesService) End

End closes a match. Set Erase explicitly to remove both users' history.

func (MatchesService) List

func (s MatchesService) List(ctx context.Context, member string) ([]Match, error)

List returns open matches for a local external ID.

type Member

type Member struct {
	Videos          []Video    `json:"videos,omitempty"`
	Consent         Consent    `json:"consent"`
	DisplayName     string     `json:"display_name"`
	BirthYear       int        `json:"birth_year"`
	Gender          string     `json:"gender"`
	AgeMin          int        `json:"age_min"`
	AgeMax          int        `json:"age_max"`
	Languages       []string   `json:"languages"`
	City            City       `json:"city"`
	Bio             string     `json:"bio"`
	Photos          []string   `json:"photos"`
	PhotoVerified   bool       `json:"photo_verified"`
	Intents         []string   `json:"intents"`
	ArrangementRole string     `json:"arrangement_role,omitempty"`
	LastActiveAt    *time.Time `json:"last_active_at,omitempty"`
	HeightCM        *int       `json:"height_cm,omitempty"`
	ShowDistance    bool       `json:"show_distance,omitempty"`

	Verification *Verification `json:"verification,omitempty"`
}

Member is the profile submitted by the member's own platform.

type MemberResult

type MemberResult struct {
	NetworkID     string `json:"network_id"`
	PhotoVerified *bool  `json:"photo_verified,omitempty"`
	Verification  string `json:"verification,omitempty"`
}

MemberResult reports the assigned network ID and photo verification status.

type MembersService

type MembersService struct {
	// contains filtered or unexported fields
}

MembersService synchronizes profiles and manages their lifecycle.

func (MembersService) Deactivate

func (s MembersService) Deactivate(ctx context.Context, externalID string) error

Deactivate temporarily hides the member and freezes their matches.

func (MembersService) Reinstate

func (s MembersService) Reinstate(ctx context.Context, externalID string) error

Reinstate restores a member after a moderation decision.

func (MembersService) Remove

func (s MembersService) Remove(ctx context.Context, externalID, reason string) error

Remove removes the member. Use account_deleted or left_network as the reason. An absent member counts as success.

func (MembersService) Restore

func (s MembersService) Restore(ctx context.Context, externalID string) error

Restore reactivates a previously deactivated account.

func (MembersService) Touch

func (s MembersService) Touch(ctx context.Context, externalID string) error

Touch records recent activity for one member.

func (MembersService) TouchBatch

func (s MembersService) TouchBatch(ctx context.Context, ids []string) (int, error)

TouchBatch records activity and returns the number of updated members.

func (MembersService) Upsert

func (s MembersService) Upsert(ctx context.Context, externalID string, m *Member) (MemberResult, error)

Upsert creates or updates a profile by its ID on the calling platform.

func (MembersService) UpsertBatch

func (s MembersService) UpsertBatch(ctx context.Context, members []BatchMember) ([]BatchResult, error)

UpsertBatch submits multiple profiles. Inspect each result for an item-specific error.

type Message

type Message struct {
	ReadAt          *time.Time `json:"read_at,omitempty"`
	Flags           []string   `json:"flags,omitempty"`
	Suspicious      bool       `json:"suspicious,omitempty"`
	From            string     `json:"from,omitempty"`
	ClientMessageID string     `json:"client_message_id,omitempty"`
	ID              string     `json:"id"`
	Text            string     `json:"text"`
	TextOriginal    string     `json:"text_original"`
	Translated      bool       `json:"translated"`
	Lang            string     `json:"lang"`
	CreatedAt       time.Time  `json:"created_at"`
}

Message includes the text as shown to the viewer and any available original.

type MessagesService

type MessagesService struct {
	// contains filtered or unexported fields
}

MessagesService sends, reads and acknowledges messages.

func (MessagesService) List

func (s MessagesService) List(ctx context.Context, matchID, as, before string, limit int) ([]Message, error)

List returns history for the viewer. Leave before empty to read the newest page.

func (MessagesService) MarkRead

func (s MessagesService) MarkRead(ctx context.Context, matchID, as, upTo string) error

MarkRead acknowledges messages through the specified network message ID.

func (MessagesService) Send

func (s MessagesService) Send(ctx context.Context, req SendRequest) (*Message, error)

Send posts a message to the specified match.

type Middleware added in v1.1.0

type Middleware func(http.RoundTripper) http.RoundTripper

Middleware wraps the next transport once, in declaration order (outermost first). Transports must be safe for concurrent use.

type ModerationService

type ModerationService struct {
	// contains filtered or unexported fields
}

ModerationService handles blocks and reports.

func (ModerationService) Block

Block prevents future contact between two members.

func (ModerationService) Report

func (s ModerationService) Report(ctx context.Context, from, to, reason, comment string) error

Report submits a member complaint to the network.

type Pair

type Pair struct {
	From string `json:"from"`
	To   string `json:"to"`
}

Pair identifies a local sender and a remote network profile.

type Partner

type Partner struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Partner identifies the platform that owns a profile.

type PhotoCheck

type PhotoCheck struct {
	CreatedAt    time.Time  `json:"created_at,omitempty"`
	Attempts     int        `json:"attempts,omitempty"`
	ID           string     `json:"id"`
	Ref          string     `json:"ref"`
	URL          string     `json:"url"`
	Status       string     `json:"status"`
	Reason       string     `json:"reason"`
	ExpiresAt    time.Time  `json:"expires_at"`
	CheckedAt    *time.Time `json:"checked_at"`
	DisputeUntil *time.Time `json:"dispute_until"`
	DisputedAt   *time.Time `json:"disputed_at"`
	DecidedAt    *time.Time `json:"decided_at"`
	Note         string     `json:"note"`
	Photos       []struct {
		URL     string `json:"url"`
		ID      string `json:"id"`
		Verdict string `json:"verdict"`
	} `json:"photos"`
}

PhotoCheck describes a verification session and its per-photo verdicts.

type PhotosService

type PhotosService struct {
	// contains filtered or unexported fields
}

PhotosService retrieves photos and manages verification checks.

func (PhotosService) Browse

func (s PhotosService) Browse(ctx context.Context, viewer, peer, key string) ([]byte, string, error)

Browse downloads an authenticated profile image and returns its MIME type.

func (PhotosService) CreateCheck

func (s PhotosService) CreateCheck(ctx context.Context, ref, lang, returnURL string, photos []CheckPhoto) (*PhotoCheck, error)

CreateCheck starts a verification session and returns a URL for the member.

func (PhotosService) GetCheck

func (s PhotosService) GetCheck(ctx context.Context, id string) (*PhotoCheck, error)

GetCheck retrieves a verification session by network check ID.

type Profile

type Profile struct {
	VerifiedBy      string     `json:"verified_by,omitempty"`
	Promotion       *Promotion `json:"promotion,omitempty"`
	NetworkID       string     `json:"network_id"`
	Partner         Partner    `json:"partner"`
	DisplayName     string     `json:"display_name"`
	Age             int        `json:"age"`
	Gender          string     `json:"gender"`
	City            string     `json:"city"`
	Country         string     `json:"country,omitempty"`
	DistanceKM      *int       `json:"distance_km,omitempty"`
	Languages       []string   `json:"languages"`
	Bio             string     `json:"bio"`
	BioOriginal     string     `json:"bio_original,omitempty"`
	BioTranslated   bool       `json:"bio_translated"`
	Photos          []string   `json:"photos"`
	Videos          []Video    `json:"videos,omitempty"`
	PhotoVerified   bool       `json:"photo_verified"`
	Intents         []string   `json:"intents"`
	ArrangementRole string     `json:"arrangement_role,omitempty"`
	HeightCM        *int       `json:"height_cm,omitempty"`

	SuperLike *SuperLike `json:"super_like,omitempty"`
}

Profile is a network profile as seen by the requesting member.

type Promotion

type Promotion struct {
	Generation string `json:"generation"`
	Kind       string `json:"kind"`
}

Promotion identifies a promoted placement in a feed.

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

RPCError reports a JSON-RPC failure. Tool errors appear in the result's isError field.

func (*RPCError) Error

func (e *RPCError) Error() string

type RoundTripFunc added in v1.1.0

type RoundTripFunc func(*http.Request) (*http.Response, error)

RoundTripFunc adapts a function to http.RoundTripper.

func (RoundTripFunc) RoundTrip added in v1.1.0

func (f RoundTripFunc) RoundTrip(r *http.Request) (*http.Response, error)

type SendRequest

type SendRequest struct {
	MatchID         string `json:"-"`
	From            string `json:"from"`
	Text            string `json:"text"`
	ClientMessageID string `json:"client_message_id,omitempty"`
}

SendRequest identifies a message. Keep ClientMessageID stable across retries.

type SuperLike

type SuperLike struct {
	Lang            string   `json:"lang,omitempty"`
	Message         string   `json:"message,omitempty"`
	MessageOriginal string   `json:"message_original,omitempty"`
	Translated      bool     `json:"translated"`
	Flags           []string `json:"flags,omitempty"`
}

SuperLike includes the sender's message and any available translation.

type Verification

type Verification struct {
	Method     string     `json:"method,omitempty"`
	Provider   string     `json:"provider,omitempty"`
	VerifiedAt *time.Time `json:"verified_at,omitempty"`
	CheckID    string     `json:"check_id,omitempty"`
}

Verification identifies a partner verification method or a completed Pereval photo check.

type Video

type Video struct {
	URL    string `json:"url"`
	Poster string `json:"poster"`
}

Video pairs a video with its cover image.

type WebhooksService

type WebhooksService struct {
	// contains filtered or unexported fields
}

WebhooksService authenticates and decodes incoming events.

func (WebhooksService) Parse

func (s WebhooksService) Parse(body []byte, signature string) (*Event, error)

Parse verifies the signature before decoding and validating the event envelope.

func (WebhooksService) Verify

func (s WebhooksService) Verify(body []byte, signature string) bool

Verify checks X-Network-Signature against the original, unmodified request body.

Directories

Path Synopsis
examples
extensions command
Demonstrate shared pools, middleware and logging without sending a request.
Demonstrate shared pools, middleware and logging without sending a request.
internal/demo
Package demo supplies offline responses for the examples.
Package demo supplies offline responses for the examples.
messaging command
Command messaging sends a greeting when a like creates a match.
Command messaging sends a greeting when a like creates a match.
polling command
Command polling drains a finite stream of example events.
Command polling drains a finite stream of example events.
quickstart command
Command quickstart reads the partner's protocol version and key mode.
Command quickstart reads the partner's protocol version and key mode.
webhook command
Command webhook verifies a signed example event without opening a port.
Command webhook verifies a signed example event without opening a port.

Jump to

Keyboard shortcuts

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