scambus

package module
v0.0.0-...-50c8d38 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 22 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

SCAMBUS Go Client

Official Go client for SCAMBUS. Submit scam reports, search identifiers and cases, manage export streams, and receive live data over SSE or WebSocket.

go get github.com/scambus/go-client

Features

  • Submit scam reports — phone calls, emails, text conversations, continuations, detections, notes, imports and exports
  • Tagging — apply boolean and valued tags when you create an entry
  • Search — identifiers, cases and journal entries, with cursor pagination helpers
  • Views — create, execute and manage saved queries
  • In-progress activities — start an open activity and close it later
  • Work queues — claim, contact, complete, drop and move items
  • Data streams — create export streams for journal entries or identifier state changes
  • Stream consumption — poll for batches, or subscribe over SSE with automatic resume
  • Real-time updates — WebSocket client for notifications and live streams
  • Cases and evidence — manage investigations and attach media
  • Reports — generate and download signed PDF reports
  • Automations — create automation identities and rotate API keys
  • Automatic authentication — shares cached credentials with the SCAMBUS CLI

Quick start

package main

import (
	"context"
	"fmt"
	"log"

	scambus "github.com/scambus/go-client"
)

func main() {
	client, err := scambus.New()
	if err != nil {
		log.Fatal(err)
	}

	entry, err := client.Journal.CreateDetection(context.Background(), scambus.DetectionInput{
		Description: "Automated phishing detection",
		Identifiers: []scambus.IdentifierLookup{
			{Type: scambus.IdentifierTypePhone, Value: "+12125551234", Confidence: scambus.Ptr(0.9)},
			{Type: scambus.IdentifierTypeEmail, Value: "scammer@example.com", Confidence: scambus.Ptr(0.95)},
		},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(entry.ID)
}

Authentication

New resolves credentials in this order: explicit options, environment variables, then ~/.scambus/config.json written by the CLI. An API key wins over a bearer token when both are present.

client, err := scambus.New(
	scambus.WithAPIURL("https://scambus.net/api"),
	scambus.WithAPIKey(keyID, keySecret),
)
Variable Purpose
SCAMBUS_API_KEY_ID API key id
SCAMBUS_API_KEY_SECRET API key secret
SCAMBUS_API_TOKEN Bearer token
SCAMBUS_API_URL Base URL (SCAMBUS_URL also works)

Run scambus auth login with the CLI and the Go client picks the token up with no configuration at all.

Options

client, err := scambus.New(
	scambus.WithTimeout(30*time.Second),
	scambus.WithMaxRetries(10),
	scambus.WithRetryMaxTime(5*time.Minute),
	scambus.WithHTTPClient(myClient),
	scambus.WithLogger(slog.Default()),
)

Transient failures retry with full-jitter exponential backoff and honour Retry-After. Cancelling the context stops the retry loop.

A 408, a 429 or a 503 with Retry-After means the server did not process the request, so any method is replayed. Another 5xx or a dropped connection may follow a committed write, so only idempotent methods are replayed there. Such a failed POST is reported, never repeated.

The client refuses HTTP redirects: credentials travel in headers, and Go forwards a custom header such as X-API-Key across a host boundary.

A *Client is safe for concurrent use by any number of goroutines. A *WSClient is not.

Services

Calls are grouped by resource. Every method takes a context.Context first.

Service Covers
client.Journal Journal entries, batch create, query, activities
client.Identifiers Identifiers, exclusions, URL references, Panoptes scans, lookup builders
client.Cases Cases and case comments
client.Comments Comment edit and delete
client.Queues Work queues and queue items
client.Streams Export streams, recovery, backfill
client.Consume Stream polling, info and SSE subscription
client.Views Saved views and execution
client.Tags Tags, tag values, effective tags, tag history
client.Search Identifier and case search
client.Notifications Notifications
client.Sessions Sessions, passkeys, two-factor
client.Personas Personas and persona media
client.Reports PDF report generation and download
client.Automations Automation identities and API keys
client.FileExports CSV and file exports
client.Media Media upload and lookup
client.Admin Special domain rules, URL consolidation

Errors

Every failure carries an *APIError and matches a sentinel through errors.Is.

_, err := client.Cases.Get(ctx, caseID)
switch {
case errors.Is(err, scambus.ErrNotFound):
	// no such case
case errors.Is(err, scambus.ErrAuthentication):
	// bad or expired credentials
case errors.Is(err, scambus.ErrValidation):
	// the request was rejected
}

var apiErr *scambus.APIError
if errors.As(err, &apiErr) {
	log.Printf("%d %s: %s", apiErr.StatusCode, apiErr.Endpoint, apiErr.Message)
}

Sentinels: ErrAuthentication, ErrValidation, ErrNotFound, ErrRateLimited, ErrCursorExpired, ErrServer, ErrNoCredentials.

Journal entries

Typed constructors fill the details payload for you:

start := scambus.NewTime(time.Now().UTC())

entry, err := client.Journal.CreatePhoneCall(ctx, scambus.PhoneCallInput{
	Description: "Inbound tech support scam",
	Direction:   "inbound",
	StartTime:   start,
	InProgress:  true,
	Transcript: []scambus.ConversationMessage{
		{Index: 0, MessageID: "m0", Timestamp: start, Body: "This is Microsoft support."},
	},
})

A transcript turns on AI identifier extraction. Close an in-progress activity later:

done, err := client.Journal.CompleteActivity(ctx, entry.ID, scambus.NewTime(time.Now().UTC()), "manual", "")

Attach media and the client builds the evidence records. The API accepts one media item per evidence record, so each item gets its own:

media, _ := client.Media.UploadFile(ctx, "screenshot.png", &scambus.MediaUpload{Notes: "Phishing page"})

entry, err := client.Journal.CreateDetection(ctx, scambus.DetectionInput{
	Description: "Phishing site",
	Media:       []scambus.Media{*media},
})

For an entry type without a constructor, use Journal.Create with CreateEntryInput.

An automation can carry a provider check result on a detection. SCAMBUS asks the provider for the result that Ref names and stores the provider's answer:

entry, err := client.Journal.CreateDetection(ctx, scambus.DetectionInput{
	Description: "Phishing site",
	Identifiers: []scambus.IdentifierLookup{{Type: scambus.IdentifierTypeURL, Value: target, Ref: "target"}},
	CarriedChecks: []scambus.CarriedCheck{{
		Provider: "panoptes", IdentifierRef: "target",
		Block: scambus.CarriedBlock{Ref: requestID, Corrects: earlierRequestID},
	}},
})

When an existing entry already holds the result, SCAMBUS creates no entry. The returned entry then has Absorbed set, and its ID names the entry that holds the result.

Filtering

FilterCriteria is the one filter shape used by search, query, views, export streams and file exports. Optional scalars are pointers; use scambus.Ptr.

filter := &scambus.FilterCriteria{
	Types:         []string{"detection", "phone_call"},
	MinConfidence: scambus.Ptr(0.8),
	CreatedAfter:  "2025-01-01T00:00:00Z",
	Country:       "US",
	ExcludedTypes: []string{"note"},
}

result, err := client.Journal.Query(ctx, scambus.QueryEntriesInput{
	Filter:             filter,
	IncludeIdentifiers: true,
	OrderDesc:          true,
})

Journal.QueryAll and Search.IdentifiersAll walk every page for you, and stop if the server hands back a cursor that does not advance.

Paging on the list endpoints uses PageRequest. The API reads page and pageSize (default 25, maximum 100); it ignores limit.

Consuming a stream

Consume methods take the stream's consumer key, not its id.

Polling
cursor := scambus.CursorStart
for {
	result, err := client.Consume.Poll(ctx, consumerKey, &scambus.PollOptions{
		Cursor: cursor,
		Order:  scambus.SortAsc,
		Limit:  100,
	})
	if err != nil {
		return err
	}

	messages, err := result.IdentifierMessages()
	if err != nil {
		return err
	}
	for _, msg := range messages {
		fmt.Println(msg.Type, msg.DisplayValue, msg.Confidence.Score)
	}

	if result.NextCursor != "" {
		cursor = result.NextCursor
	}
	if !result.HasMore {
		time.Sleep(5 * time.Second)
	}
}
Cursor Meaning
scambus.CursorStart ("0") From the beginning of the stream
scambus.CursorEnd ("$") Only messages arriving from now on
"1735689600000-0" Resume from a specific message
SSE

Subscribe handles the historical batch replay and live message events, tracks the cursor, and resumes from it on reconnect.

err := client.Consume.Subscribe(ctx, consumerKey, &scambus.SubscribeOptions{
	Cursor:    scambus.CursorEnd,
	Reconnect: true,
}, func(m scambus.StreamMessage) error {
	msg, err := m.JournalEntry()
	if err != nil {
		return err
	}
	fmt.Println(msg.Type, msg.Description)
	return nil
})

Return scambus.ErrStopSubscription from the callback to end the loop cleanly. Any other error stops the loop and is returned.

WebSocket
ws, err := client.NewWebSocket()
if err != nil {
	return err
}

err = ws.ListenStream(ctx, streamID, scambus.CursorEnd, false, func(m scambus.StreamMessage) {
	identifier, err := m.Identifier()
	if err != nil {
		return
	}
	fmt.Println(identifier.DisplayValue)
})

ws.On(channel, event, handler) registers extra handlers and returns an unregister function. Use "*" as the event to receive every message on a channel.

Identifier details

Identifier.Data and stream message details are loosely typed. Decode them into the struct for the identifier type:

details, err := scambus.ParseIdentifierDetails(identifier.Type, identifier.Data)
if phone, ok := details.(scambus.PhoneDetails); ok {
	fmt.Println(phone.CountryCode, phone.Number, phone.IsTollFree)
}

Journal entry details work the same way:

call, err := scambus.DecodeDetails[scambus.PhoneCallDetails](entry.Details)
Type Struct
phone PhoneDetails
email IdentifierEmailDetails
url URLDetails
bank_account BankAccountDetails
crypto_wallet CryptoWalletDetails
social_media SocialMediaDetails
zelle ZelleDetails
payment_token PaymentTokenDetails

Composite identifiers

Bank accounts and payment tokens carry a JSON-encoded value. Builders validate the input and encode it:

bank, err := scambus.BankAccountLookup(scambus.BankAccountInput{
	Account:     "123456789",
	Routing:     "021000021",
	Institution: "Chase",
	Confidence:  scambus.Ptr(0.9),
})

venmo, err := scambus.VenmoLookup("@scammer_handle", "Some Name", nil)
chime, err := scambus.ChimeLookup("$JohnDoe", "John", nil)

A Delta Chat account is identified by its OpenPGP key fingerprint. The builder accepts the bare or grouped fingerprint, an https://i.delta.chat/#... invite link, or an OPENPGP4FPR: QR payload:

dc, err := scambus.DeltaChatLookup("8D2A 4F1C 0B3E 5A7D 9C1F 2E3B 4A5C 6D7E 8F9A 0B1C", scambus.Ptr(0.9))

Timestamps and confidence

scambus.Time accepts RFC3339 with or without a zone and reads a naive value as UTC. It embeds time.Time, so all the usual methods work.

scambus.Confidence decodes both shapes the API returns: {"score": 0.95} on entity endpoints and a bare 0.95 on stream endpoints. Read Confidence.Score, and check Confidence.Set to tell an absent value from zero.

Examples

Runnable programs live in examples/:

Example Shows
simple-detection Submit a detection with identifiers and tags
phone-call Upload media, file a call, complete the activity
consume-poll Poll a stream and resume from a cursor
consume-sse Subscribe over SSE with reconnect
websocket-stream Live stream and notifications over WebSocket
search-and-views Paginated search, saved as a view
queue-worker Claim, contact and complete queue items
reports Generate and download a signed PDF report

Development

go test ./...
go test -race ./...
go test -cover ./...
go vet ./...

License

MIT. See LICENSE.

Notes on the API

A few behaviours are worth knowing before you reach for them.

Queues.Update is a whole-object replace. The server writes several fields unconditionally, so an omitted field becomes its zero value — which would deactivate the queue and clear its description. Update therefore reads the queue, applies your QueuePatch, and resends every field.

Closing a case needs a resolution. Set Status to closed together with Resolution (one of resolved, unresolved, transferred, duplicate) and a non-empty ClosureNotes.

Consume methods take the consumer key, not the stream id.

FileExports.Download fetches a presigned URL, then the bytes from it. That second request carries no credentials. Use DownloadURL if you want the location instead of the content.

An automation API key secret is returned once, on CreateAPIKey, in the Key field. It cannot be recovered afterwards.

GET /tags/history was removed upstream and has no client method.

Documentation

Overview

Package scambus is the official Go client for the SCAMBUS API.

It submits scam reports as journal entries, searches identifiers, cases and entries, manages export streams, and receives live data over SSE or WebSocket.

Authentication

New resolves credentials in this order: explicit options, the SCAMBUS_* environment variables, then ~/.scambus/config.json written by the CLI.

client, err := scambus.New()

An API key takes precedence over a bearer token when both are available.

client, err := scambus.New(
	scambus.WithAPIURL("https://scambus.net/api"),
	scambus.WithAPIKey(keyID, keySecret),
)

Services

Calls are grouped by resource on the client: Journal, Identifiers, Cases, Queues, Streams, Consume, Views, Tags, Search, Notifications, Sessions, Personas, Reports, Automations, FileExports, Media, Comments and Admin.

entry, err := client.Journal.CreateDetection(ctx, scambus.DetectionInput{
	Description: "Automated phishing detection",
	Identifiers: []scambus.IdentifierLookup{
		{Type: scambus.IdentifierTypePhone, Value: "+12125551234", Confidence: scambus.Ptr(0.9)},
	},
})

Errors

Every failure carries an *APIError and matches a sentinel through errors.Is: ErrAuthentication, ErrValidation, ErrNotFound, ErrRateLimited, ErrCursorExpired and ErrServer.

if errors.Is(err, scambus.ErrNotFound) {
	// ...
}

Retries

Transient failures retry with full-jitter exponential backoff, honouring Retry-After and bounded by WithMaxRetries and WithRetryMaxTime. A 408, a 429 or a 503 with Retry-After means the server did not process the request, so any method is replayed. Another 5xx or a dropped connection may follow a committed write, so only idempotent methods are replayed there; such a failed POST is reported, never repeated. Cancelling the context stops the retry loop.

The client refuses HTTP redirects. Credentials travel in headers, and Go forwards a custom header such as X-API-Key across a host boundary.

A *Client is safe for concurrent use by any number of goroutines. A *WSClient is not.

Consuming streams

Consume methods take the stream's consumer key, not its id.

err := client.Consume.Subscribe(ctx, consumerKey,
	&scambus.SubscribeOptions{Cursor: scambus.CursorEnd, Reconnect: true},
	func(m scambus.StreamMessage) error {
		msg, err := m.Identifier()
		if err != nil {
			return err
		}
		fmt.Println(msg.DisplayValue, msg.Confidence.Score)
		return nil
	})

Index

Constants

View Source
const (
	ResolutionResolved    = "resolved"
	ResolutionUnresolved  = "unresolved"
	ResolutionTransferred = "transferred"
	ResolutionDuplicate   = "duplicate"
)

Resolution values accepted when closing a case.

View Source
const (
	PanoptesScanRunning  = "running"
	PanoptesScanComplete = "complete"
	PanoptesScanTimeout  = "timeout"
	PanoptesScanError    = "error"
)
View Source
const (
	SortAsc  = "asc"
	SortDesc = "desc"
)
View Source
const (
	CursorStart = "0"
	CursorEnd   = "$"
)

Cursor values accepted by the stream consumer endpoints.

View Source
const DefaultAPIURL = "https://scambus.net/api"
View Source
const (
	Version = "0.1.0"
)

Variables

View Source
var (
	ErrAuthentication = errors.New("scambus: authentication failed")
	ErrValidation     = errors.New("scambus: request validation failed")
	ErrNotFound       = errors.New("scambus: resource not found")
	ErrServer         = errors.New("scambus: server error")
	ErrRateLimited    = errors.New("scambus: rate limited")
	ErrCursorExpired  = errors.New("scambus: cursor outside retention window")
	ErrNoCredentials  = errors.New("scambus: no authentication provided")
)
View Source
var ErrStopSubscription = errors.New("scambus: stop subscription")

ErrStopSubscription ends a Subscribe loop cleanly when returned by its callback.

Functions

func DecodeDetails

func DecodeDetails[T any](data map[string]any) (T, error)

DecodeDetails re-decodes a loosely typed details map into a concrete details struct, e.g. DecodeDetails[PhoneCallDetails](entry.Details).

func ParseIdentifierDetails

func ParseIdentifierDetails(identifierType string, data map[string]any) (any, error)

ParseIdentifierDetails decodes Identifier.Data into the struct matching the identifier type. Unknown types return the map unchanged.

func Ptr

func Ptr[T any](v T) *T

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Method     string
	Endpoint   string
	Body       []byte
	Data       map[string]any
	// contains filtered or unexported fields
}

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

type ActivityCompleteDetails

type ActivityCompleteDetails struct {
	CompletionReason string `json:"completion_reason"`
	StartTime        Time   `json:"start_time"`
	EndTime          Time   `json:"end_time"`
	DurationSeconds  int    `json:"duration_seconds"`
}

type AdminService

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

func (*AdminService) CancelURLConsolidation

func (s *AdminService) CancelURLConsolidation(ctx context.Context) error

func (*AdminService) CreateSpecialDomainRule

func (s *AdminService) CreateSpecialDomainRule(ctx context.Context, in CreateDomainRuleInput) (*SpecialDomainRule, error)

func (*AdminService) DeleteSpecialDomainRule

func (s *AdminService) DeleteSpecialDomainRule(ctx context.Context, ruleID string) error

func (*AdminService) ListSpecialDomainRules

func (s *AdminService) ListSpecialDomainRules(ctx context.Context, opts *ListDomainRulesOptions) ([]SpecialDomainRule, error)

func (*AdminService) StartURLConsolidation

func (s *AdminService) StartURLConsolidation(ctx context.Context) (*URLConsolidationStatus, error)

func (*AdminService) URLConsolidationStatus

func (s *AdminService) URLConsolidationStatus(ctx context.Context) (*URLConsolidationStatus, error)

func (*AdminService) UpdateSpecialDomainRule

func (s *AdminService) UpdateSpecialDomainRule(ctx context.Context, ruleID string, in UpdateDomainRuleInput) (*SpecialDomainRule, error)

type Automation

type Automation struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	IsActive    bool   `json:"is_active"`
	OwnerOrgID  string `json:"owner_org_id,omitempty"`
	CreatedAt   Time   `json:"created_at"`
	UpdatedAt   Time   `json:"updated_at"`
}

type AutomationAPIKey

type AutomationAPIKey struct {
	ID           string `json:"id"`
	AutomationID string `json:"automation_id,omitempty"`
	Name         string `json:"name"`
	Description  string `json:"description,omitempty"`
	OwnerID      string `json:"owner_id,omitempty"`
	OwnerType    string `json:"owner_type,omitempty"`
	IsActive     bool   `json:"is_active"`
	LastUsed     Time   `json:"last_used"`
	ExpiresAt    Time   `json:"expires_at"`
	CreatedAt    Time   `json:"created_at"`
	UpdatedAt    Time   `json:"updated_at"`

	// Key is the secret, returned only by CreateAPIKey and never again.
	Key      string `json:"key,omitempty"`
	SecretID string `json:"secret_id,omitempty"`
}

type AutomationService

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

func (*AutomationService) Create

func (*AutomationService) CreateAPIKey

func (s *AutomationService) CreateAPIKey(ctx context.Context, automationID, name, expiresAt string) (*AutomationAPIKey, error)

CreateAPIKey returns the only copy of the secret. Store it now.

func (*AutomationService) DeleteAPIKey

func (s *AutomationService) DeleteAPIKey(ctx context.Context, automationID, keyID string) error

func (*AutomationService) Get

func (s *AutomationService) Get(ctx context.Context, automationID string) (*Automation, error)

func (*AutomationService) List

func (*AutomationService) ListAPIKeys

func (s *AutomationService) ListAPIKeys(ctx context.Context, automationID string) ([]AutomationAPIKey, error)

func (*AutomationService) RevokeAPIKey

func (s *AutomationService) RevokeAPIKey(ctx context.Context, automationID, keyID string) error

type BankAccountDetails

type BankAccountDetails struct {
	AccountNumber string `json:"account_number,omitempty"`
	Routing       string `json:"routing,omitempty"`
	Institution   string `json:"institution,omitempty"`
	Owner         string `json:"owner,omitempty"`
	OwnerAddress  string `json:"owner_address,omitempty"`
	Country       string `json:"country,omitempty"`
	Address       string `json:"address,omitempty"`
	Swift         string `json:"swift,omitempty"`
	IBAN          string `json:"iban,omitempty"`
	AccountType   string `json:"account_type,omitempty"`
}

type BankAccountInput

type BankAccountInput struct {
	Account      string
	Routing      string
	Institution  string
	Owner        string
	OwnerAddress string
	Country      string
	Confidence   *float64
}

type BatchCreateResult

type BatchCreateResult struct {
	Results []BatchEntryResult `json:"results"`
	Summary BatchSummary       `json:"summary"`
}

type BatchEntryResult

type BatchEntryResult struct {
	Index                int                   `json:"index"`
	Status               string                `json:"status"`
	ID                   string                `json:"id,omitempty"`
	Error                string                `json:"error,omitempty"`
	FailedIdentifiers    []FailedIdentifier    `json:"failed_identifiers,omitempty"`
	ExtractedIdentifiers []ExtractedIdentifier `json:"extracted_identifiers,omitempty"`
}

type BatchSummary

type BatchSummary struct {
	Total     int `json:"total"`
	Succeeded int `json:"succeeded"`
	Failed    int `json:"failed"`
}

type CarriedBlock

type CarriedBlock struct {
	Ref      string `json:"ref"`
	Corrects string `json:"corrects,omitempty"`
}

CarriedBlock is the provider reference of a carried result, and the reference of an earlier result of the same provider that it corrects.

type CarriedCheck

type CarriedCheck struct {
	Provider string `json:"provider"`
	// IdentifierRef names an identifier lookup of the same entry by its Ref.
	// IdentifierID names a linked identifier instead.
	IdentifierRef string       `json:"identifier_ref,omitempty"`
	IdentifierID  string       `json:"identifier_id,omitempty"`
	Block         CarriedBlock `json:"block"`
}

CarriedCheck names a provider check result that a new entry carries. SCAMBUS asks the provider for the result that Block.Ref names and stores the provider's answer. Only an automation key can send one.

type Case

type Case struct {
	ID             string `json:"id"`
	Title          string `json:"title"`
	Notes          string `json:"notes,omitempty"`
	Status         string `json:"status,omitempty"`
	Priority       string `json:"priority,omitempty"`
	CreatedAt      Time   `json:"created_at"`
	UpdatedAt      Time   `json:"updated_at"`
	OriginatorID   string `json:"originator_id,omitempty"`
	OriginatorType string `json:"originator_type,omitempty"`
	IsTest         bool   `json:"is_test"`
}

type CaseComment

type CaseComment struct {
	ID              string `json:"id"`
	CaseID          string `json:"case_id"`
	AuthorID        string `json:"author_id"`
	Content         string `json:"content"`
	IsReaction      bool   `json:"is_reaction"`
	Reaction        string `json:"reaction,omitempty"`
	Edited          bool   `json:"edited"`
	Deleted         bool   `json:"deleted"`
	ParentCommentID string `json:"parent_comment_id,omitempty"`
	CreatedAt       Time   `json:"created_at"`
	UpdatedAt       Time   `json:"updated_at"`
	DeletedAt       Time   `json:"deleted_at"`
}

type CaseHandoffDetails

type CaseHandoffDetails struct {
	FromUserID      string `json:"from_user_id"`
	FromUserName    string `json:"from_user_name"`
	ToUserID        string `json:"to_user_id"`
	ToUserName      string `json:"to_user_name"`
	Reason          string `json:"reason"`
	Notes           string `json:"notes,omitempty"`
	ReassignedTasks int    `json:"reassigned_tasks"`
}

type CaseIdentifierLinkDetails

type CaseIdentifierLinkDetails struct {
	Operation       string         `json:"operation"`
	CaseID          string         `json:"case_id"`
	IdentifierID    string         `json:"identifier_id"`
	Reason          string         `json:"reason,omitempty"`
	Metadata        map[string]any `json:"metadata,omitempty"`
	CaseRef         string         `json:"case_ref,omitempty"`
	CaseTitle       string         `json:"case_title,omitempty"`
	IdentifierType  string         `json:"identifier_type,omitempty"`
	IdentifierValue string         `json:"identifier_value,omitempty"`
}

type CaseService

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

func (*CaseService) CommentCount

func (s *CaseService) CommentCount(ctx context.Context, caseID string) (int, error)

func (*CaseService) Create

func (s *CaseService) Create(ctx context.Context, in CreateCaseInput) (*Case, error)

func (*CaseService) CreateComment

func (s *CaseService) CreateComment(ctx context.Context, caseID, content, parentCommentID string) (*CaseComment, error)

func (*CaseService) Delete

func (s *CaseService) Delete(ctx context.Context, caseID string) error

func (*CaseService) Get

func (s *CaseService) Get(ctx context.Context, caseID string) (*Case, error)

func (*CaseService) List

func (s *CaseService) List(ctx context.Context, opts *ListCasesOptions) ([]Case, error)

func (*CaseService) ListComments

func (s *CaseService) ListComments(ctx context.Context, caseID string) ([]CaseComment, error)

func (*CaseService) Update

func (s *CaseService) Update(ctx context.Context, caseID string, in UpdateCaseInput) (*Case, error)

Update reloads the case afterwards because the API answers 204.

type CaseUpdateDetails

type CaseUpdateDetails struct {
	CaseID     string         `json:"case_id"`
	UpdateType string         `json:"update_type"`
	NewValue   string         `json:"new_value"`
	OldValue   string         `json:"old_value,omitempty"`
	Notes      string         `json:"notes,omitempty"`
	Metadata   map[string]any `json:"metadata,omitempty"`
}

type CheckDetails

type CheckDetails struct {
	IdentifierID       string               `json:"identifier_id"`
	Failures           []CheckFailureRecord `json:"failures,omitempty"`
	OverriddenFailures []CheckFailureRecord `json:"overridden_failures,omitempty"`
	PreviousCap        *float64             `json:"previous_cap,omitempty"`
	NewCap             *float64             `json:"new_cap,omitempty"`
	Reason             string               `json:"reason,omitempty"`
}

type CheckFailureRecord

type CheckFailureRecord struct {
	Check   string `json:"check"`
	Message string `json:"message,omitempty"`
}

type Client

type Client struct {
	Media         *MediaService
	Journal       *JournalService
	Identifiers   *IdentifierService
	Cases         *CaseService
	Comments      *CommentService
	Queues        *QueueService
	Streams       *StreamService
	Consume       *ConsumeService
	FileExports   *FileExportService
	Views         *ViewService
	Tags          *TagService
	Search        *SearchService
	Notifications *NotificationService
	Sessions      *SessionService
	Personas      *PersonaService
	Reports       *ReportService
	Automations   *AutomationService
	Admin         *AdminService
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Client, error)

New resolves credentials from options, then the SCAMBUS_* environment variables, then ~/.scambus/config.json.

func (*Client) APIURL

func (c *Client) APIURL() string

func (*Client) NewWebSocket

func (c *Client) NewWebSocket(opts ...WSOption) (*WSClient, error)

NewWebSocket builds a WebSocket client reusing this client's credentials.

type CommentService

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

func (*CommentService) Delete

func (s *CommentService) Delete(ctx context.Context, commentID string) error

func (*CommentService) Update

func (s *CommentService) Update(ctx context.Context, commentID, content string) (*CaseComment, error)

type Confidence

type Confidence struct {
	Score float64
	Set   bool
}

Confidence decodes both the object form the entity endpoints return ({"score": 0.95}) and the bare number the stream endpoints return.

func NewConfidence

func NewConfidence(score float64) Confidence

func (Confidence) MarshalJSON

func (c Confidence) MarshalJSON() ([]byte, error)

func (*Confidence) UnmarshalJSON

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

type ConfidenceOperationDetails

type ConfidenceOperationDetails struct {
	Identifiers []IdentifierConfidenceUpdate `json:"identifiers"`
	Reason      string                       `json:"reason,omitempty"`
	Metadata    map[string]any               `json:"metadata,omitempty"`
}

type ConsumeService

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

ConsumeService reads export streams. Every method takes the stream's consumer key, not its stream id.

func (*ConsumeService) Info

func (s *ConsumeService) Info(ctx context.Context, consumerKey string) (*StreamInfo, error)

func (*ConsumeService) Poll

func (s *ConsumeService) Poll(ctx context.Context, consumerKey string, opts *PollOptions) (*PollResult, error)

func (*ConsumeService) Subscribe

func (s *ConsumeService) Subscribe(ctx context.Context, consumerKey string, opts *SubscribeOptions, fn func(StreamMessage) error) error

Subscribe opens the SSE endpoint for a consumer key and calls fn for every message, until ctx is cancelled or fn returns an error.

type ContactInput

type ContactInput struct {
	ContactIdentifierID string `json:"contact_identifier_id,omitempty"`
	JournalEntryID      string `json:"journal_entry_id,omitempty"`
	Notes               string `json:"notes,omitempty"`
}

type ConversationContinuationDetails

type ConversationContinuationDetails struct {
	Messages      []ConversationMessage `json:"messages"`
	Reason        string                `json:"reason,omitempty"`
	NonContiguous bool                  `json:"non_contiguous"`
}

type ConversationContinuationInput

type ConversationContinuationInput struct {
	Description                string
	Identifiers                []IdentifierLookup
	OurIdentifiers             []IdentifierLookup
	Evidence                   []Evidence
	Media                      []Media
	CaseID                     string
	Tags                       []TagLookup
	Metadata                   map[string]any
	ParentJournalEntryID       string
	Originator                 *OriginatorLookup
	IsTest                     bool
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	ParentEntryID              string
	Messages                   []ConversationMessage
	Reason                     string
	NonContiguous              bool
	AIExtract                  bool
}

type ConversationMessage

type ConversationMessage struct {
	Index                   int                    `json:"index"`
	MessageID               string                 `json:"message_id"`
	Timestamp               Time                   `json:"timestamp"`
	Body                    string                 `json:"body"`
	IsOutgoing              bool                   `json:"is_outgoing"`
	MessageType             string                 `json:"message_type,omitempty"`
	PhoneCallJournalEntryID string                 `json:"phone_call_journal_entry_id,omitempty"`
	SenderRef               string                 `json:"sender_ref,omitempty"`
	SenderDisplayName       string                 `json:"sender_display_name,omitempty"`
	IdentifierRefs          []MessageIdentifierRef `json:"identifier_refs,omitempty"`
	Attachments             []MessageAttachment    `json:"attachments,omitempty"`
	Timezone                string                 `json:"timezone,omitempty"`
	BodyHTML                string                 `json:"body_html,omitempty"`
	Subject                 string                 `json:"subject,omitempty"`
	IsDeleted               bool                   `json:"is_deleted"`
	IsEdited                bool                   `json:"is_edited"`
	DeliveryStatus          string                 `json:"delivery_status,omitempty"`
	DeliveryTimestamp       Time                   `json:"delivery_timestamp,omitzero"`
	ReadTimestamp           Time                   `json:"read_timestamp,omitzero"`
	InReplyTo               string                 `json:"in_reply_to,omitempty"`
	Headers                 map[string]string      `json:"headers,omitempty"`
	PlatformMetadata        map[string]any         `json:"platform_metadata,omitempty"`
}

type CreateAutomationInput

type CreateAutomationInput struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	IsActive    *bool  `json:"is_active,omitempty"`
}

type CreateCaseInput

type CreateCaseInput struct {
	Title    string         `json:"title"`
	Notes    string         `json:"notes,omitempty"`
	Status   string         `json:"status,omitempty"`
	Priority string         `json:"priority,omitempty"`
	Metadata map[string]any `json:"metadata,omitempty"`
	IsTest   bool           `json:"is_test,omitempty"`
}

type CreateDomainRuleInput

type CreateDomainRuleInput struct {
	Domain        string `json:"domain"`
	Category      string `json:"category"`
	PathDepth     *int   `json:"path_depth,omitempty"`
	StripQuery    *bool  `json:"strip_query,omitempty"`
	StripFragment *bool  `json:"strip_fragment,omitempty"`
	IsActive      *bool  `json:"is_active,omitempty"`
}

CreateDomainRuleInput leaves StripQuery and StripFragment nil to accept the server default of true.

type CreateEntryInput

type CreateEntryInput struct {
	Type                       EntryType
	Description                string
	Details                    any
	PerformedAt                Time
	CaseID                     string
	IdentifierLookups          []IdentifierLookup
	OurIdentifierLookups       []IdentifierLookup
	Evidence                   []Evidence
	Originator                 *OriginatorLookup
	ParentJournalEntryID       string
	TagLookups                 []TagLookup
	StartTime                  Time
	EndTime                    Time
	InProgress                 bool
	Metadata                   map[string]any
	IsTest                     bool
	IsNSFW                     bool
	AIExtract                  bool
	RetractedIdentifierIDs     []string
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	CarriedChecks              []CarriedCheck
}

type CreateExclusionInput

type CreateExclusionInput struct {
	IdentifierID   string `json:"identifier_id,omitempty"`
	IdentifierType string `json:"identifier_type,omitempty"`
	Value          string `json:"value,omitempty"`
	Reason         string `json:"reason,omitempty"`
}

type CreateFileExportInput

type CreateFileExportInput struct {
	SourceType     string          `json:"source_type"`
	SourceID       string          `json:"source_id,omitempty"`
	EntityType     string          `json:"entity_type"`
	Format         string          `json:"format"`
	Name           string          `json:"name,omitempty"`
	FilterCriteria *FilterCriteria `json:"filter_criteria,omitempty"`
	Columns        []string        `json:"columns,omitempty"`
	Limit          *int            `json:"limit,omitempty"`
	DateRangeStart string          `json:"date_range_start,omitempty"`
	DateRangeEnd   string          `json:"date_range_end,omitempty"`
	IncludeOurs    bool            `json:"include_ours,omitempty"`
	FormatOptions  map[string]any  `json:"format_options,omitempty"`
}

type CreatePersonaInput

type CreatePersonaInput struct {
	Name              string                   `json:"name"`
	Description       string                   `json:"description,omitempty"`
	Personality       string                   `json:"personality,omitempty"`
	Background        string                   `json:"background,omitempty"`
	AddressLine1      string                   `json:"address_line1,omitempty"`
	AddressLine2      string                   `json:"address_line2,omitempty"`
	AddressCity       string                   `json:"address_city,omitempty"`
	AddressState      string                   `json:"address_state,omitempty"`
	AddressPostalCode string                   `json:"address_postal_code,omitempty"`
	AddressCountry    string                   `json:"address_country,omitempty"`
	Identifiers       []PersonaIdentifierInput `json:"identifiers,omitempty"`
}

type CreateQueueInput

type CreateQueueInput struct {
	Name                  string         `json:"name"`
	Description           string         `json:"description,omitempty"`
	FilterCriteria        map[string]any `json:"filter_criteria,omitempty"`
	CadenceDays           *int           `json:"cadence_days,omitempty"`
	CooldownHours         *int           `json:"cooldown_hours,omitempty"`
	MaxContactsPerCluster *int           `json:"max_contacts_per_cluster,omitempty"`
	RotationEnabled       *bool          `json:"rotation_enabled,omitempty"`
	PriorityMode          string         `json:"priority_mode,omitempty"`
	AutoPopulate          *bool          `json:"auto_populate,omitempty"`
	ActorClusterID        string         `json:"actor_cluster_id,omitempty"`
}

type CreateStreamInput

type CreateStreamInput struct {
	Name                  string          `json:"name"`
	Description           string          `json:"description,omitempty"`
	DataType              StreamDataType  `json:"data_type"`
	FilterCriteria        *FilterCriteria `json:"filter_criteria,omitempty"`
	FilterExpression      string          `json:"filter_expression,omitempty"`
	IsActive              *bool           `json:"is_active,omitempty"`
	RetentionDays         *int            `json:"retention_days,omitempty"`
	BackfillHistorical    bool            `json:"backfill_historical"`
	BackfillFromDate      string          `json:"backfill_from_date,omitempty"`
	IncludeOriginator     bool            `json:"include_originator,omitempty"`
	IncludeJournalEntries bool            `json:"include_journal_entries,omitempty"`
	BatchSize             *int            `json:"batch_size,omitempty"`
	RateLimitPerMinute    *int            `json:"rate_limit_per_minute,omitempty"`
	SharedOrgIDs          []string        `json:"shared_org_ids,omitempty"`
}

type CreateTagInput

type CreateTagInput struct {
	Title              string           `json:"title"`
	TagType            string           `json:"tag_type"`
	Description        string           `json:"description,omitempty"`
	Aliases            []string         `json:"aliases,omitempty"`
	IsGlobal           bool             `json:"is_global,omitempty"`
	FlowUp             bool             `json:"flow_up"`
	FlowDown           bool             `json:"flow_down"`
	AllowDynamicValues bool             `json:"allow_dynamic_values"`
	Color              string           `json:"color,omitempty"`
	Icon               string           `json:"icon,omitempty"`
	AllocatesKarma     *int             `json:"allocates_karma,omitempty"`
	Metadata           map[string]any   `json:"metadata,omitempty"`
	TagValues          []CreateTagValue `json:"tag_values,omitempty"`
}

type CreateTagValue

type CreateTagValue struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	// Order 0 is the first position, so it is always sent.
	Order int `json:"order"`
}

type CreateTemporaryStreamInput

type CreateTemporaryStreamInput struct {
	Name                  string          `json:"name,omitempty"`
	DataType              StreamDataType  `json:"data_type"`
	ViewID                string          `json:"viewId,omitempty"`
	FilterCriteria        *FilterCriteria `json:"filter_criteria,omitempty"`
	FilterExpression      string          `json:"filter_expression,omitempty"`
	IncludeOriginator     bool            `json:"include_originator,omitempty"`
	IncludeJournalEntries bool            `json:"include_journal_entries,omitempty"`
	BatchSize             *int            `json:"batch_size,omitempty"`
}

type CreateViewInput

type CreateViewInput struct {
	Name            string          `json:"name"`
	EntityType      string          `json:"entity_type"`
	Visibility      string          `json:"visibility,omitempty"`
	ViewType        string          `json:"view_type,omitempty"`
	Description     string          `json:"description,omitempty"`
	Alias           string          `json:"alias,omitempty"`
	FilterCriteria  *FilterCriteria `json:"filter_criteria,omitempty"`
	SortOrder       *SortOrder      `json:"sort_order,omitempty"`
	QueryString     string          `json:"query_string,omitempty"`
	DisplaySettings map[string]any  `json:"display_settings,omitempty"`
}

type CryptoWalletDetails

type CryptoWalletDetails struct {
	Address  string `json:"address,omitempty"`
	Currency string `json:"currency,omitempty"`
	Network  string `json:"network,omitempty"`
}

type CustodyEvent

type CustodyEvent struct {
	Timestamp Time   `json:"timestamp"`
	Event     string `json:"event"`
	Method    string `json:"method"`
	Actor     string `json:"actor,omitempty"`
	Notes     string `json:"notes,omitempty"`
}

type DataContribution

type DataContribution struct {
	IdentifierID string         `json:"identifier_id"`
	Data         map[string]any `json:"data,omitempty"`
}

type DataOperationDetails

type DataOperationDetails struct {
	Identifiers []DataContribution `json:"identifiers"`
	Reason      string             `json:"reason,omitempty"`
	Metadata    map[string]any     `json:"metadata,omitempty"`
}

type DateRange

type DateRange struct {
	Start Time `json:"start,omitzero"`
	End   Time `json:"end,omitzero"`
}

type DetectionDetails

type DetectionDetails struct {
	Data       map[string]any `json:"data,omitempty"`
	DetectedAt Time           `json:"detected_at"`
}

type DetectionInput

type DetectionInput struct {
	Description                string
	Identifiers                []IdentifierLookup
	OurIdentifiers             []IdentifierLookup
	Evidence                   []Evidence
	Media                      []Media
	CaseID                     string
	Tags                       []TagLookup
	Metadata                   map[string]any
	ParentJournalEntryID       string
	Originator                 *OriginatorLookup
	IsTest                     bool
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	CarriedChecks              []CarriedCheck
	Details                    *DetectionDetails
	PerformedAt                Time
	StartTime                  Time
	EndTime                    Time
	InProgress                 bool
}

type EmailAddress

type EmailAddress struct {
	Name    string `json:"name,omitempty"`
	Address string `json:"address"`
}

type EmailDetails

type EmailDetails struct {
	Direction   string            `json:"direction"`
	Subject     string            `json:"subject"`
	Body        string            `json:"body,omitempty"`
	HTMLBody    string            `json:"html_body,omitempty"`
	MessageID   string            `json:"message_id"`
	Headers     map[string]string `json:"headers,omitempty"`
	Attachments []string          `json:"attachments,omitempty"`
	SentAt      Time              `json:"sent_at"`

	FromAddress      *EmailAddress  `json:"from_address,omitempty"`
	ToAddresses      []EmailAddress `json:"to_addresses,omitempty"`
	CCAddresses      []EmailAddress `json:"cc_addresses,omitempty"`
	BCCAddresses     []EmailAddress `json:"bcc_addresses,omitempty"`
	ReplyToAddresses []EmailAddress `json:"reply_to_addresses,omitempty"`

	SourceIP     string   `json:"source_ip,omitempty"`
	SPFResult    string   `json:"spf_result,omitempty"`
	DKIMResult   string   `json:"dkim_result,omitempty"`
	DMARCResult  string   `json:"dmarc_result,omitempty"`
	AuthFailures []string `json:"auth_failures,omitempty"`

	PublicKeys           []EmailPublicKey `json:"public_keys,omitempty"`
	RawEmailMediaID      string           `json:"raw_email_media_id,omitempty"`
	ExtractedBodyMediaID string           `json:"extracted_body_media_id,omitempty"`
}

type EmailInput

type EmailInput struct {
	Description                string
	Identifiers                []IdentifierLookup
	OurIdentifiers             []IdentifierLookup
	Evidence                   []Evidence
	Media                      []Media
	CaseID                     string
	Tags                       []TagLookup
	Metadata                   map[string]any
	ParentJournalEntryID       string
	Originator                 *OriginatorLookup
	IsTest                     bool
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	Direction                  string
	Subject                    string
	SentAt                     Time
	Body                       string
	HTMLBody                   string
	MessageID                  string
	Headers                    map[string]string
	Attachments                []string
	StartTime                  Time
	EndTime                    Time
	InProgress                 bool
}

type EmailPublicKey

type EmailPublicKey struct {
	Type        string `json:"type,omitempty"`
	Fingerprint string `json:"fingerprint,omitempty"`
	Key         string `json:"key,omitempty"`
}

type EnrichedDetail

type EnrichedDetail struct {
	Value  any    `json:"value"`
	Source string `json:"source"`
}

type EntryType

type EntryType string
const (
	EntryTypePhoneCall                EntryType = "phone_call"
	EntryTypeEmail                    EntryType = "email"
	EntryTypeTextConversation         EntryType = "text_conversation"
	EntryTypeConversationContinuation EntryType = "conversation_continuation"
	EntryTypeWebInteraction           EntryType = "web_interaction"
	EntryTypeDetection                EntryType = "detection"
	EntryTypeImport                   EntryType = "import"
	EntryTypeExport                   EntryType = "export"
	EntryTypeNote                     EntryType = "note"
	EntryTypeTagOperation             EntryType = "tag_operation"
	EntryTypeConfidenceOperation      EntryType = "confidence_operation"
	EntryTypeRedaction                EntryType = "redaction"
	EntryTypeCaseUpdate               EntryType = "case_update"
	EntryTypeCaseIdentifierLink       EntryType = "case_identifier_link"
	EntryTypeCaseIdentifierUnlink     EntryType = "case_identifier_unlink"
	EntryTypeKarmaAdjustment          EntryType = "karma_adjustment"
	EntryTypeActivityComplete         EntryType = "activity_complete"
	EntryTypeData                     EntryType = "data"
	EntryTypeTaskUpdate               EntryType = "task_update"
	EntryTypeTaskAssignment           EntryType = "task_assignment"
	EntryTypeCaseHandoff              EntryType = "case_handoff"
	EntryTypeEvidenceReview           EntryType = "evidence_review"
	EntryTypeFinancialTransaction     EntryType = "financial_transaction"
	EntryTypeFalsePositive            EntryType = "false_positive"
	EntryTypeEvidenceOperation        EntryType = "evidence_operation"
)

func (EntryType) String

func (t EntryType) String() string

type Evidence

type Evidence struct {
	ID          string `json:"id,omitempty"`
	Type        string `json:"type"`
	Description string `json:"description,omitempty"`
	Source      string `json:"source,omitempty"`
	CollectedAt Time   `json:"collected_at,omitzero"`
	MediaID     string `json:"media_id,omitempty"`
	CreatedAt   Time   `json:"created_at,omitzero"`
	UpdatedAt   Time   `json:"updated_at,omitzero"`
	IsTest      bool   `json:"is_test,omitempty"`
}

Evidence carries at most one media item. Attach several by sending one Evidence per item.

type ExecuteViewOptions

type ExecuteViewOptions struct {
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type ExecuteViewResult

type ExecuteViewResult struct {
	Data       []json.RawMessage `json:"data"`
	NextCursor string            `json:"nextCursor"`
	HasMore    bool              `json:"hasMore"`
	TotalCount int               `json:"totalCount"`
	View       *View             `json:"view,omitempty"`
}

func (ExecuteViewResult) Identifiers

func (r ExecuteViewResult) Identifiers() ([]Identifier, error)

func (ExecuteViewResult) JournalEntries

func (r ExecuteViewResult) JournalEntries() ([]JournalEntry, error)

type ExportDetails

type ExportDetails struct {
	Data map[string]any `json:"data,omitempty"`
}

type ExportInput

type ExportInput struct {
	Description                string
	Identifiers                []IdentifierLookup
	OurIdentifiers             []IdentifierLookup
	Evidence                   []Evidence
	Media                      []Media
	CaseID                     string
	Tags                       []TagLookup
	Metadata                   map[string]any
	ParentJournalEntryID       string
	Originator                 *OriginatorLookup
	IsTest                     bool
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	Details                    *ExportDetails
	PerformedAt                Time
}

type ExportStream

type ExportStream struct {
	ID               string         `json:"id"`
	Name             string         `json:"name"`
	Description      string         `json:"description,omitempty"`
	DataType         string         `json:"data_type"`
	FilterCriteria   map[string]any `json:"filter_criteria,omitempty"`
	IdentifierTypes  []string       `json:"identifier_types,omitempty"`
	MinConfidence    float64        `json:"min_confidence"`
	MaxConfidence    float64        `json:"max_confidence"`
	IsActive         bool           `json:"is_active"`
	ConsumerKey      string         `json:"consumer_key,omitempty"`
	RetentionDays    int            `json:"retention_days"`
	FilterExpression string         `json:"filter_expression,omitempty"`
	CreatedAt        Time           `json:"created_at"`
	UpdatedAt        Time           `json:"updated_at"`
}

type ExternalIdentifierInput

type ExternalIdentifierInput struct {
	ExternalSystem string `json:"external_system"`
	ExternalID     string `json:"external_id"`
	Source         string `json:"source,omitempty"`
	RawMatch       string `json:"raw_match,omitempty"`
	Link           string `json:"link,omitempty"`
}

type ExternalIdentifierRecord

type ExternalIdentifierRecord struct {
	ID             string `json:"id"`
	JournalEntryID string `json:"journal_entry_id"`
	ExternalSystem string `json:"external_system"`
	ExternalID     string `json:"external_id"`
	Source         string `json:"source"`
	RawMatch       string `json:"raw_match,omitempty"`
	Link           string `json:"link,omitempty"`
	CreatedAt      Time   `json:"created_at"`
}

type ExternalSystem

type ExternalSystem struct {
	Key         string `json:"key"`
	DisplayName string `json:"display_name"`
}

type ExtractedIdentifier

type ExtractedIdentifier struct {
	Ref          string                          `json:"ref"`
	IdentifierID string                          `json:"identifier_id"`
	Type         string                          `json:"type"`
	Value        string                          `json:"value"`
	Label        string                          `json:"label,omitempty"`
	Confidence   *float64                        `json:"confidence,omitempty"`
	Occurrences  []ExtractedIdentifierOccurrence `json:"occurrences,omitempty"`
}

type ExtractedIdentifierOccurrence

type ExtractedIdentifierOccurrence struct {
	MessageIndex int    `json:"message_index"`
	Field        string `json:"field"`
	Position     int    `json:"position"`
	Length       int    `json:"length"`
}

type FailedIdentifier

type FailedIdentifier struct {
	Type   string `json:"type"`
	Value  string `json:"value"`
	Reason string `json:"reason"`
}

type FileExport

type FileExport struct {
	ID            string         `json:"id"`
	SourceType    string         `json:"source_type"`
	SourceID      string         `json:"source_id,omitempty"`
	SourceName    string         `json:"source_name,omitempty"`
	EntityType    string         `json:"entity_type"`
	Format        string         `json:"format"`
	Status        string         `json:"status"`
	Progress      int            `json:"progress"`
	TotalRows     int            `json:"total_rows"`
	ExportedRows  int            `json:"exported_rows"`
	Truncated     bool           `json:"truncated"`
	FileName      string         `json:"file_name,omitempty"`
	FileSizeBytes int64          `json:"file_size_bytes"`
	ExportParams  map[string]any `json:"export_params,omitempty"`
	ErrorMessage  string         `json:"error_message,omitempty"`
	StartedAt     Time           `json:"started_at"`
	CompletedAt   Time           `json:"completed_at"`
	ExpiresAt     Time           `json:"expires_at"`
	CreatedAt     Time           `json:"created_at"`
	UpdatedAt     Time           `json:"updated_at"`
}

type FileExportService

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

func (*FileExportService) Create

func (*FileExportService) Delete

func (s *FileExportService) Delete(ctx context.Context, exportID string) error

func (*FileExportService) Download

func (s *FileExportService) Download(ctx context.Context, exportID string, w io.Writer) (int64, error)

Download resolves the presigned URL and streams the bytes. The URL carries its own credentials, so no auth header is sent with the second request.

func (*FileExportService) DownloadToFile

func (s *FileExportService) DownloadToFile(ctx context.Context, exportID, path string) error

func (*FileExportService) DownloadURL

func (s *FileExportService) DownloadURL(ctx context.Context, exportID string) (string, string, error)

DownloadURL returns the presigned location of the finished export.

func (*FileExportService) Get

func (s *FileExportService) Get(ctx context.Context, exportID string) (*FileExport, error)

func (*FileExportService) List

func (s *FileExportService) List(ctx context.Context) ([]FileExport, error)

func (*FileExportService) Rename

func (s *FileExportService) Rename(ctx context.Context, exportID, name string) (*FileExport, error)

type FilterCriteria

type FilterCriteria struct {
	SearchQuery       string `json:"search_query,omitempty"`
	NegateSearchQuery *bool  `json:"negate_search_query,omitempty"`

	Status             []string `json:"status,omitempty"`
	Priority           []string `json:"priority,omitempty"`
	Tags               []string `json:"tags,omitempty"`
	TagsAny            []string `json:"tags_any,omitempty"`
	Types              []string `json:"types,omitempty"`
	OriginatorIDs      []string `json:"originator_ids,omitempty"`
	ProxyOriginatorIDs []string `json:"proxy_originator_ids,omitempty"`
	OriginatorTypes    []string `json:"originator_types,omitempty"`
	OrgIDs             []string `json:"org_ids,omitempty"`

	Type           string `json:"type,omitempty"`
	IdentifierType string `json:"identifier_type,omitempty"`

	ConfidenceRange string   `json:"confidence_range,omitempty"`
	MinConfidence   *float64 `json:"min_confidence,omitempty"`
	MaxConfidence   *float64 `json:"max_confidence,omitempty"`

	CreatedAfter            string `json:"created_after,omitempty"`
	CreatedBefore           string `json:"created_before,omitempty"`
	PerformedAfter          string `json:"performed_after,omitempty"`
	PerformedBefore         string `json:"performed_before,omitempty"`
	DiscoveredAfter         string `json:"discovered_after,omitempty"`
	DiscoveredBefore        string `json:"discovered_before,omitempty"`
	ConfidenceChangedAfter  string `json:"confidence_changed_after,omitempty"`
	ConfidenceChangedBefore string `json:"confidence_changed_before,omitempty"`

	OriginatorFilterType string `json:"originator_filter_type,omitempty"`

	Details         map[string]any `json:"details,omitempty"`
	ExcludedDetails map[string]any `json:"excluded_details,omitempty"`

	HasMedia             *bool `json:"has_media,omitempty"`
	HasNotes             *bool `json:"has_notes,omitempty"`
	IsOurs               *bool `json:"is_ours,omitempty"`
	HumanReviewed        *bool `json:"human_reviewed,omitempty"`
	ExcludeHumanReviewed *bool `json:"exclude_human_reviewed,omitempty"`
	UserPinned           *bool `json:"user_pinned,omitempty"`
	IsTest               *bool `json:"is_test,omitempty"`
	IncludeIdentifiers   *bool `json:"include_identifiers,omitempty"`
	IncludeEvidence      *bool `json:"include_evidence,omitempty"`

	TollFree           *bool  `json:"toll_free,omitempty"`
	Institution        string `json:"institution,omitempty"`
	Platform           string `json:"platform,omitempty"`
	Service            string `json:"service,omitempty"`
	AreaCode           string `json:"area_code,omitempty"`
	Region             string `json:"region,omitempty"`
	Country            string `json:"country,omitempty"`
	State              string `json:"state,omitempty"`
	DomainCategory     string `json:"domain_category,omitempty"`
	IsPrivateSuffix    *bool  `json:"is_private_suffix,omitempty"`
	RoutingNumberOwner string `json:"routing_number_owner,omitempty"`

	Networks       []string `json:"networks,omitempty"`
	FormatClass    string   `json:"format_class,omitempty"`
	IsContract     *bool    `json:"is_contract,omitempty"`
	Sanctioned     *bool    `json:"sanctioned,omitempty"`
	SanctionsList  []string `json:"sanctions_list,omitempty"`
	KnownLabels    []string `json:"known_labels,omitempty"`
	EnrichedAfter  string   `json:"enriched_after,omitempty"`
	EnrichedBefore string   `json:"enriched_before,omitempty"`

	AssignedTo string `json:"assigned_to,omitempty"`

	TagNames         []string `json:"tag_names,omitempty"`
	ExcludedTagNames []string `json:"excluded_tag_names,omitempty"`

	ExcludedStatus             []string `json:"excluded_status,omitempty"`
	ExcludedPriority           []string `json:"excluded_priority,omitempty"`
	ExcludedTags               []string `json:"excluded_tags,omitempty"`
	ExcludedTypes              []string `json:"excluded_types,omitempty"`
	ExcludedOriginatorTypes    []string `json:"excluded_originator_types,omitempty"`
	ExcludedOriginatorIDs      []string `json:"excluded_originator_ids,omitempty"`
	ExcludedProxyOriginatorIDs []string `json:"excluded_proxy_originator_ids,omitempty"`
	ExcludedOrgIDs             []string `json:"excluded_org_ids,omitempty"`

	ExcludedOriginatorFilterType string `json:"excluded_originator_filter_type,omitempty"`

	NegateHasMedia *bool `json:"negate_has_media,omitempty"`
	NegateIsOurs   *bool `json:"negate_is_ours,omitempty"`
}

FilterCriteria is the shared filter shape used by search, query, views, export streams and file exports. Zero fields are omitted from the request.

type FunnelActionDetails

type FunnelActionDetails struct {
	FunnelID   string         `json:"funnel_id"`
	FunnelName string         `json:"funnel_name"`
	StageID    string         `json:"stage_id,omitempty"`
	StageName  string         `json:"stage_name,omitempty"`
	ActionType string         `json:"action_type"`
	ClusterID  string         `json:"cluster_id"`
	EntryID    string         `json:"entry_id,omitempty"`
	Metadata   map[string]any `json:"metadata,omitempty"`
}

type Identifier

type Identifier struct {
	ID             string         `json:"id"`
	Type           string         `json:"type"`
	DisplayValue   string         `json:"display_value"`
	Confidence     Confidence     `json:"confidence"`
	Data           map[string]any `json:"data,omitempty"`
	CreatedAt      Time           `json:"created_at"`
	UpdatedAt      Time           `json:"updated_at"`
	IsTest         bool           `json:"is_test"`
	TagDisplay     []TagDisplay   `json:"tag_display,omitempty"`
	Label          string         `json:"label,omitempty"`
	Classification string         `json:"classification,omitempty"`
}

type IdentifierConfidenceUpdate

type IdentifierConfidenceUpdate struct {
	IdentifierID  string  `json:"identifier_id"`
	PreviousScore float64 `json:"previous_score"`
	NewScore      float64 `json:"new_score"`
	Reason        string  `json:"reason,omitempty"`
}

type IdentifierEmailDetails

type IdentifierEmailDetails struct {
	Email string `json:"email,omitempty"`
}

type IdentifierExclusion

type IdentifierExclusion struct {
	ID             string `json:"id"`
	OwnerOrgID     string `json:"owner_org_id"`
	IdentifierType string `json:"identifier_type"`
	UniquenessKey  string `json:"uniqueness_key"`
	DisplayValue   string `json:"display_value"`
	Reason         string `json:"reason,omitempty"`
	CreatedByID    string `json:"created_by_id,omitempty"`
	CreatedAt      Time   `json:"created_at"`
}

type IdentifierLookup

type IdentifierLookup struct {
	Type        IdentifierType            `json:"type"`
	Value       string                    `json:"value"`
	Confidence  *float64                  `json:"confidence,omitempty"`
	Label       string                    `json:"label,omitempty"`
	Ref         string                    `json:"ref,omitempty"`
	Enrichments map[string]EnrichedDetail `json:"enrichments,omitempty"`
}

func BankAccountLookup

func BankAccountLookup(in BankAccountInput) (IdentifierLookup, error)

BankAccountLookup packs bank fields into the JSON-encoded lookup value the API expects.

func ChimeLookup

func ChimeLookup(chimesign, name string, confidence *float64) (IdentifierLookup, error)

ChimeLookup accepts a $ChimeSign.

func DeltaChatLookup

func DeltaChatLookup(fingerprint string, confidence *float64) (IdentifierLookup, error)

DeltaChatLookup accepts an OpenPGP key fingerprint (bare or grouped in fours), an https://i.delta.chat/#... invite link, or an OPENPGP4FPR: QR payload, and stores the fingerprint bare and uppercase.

func VenmoLookup

func VenmoLookup(identifier, name string, confidence *float64) (IdentifierLookup, error)

VenmoLookup accepts an @username, a 16-19 digit user id, or a venmo.com/code QR URL.

type IdentifierReportInput

type IdentifierReportInput struct {
	IdentifierIDs         []string   `json:"identifier_ids,omitempty"`
	ViewID                string     `json:"view_id,omitempty"`
	IncludeJournalEntries bool       `json:"include_journal_entries"`
	IncludeEvidence       bool       `json:"include_evidence"`
	SignReport            bool       `json:"sign_report"`
	DateRange             *DateRange `json:"date_range,omitempty"`
}

type IdentifierService

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

func (*IdentifierService) CreateExclusion

func (*IdentifierService) DeleteExclusion

func (s *IdentifierService) DeleteExclusion(ctx context.Context, exclusionID string) error

func (*IdentifierService) Get

func (s *IdentifierService) Get(ctx context.Context, identifierID string) (*Identifier, error)

func (*IdentifierService) List

func (*IdentifierService) ListExclusions

func (s *IdentifierService) ListExclusions(ctx context.Context, page, pageSize int) ([]IdentifierExclusion, error)

func (*IdentifierService) PanoptesScan

func (s *IdentifierService) PanoptesScan(ctx context.Context, identifierID string) (*PanoptesScan, error)

PanoptesScan returns nil with no error when no scan is recorded yet.

func (*IdentifierService) URLReferences

func (s *IdentifierService) URLReferences(ctx context.Context, identifierID string, opts *URLReferencesOptions) (*URLReferencesResult, error)

type IdentifierStreamMessage

type IdentifierStreamMessage struct {
	MessageID              string                   `json:"message_id,omitempty"`
	Cursor                 string                   `json:"cursor,omitempty"`
	IdentifierID           string                   `json:"identifier_id"`
	Type                   string                   `json:"type"`
	DisplayValue           string                   `json:"display_value"`
	Details                map[string]any           `json:"details,omitempty"`
	Confidence             Confidence               `json:"confidence"`
	ModifiedAt             Time                     `json:"modified_at"`
	OriginatorID           string                   `json:"originator_id,omitempty"`
	Tags                   []StreamTagInfo          `json:"tags,omitempty"`
	TriggeringJournalEntry *StreamJournalEntryInfo  `json:"triggering_journal_entry,omitempty"`
	JournalEntries         []StreamJournalEntryInfo `json:"journal_entries,omitempty"`
	IsTest                 bool                     `json:"is_test"`
}

type IdentifierSubtypeCount

type IdentifierSubtypeCount struct {
	Subtype string `json:"subtype"`
	Count   int    `json:"count"`
}

type IdentifierSummary

type IdentifierSummary struct {
	JournalEntryID string                `json:"journal_entry_id"`
	Total          int                   `json:"total"`
	ByType         []IdentifierTypeCount `json:"by_type"`
}

type IdentifierType

type IdentifierType string
const (
	IdentifierTypePhone        IdentifierType = "phone"
	IdentifierTypeEmail        IdentifierType = "email"
	IdentifierTypeURL          IdentifierType = "url"
	IdentifierTypeBankAccount  IdentifierType = "bank_account"
	IdentifierTypeCryptoWallet IdentifierType = "crypto_wallet"
	IdentifierTypeSocialMedia  IdentifierType = "social_media"
	IdentifierTypeZelle        IdentifierType = "zelle"
	IdentifierTypePaymentToken IdentifierType = "payment_token"
)

func (IdentifierType) String

func (t IdentifierType) String() string

func (IdentifierType) Valid

func (t IdentifierType) Valid() bool

type IdentifierTypeCount

type IdentifierTypeCount struct {
	Type      string                   `json:"type"`
	Count     int                      `json:"count"`
	BySubtype []IdentifierSubtypeCount `json:"by_subtype,omitempty"`
}

type IdentifierURLReference

type IdentifierURLReference struct {
	ID           string `json:"id"`
	IdentifierID string `json:"identifier_id"`
	URL          string `json:"url"`
	Hostname     string `json:"hostname"`
	Path         string `json:"path"`
	FirstSeenAt  Time   `json:"first_seen_at"`
	LastSeenAt   Time   `json:"last_seen_at"`
	SeenCount    int    `json:"seen_count"`
	OwnerOrgID   string `json:"owner_org_id,omitempty"`
	IsTest       bool   `json:"is_test"`
	CreatedAt    Time   `json:"created_at"`
}

type ImportDetails

type ImportDetails struct {
	Data map[string]any `json:"data,omitempty"`
}

type ImportInput

type ImportInput struct {
	Description                string
	Identifiers                []IdentifierLookup
	OurIdentifiers             []IdentifierLookup
	Evidence                   []Evidence
	Media                      []Media
	CaseID                     string
	Tags                       []TagLookup
	Metadata                   map[string]any
	ParentJournalEntryID       string
	Originator                 *OriginatorLookup
	IsTest                     bool
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	Details                    *ImportDetails
	PerformedAt                Time
}

type ItemActionInput

type ItemActionInput struct {
	Reason  string `json:"reason,omitempty"`
	Outcome string `json:"outcome,omitempty"`
	Note    string `json:"note,omitempty"`
}

type JournalEntry

type JournalEntry struct {
	ID                   string                     `json:"id"`
	Type                 string                     `json:"type"`
	Description          string                     `json:"description"`
	Details              map[string]any             `json:"details,omitempty"`
	PerformedAt          Time                       `json:"performed_at"`
	CreatedAt            Time                       `json:"created_at"`
	UpdatedAt            Time                       `json:"updated_at"`
	Identifiers          []Identifier               `json:"identifiers,omitempty"`
	OurIdentifiers       []Identifier               `json:"our_identifiers,omitempty"`
	Evidence             []Evidence                 `json:"evidence,omitempty"`
	StartTime            Time                       `json:"start_time"`
	EndTime              Time                       `json:"end_time"`
	ParentJournalEntryID string                     `json:"parent_journal_entry_id,omitempty"`
	BatchID              string                     `json:"batch_id,omitempty"`
	TagDisplay           []TagDisplay               `json:"tag_display,omitempty"`
	TotalKarma           *int                       `json:"total_karma,omitempty"`
	KarmaBreakdown       *KarmaBreakdown            `json:"karma_breakdown,omitempty"`
	IsDraft              bool                       `json:"is_draft"`
	IsTest               bool                       `json:"is_test"`
	DraftSavedAt         Time                       `json:"draft_saved_at"`
	SignedBy             string                     `json:"signed_by,omitempty"`
	SignatureAlgorithm   string                     `json:"signature_algorithm,omitempty"`
	SignedAt             Time                       `json:"signed_at"`
	ChildJournalEntries  []JournalEntry             `json:"child_journal_entries,omitempty"`
	FailedIdentifiers    []FailedIdentifier         `json:"failed_identifiers,omitempty"`
	ExtractedIdentifiers []ExtractedIdentifier      `json:"extracted_identifiers,omitempty"`
	ExternalIdentifiers  []ExternalIdentifierRecord `json:"external_identifiers,omitempty"`
	// Absorbed is set by Create when an existing entry took a carried check in
	// place of a new entry. ID then names that existing entry.
	Absorbed bool `json:"absorbed,omitempty"`
}

type JournalEntryChildSummary

type JournalEntryChildSummary struct {
	ID                   string `json:"id"`
	Type                 string `json:"type"`
	Platform             string `json:"platform,omitempty"`
	Direction            string `json:"direction,omitempty"`
	ParentJournalEntryID string `json:"parent_journal_entry_id,omitempty"`
	PerformedAt          Time   `json:"performed_at"`
}

type JournalEntryReportInput

type JournalEntryReportInput struct {
	JournalEntryIDs    []string   `json:"journal_entry_ids,omitempty"`
	ViewID             string     `json:"view_id,omitempty"`
	IncludeIdentifiers bool       `json:"include_identifiers"`
	IncludeEvidence    bool       `json:"include_evidence"`
	IncludeParentChain bool       `json:"include_parent_chain"`
	SignReport         bool       `json:"sign_report"`
	DateRange          *DateRange `json:"date_range,omitempty"`
}

type JournalEntryStreamMessage

type JournalEntryStreamMessage struct {
	MessageID            string                 `json:"message_id,omitempty"`
	Cursor               string                 `json:"cursor,omitempty"`
	ID                   string                 `json:"id"`
	Type                 string                 `json:"type"`
	Description          string                 `json:"description"`
	Details              map[string]any         `json:"details,omitempty"`
	PerformedAt          Time                   `json:"performed_at"`
	Confidence           Confidence             `json:"confidence"`
	StartTime            Time                   `json:"start_time"`
	EndTime              Time                   `json:"end_time"`
	ParentJournalEntryID string                 `json:"parent_journal_entry_id,omitempty"`
	Originator           *StreamOriginatorInfo  `json:"originator,omitempty"`
	Identifiers          []StreamIdentifierInfo `json:"identifiers,omitempty"`
	Evidence             []StreamEvidenceInfo   `json:"evidence,omitempty"`
	IsTest               bool                   `json:"is_test"`
	LockedBy             string                 `json:"locked_by,omitempty"`
	LockedByName         string                 `json:"locked_by_name,omitempty"`
	LockedAt             Time                   `json:"locked_at"`
}

type JournalService

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

func (*JournalService) CompleteActivity

func (s *JournalService) CompleteActivity(ctx context.Context, parentID string, endTime Time, reason, description string) (*JournalEntry, error)

CompleteActivity closes an in-progress entry with an activity_complete child.

func (*JournalService) Create

Create posts the entry, then reloads it because the API returns only an id. When an existing entry absorbed a carried check, SCAMBUS creates no entry: Create returns the id of the entry that holds the result, with Absorbed set, and does not reload it.

func (*JournalService) CreateBatch

func (s *JournalService) CreateBatch(ctx context.Context, entries []CreateEntryInput) (*BatchCreateResult, error)

func (*JournalService) CreateConversationContinuation

func (s *JournalService) CreateConversationContinuation(ctx context.Context, in ConversationContinuationInput) (*JournalEntry, error)

CreateConversationContinuation derives start and end times from the messages.

func (*JournalService) CreateDetection

func (s *JournalService) CreateDetection(ctx context.Context, in DetectionInput) (*JournalEntry, error)

func (*JournalService) CreateEmail

func (s *JournalService) CreateEmail(ctx context.Context, in EmailInput) (*JournalEntry, error)

func (*JournalService) CreateExport

func (s *JournalService) CreateExport(ctx context.Context, in ExportInput) (*JournalEntry, error)

func (*JournalService) CreateImport

func (s *JournalService) CreateImport(ctx context.Context, in ImportInput) (*JournalEntry, error)

func (*JournalService) CreateNote

func (s *JournalService) CreateNote(ctx context.Context, in NoteInput) (*JournalEntry, error)

func (*JournalService) CreatePhoneCall

func (s *JournalService) CreatePhoneCall(ctx context.Context, in PhoneCallInput) (*JournalEntry, error)

func (*JournalService) CreateTextConversation

func (s *JournalService) CreateTextConversation(ctx context.Context, in TextConversationInput) (*JournalEntry, error)

func (*JournalService) Delete

func (s *JournalService) Delete(ctx context.Context, entryID string) error

func (*JournalService) ExternalSystems

func (s *JournalService) ExternalSystems(ctx context.Context) ([]ExternalSystem, error)

func (*JournalService) ExtractedIdentifiers

func (s *JournalService) ExtractedIdentifiers(ctx context.Context, entryID string) ([]ExtractedIdentifier, error)

func (*JournalService) Get

func (s *JournalService) Get(ctx context.Context, entryID string) (*JournalEntry, error)

func (*JournalService) IdentifierSummary

func (s *JournalService) IdentifierSummary(ctx context.Context, entryID string, identifierType IdentifierType) (*IdentifierSummary, error)

func (*JournalService) InProgress

func (s *JournalService) InProgress(ctx context.Context) ([]JournalEntry, error)

func (*JournalService) List

func (*JournalService) Query

func (*JournalService) QueryAll

func (s *JournalService) QueryAll(ctx context.Context, in QueryEntriesInput, fn func(JournalEntry) error) error

QueryAll walks every page of a query, calling fn for each entry.

type KarmaAdjustmentDetails

type KarmaAdjustmentDetails struct {
	Amount      int             `json:"amount"`
	Reason      string          `json:"reason"`
	TriggerType string          `json:"trigger_type"`
	Metadata    map[string]any  `json:"metadata,omitempty"`
	Breakdown   *KarmaBreakdown `json:"breakdown,omitempty"`
}

type KarmaBreakdown

type KarmaBreakdown struct {
	Components []KarmaComponent `json:"components"`
	Total      int              `json:"total"`
}

type KarmaComponent

type KarmaComponent struct {
	Type        string `json:"type"`
	Amount      int    `json:"amount"`
	Description string `json:"description"`
	ConfigID    string `json:"config_id,omitempty"`
}

type ListAutomationsResult

type ListAutomationsResult struct {
	Data       []Automation `json:"data"`
	Pagination Pagination   `json:"pagination"`
}

type ListCasesOptions

type ListCasesOptions struct {
	Page     int
	PageSize int
	Status   string
	Priority string
	Category string
}

type ListDomainRulesOptions

type ListDomainRulesOptions struct {
	Category string
	Active   *bool
}

type ListEntriesOptions

type ListEntriesOptions struct {
	Type     EntryType
	Page     int
	PageSize int
}

type ListIdentifiersOptions

type ListIdentifiersOptions struct {
	Type     IdentifierType
	Page     int
	PageSize int
}

type ListNotificationsOptions

type ListNotificationsOptions struct {
	UnreadOnly bool
	Limit      int
	Offset     int
}

type ListStreamsOptions

type ListStreamsOptions struct {
	ActiveOnly bool
	Page       int
	PageSize   int
}

type ListStreamsResult

type ListStreamsResult struct {
	Data       []ExportStream `json:"data"`
	Pagination Pagination     `json:"pagination"`
}

type ListTagsResult

type ListTagsResult struct {
	Data       []Tag      `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type ListViewsResult

type ListViewsResult struct {
	Data       []View     `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type Media

type Media struct {
	ID             string `json:"id"`
	Type           string `json:"type"`
	FileName       string `json:"file_name"`
	MimeType       string `json:"mime_type"`
	FileSize       int64  `json:"file_size"`
	Notes          string `json:"notes,omitempty"`
	UploadedAt     Time   `json:"uploaded_at"`
	JournalEntryID string `json:"journal_entry_id,omitempty"`
}

type MediaService

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

func (*MediaService) Get

func (s *MediaService) Get(ctx context.Context, mediaID string) (*Media, error)

func (*MediaService) Upload

func (s *MediaService) Upload(ctx context.Context, filename string, r io.Reader, opts *MediaUpload) (*Media, error)

func (*MediaService) UploadFile

func (s *MediaService) UploadFile(ctx context.Context, path string, opts *MediaUpload) (*Media, error)

type MediaUpload

type MediaUpload struct {
	Notes          string
	JournalEntryID string
	Metadata       map[string]any
}

type MessageAttachment

type MessageAttachment struct {
	Filename    string `json:"filename"`
	ContentType string `json:"content_type"`
	SizeBytes   *int64 `json:"size_bytes,omitempty"`
	URL         string `json:"url,omitempty"`
	MediaID     string `json:"media_id,omitempty"`
}

type MessageIdentifierRef

type MessageIdentifierRef struct {
	Ref      string `json:"ref"`
	Field    string `json:"field"`
	Position *int   `json:"position,omitempty"`
	Length   *int   `json:"length,omitempty"`
}

type MoveItemInput

type MoveItemInput struct {
	ItemActionInput
	TargetQueueID string `json:"target_queue_id"`
}

type NoteInput

type NoteInput struct {
	Description                string
	Identifiers                []IdentifierLookup
	OurIdentifiers             []IdentifierLookup
	Evidence                   []Evidence
	Media                      []Media
	CaseID                     string
	Tags                       []TagLookup
	Metadata                   map[string]any
	ParentJournalEntryID       string
	Originator                 *OriginatorLookup
	IsTest                     bool
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	// Note entries carry a free-form details payload; the API defines no
	// typed shape for them.
	Details     map[string]any
	PerformedAt Time
	StartTime   Time
	EndTime     Time
	InProgress  bool
}

type Notification

type Notification struct {
	ID               string `json:"id"`
	UserID           string `json:"user_id"`
	Timestamp        Time   `json:"timestamp"`
	NotificationText string `json:"notification_text"`
	Service          string `json:"service"`
	Read             bool   `json:"read"`
	Dismissed        bool   `json:"dismissed"`
	Link             string `json:"link,omitempty"`
	Icon             string `json:"icon,omitempty"`
	Severity         string `json:"severity"`
	EntityType       string `json:"entity_type,omitempty"`
	EntityID         string `json:"entity_id,omitempty"`
	CreatedAt        Time   `json:"created_at"`
	UpdatedAt        Time   `json:"updated_at"`
}

type NotificationService

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

func (*NotificationService) Dismiss

func (s *NotificationService) Dismiss(ctx context.Context, notificationID string) error

func (*NotificationService) DismissAll

func (s *NotificationService) DismissAll(ctx context.Context) error

func (*NotificationService) Get

func (s *NotificationService) Get(ctx context.Context, notificationID string) (*Notification, error)

func (*NotificationService) List

func (*NotificationService) MarkAllRead

func (s *NotificationService) MarkAllRead(ctx context.Context) error

func (*NotificationService) MarkRead

func (s *NotificationService) MarkRead(ctx context.Context, notificationID string) error

func (*NotificationService) UnreadCount

func (s *NotificationService) UnreadCount(ctx context.Context) (int, error)

type Option

type Option func(*Client)

func WithAPIKey

func WithAPIKey(id, secret string) Option

func WithAPIURL

func WithAPIURL(u string) Option

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

func WithLogger

func WithLogger(l *slog.Logger) Option

func WithMaxResponseBytes

func WithMaxResponseBytes(n int64) Option

WithMaxResponseBytes caps how much of a JSON response body is read.

func WithMaxRetries

func WithMaxRetries(n int) Option

func WithRetryMaxTime

func WithRetryMaxTime(d time.Duration) Option

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout bounds a single non-streaming request. It never mutates a client passed to WithHTTPClient.

func WithToken

func WithToken(token string) Option

type OriginatorLookup

type OriginatorLookup struct {
	Type             string `json:"type"`
	Identifier       string `json:"identifier"`
	CreateIfNotExist bool   `json:"create_if_not_exists"`
	// FallbackToAnonymous gives the entry to the anonymous reporter when the lookup matches nobody.
	FallbackToAnonymous bool `json:"fallback_to_anonymous,omitempty"`
}

OriginatorLookup names the user or automation an entry is created on behalf of. Type is "user" (email or Clerk user ID), "discord" (the Discord user ID a SCAMBUS user linked) or "automation" (automation name).

type PageRequest

type PageRequest struct {
	Page     int
	PageSize int
}

PageRequest carries the paging parameters the API actually reads. The server ignores "limit"; page size is "pageSize", default 25, maximum 100.

type Pagination

type Pagination struct {
	Page       int `json:"page"`
	PageSize   int `json:"page_size"`
	TotalItems int `json:"total_items"`
	TotalPages int `json:"total_pages"`
}

type PanoptesScan

type PanoptesScan struct {
	ID                string `json:"id"`
	IdentifierID      string `json:"identifier_id"`
	TargetURL         string `json:"target_url"`
	Host              string `json:"host"`
	RegistrableDomain string `json:"registrable_domain"`
	Status            string `json:"status"`
	WarningLevel      string `json:"warning_level"`
	Category          string `json:"category"`
	Details           string `json:"details"`
	Block             bool   `json:"block"`
	PermalinkURL      string `json:"permalink_url"`
	ScannedAt         Time   `json:"scanned_at"`
}

PanoptesScan is the newest Panoptes scan SCAMBUS recorded for a url identifier.

func (*PanoptesScan) Settled

func (s *PanoptesScan) Settled() bool

type Passkey

type Passkey struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	BackupEligible bool   `json:"backup_eligible"`
	BackupState    bool   `json:"backup_state"`
	CreatedAt      Time   `json:"created_at"`
	LastUsedAt     Time   `json:"last_used_at"`
}

type PaymentService

type PaymentService string
const (
	PaymentServiceZelle   PaymentService = "zelle"
	PaymentServiceCashApp PaymentService = "cashapp"
	PaymentServicePayPal  PaymentService = "paypal"
	PaymentServiceWise    PaymentService = "wise"
	PaymentServiceKrak    PaymentService = "krak"
	PaymentServiceVenmo   PaymentService = "venmo"
	PaymentServiceChime   PaymentService = "chime"
)

type PaymentTokenDetails

type PaymentTokenDetails struct {
	Service          string `json:"service,omitempty"`
	Identifier       string `json:"identifier,omitempty"`
	Type             string `json:"type,omitempty"`
	Name             string `json:"name,omitempty"`
	SourceURLCreated string `json:"source_url_created,omitempty"`
	SourceURLPrinted string `json:"source_url_printed,omitempty"`
}

type Persona

type Persona struct {
	ID                string                  `json:"id"`
	Name              string                  `json:"name"`
	Description       string                  `json:"description"`
	Personality       string                  `json:"personality"`
	Background        string                  `json:"background"`
	AddressLine1      string                  `json:"address_line1,omitempty"`
	AddressLine2      string                  `json:"address_line2,omitempty"`
	AddressCity       string                  `json:"address_city"`
	AddressState      string                  `json:"address_state"`
	AddressPostalCode string                  `json:"address_postal_code"`
	AddressCountry    string                  `json:"address_country"`
	OwnerOrgID        string                  `json:"owner_org_id,omitempty"`
	CreatedBy         string                  `json:"created_by,omitempty"`
	IsActive          bool                    `json:"is_active"`
	IsTest            bool                    `json:"is_test"`
	CreatedAt         Time                    `json:"created_at"`
	UpdatedAt         Time                    `json:"updated_at"`
	Identifiers       []PersonaIdentifierLink `json:"identifiers,omitempty"`
	Media             []PersonaMediaLink      `json:"media,omitempty"`
}

type PersonaIdentifierInput

type PersonaIdentifierInput struct {
	IdentifierID string `json:"identifier_id,omitempty"`
	Type         string `json:"type,omitempty"`
	Value        string `json:"value,omitempty"`
	Annotation   string `json:"annotation,omitempty"`
}
type PersonaIdentifierLink struct {
	PersonaID       string `json:"persona_id"`
	IdentifierID    string `json:"identifier_id"`
	Annotation      string `json:"annotation"`
	IdentifierValue string `json:"identifier_value,omitempty"`
	IdentifierType  string `json:"identifier_type,omitempty"`
	CreatedAt       Time   `json:"created_at"`
}

type PersonaMediaInput

type PersonaMediaInput struct {
	MediaID  string `json:"media_id"`
	Category string `json:"category"`
	Notes    string `json:"notes"`
}
type PersonaMediaLink struct {
	PersonaID string `json:"persona_id"`
	MediaID   string `json:"media_id"`
	Category  string `json:"category"`
	Notes     string `json:"notes"`
	FileName  string `json:"file_name,omitempty"`
	MimeType  string `json:"mime_type,omitempty"`
	FileSize  int64  `json:"file_size,omitempty"`
	CreatedAt Time   `json:"created_at"`
}

type PersonaService

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

func (*PersonaService) AddMedia

func (s *PersonaService) AddMedia(ctx context.Context, personaID string, in PersonaMediaInput) (*PersonaMediaLink, error)

func (*PersonaService) Create

func (*PersonaService) Delete

func (s *PersonaService) Delete(ctx context.Context, personaID string) error

func (*PersonaService) Get

func (s *PersonaService) Get(ctx context.Context, personaID string) (*Persona, error)

func (*PersonaService) List

func (s *PersonaService) List(ctx context.Context) ([]Persona, error)

func (*PersonaService) RemoveMedia

func (s *PersonaService) RemoveMedia(ctx context.Context, personaID, mediaID string) error

func (*PersonaService) Update

func (s *PersonaService) Update(ctx context.Context, personaID string, in UpdatePersonaInput) (*Persona, error)

func (*PersonaService) UpdateMedia

func (s *PersonaService) UpdateMedia(ctx context.Context, personaID, mediaID string, in UpdatePersonaMediaInput) error

type PhoneCallDetails

type PhoneCallDetails struct {
	Direction     string                `json:"direction"`
	RecordingURL  string                `json:"recording_url,omitempty"`
	TranscriptURL string                `json:"transcript_url,omitempty"`
	Transcript    []ConversationMessage `json:"transcript,omitempty"`
	StartTime     Time                  `json:"start_time"`
	EndTime       Time                  `json:"end_time"`
	Platform      string                `json:"platform,omitempty"`
}

type PhoneCallInput

type PhoneCallInput struct {
	Description                string
	Identifiers                []IdentifierLookup
	OurIdentifiers             []IdentifierLookup
	Evidence                   []Evidence
	Media                      []Media
	CaseID                     string
	Tags                       []TagLookup
	Metadata                   map[string]any
	ParentJournalEntryID       string
	Originator                 *OriginatorLookup
	IsTest                     bool
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	Direction                  string
	StartTime                  Time
	EndTime                    Time
	RecordingURL               string
	TranscriptURL              string
	Transcript                 []ConversationMessage
	InProgress                 bool

	// AIExtract defaults to on when a transcript is attached. Set
	// DisableAIExtract to keep it off.
	AIExtract        bool
	DisableAIExtract bool
}

type PhoneDetails

type PhoneDetails struct {
	CountryCode string `json:"country_code,omitempty"`
	Number      string `json:"number,omitempty"`
	AreaCode    string `json:"area_code,omitempty"`
	IsTollFree  *bool  `json:"is_toll_free,omitempty"`
	Region      string `json:"region,omitempty"`
}

type PollOptions

type PollOptions struct {
	Cursor      string
	Order       string
	Limit       int
	IncludeTest *bool
}

type PollResult

type PollResult struct {
	Messages   []json.RawMessage `json:"messages"`
	NextCursor string            `json:"next_cursor"`
	HasMore    bool              `json:"has_more"`
}

func (PollResult) IdentifierMessages

func (r PollResult) IdentifierMessages() ([]IdentifierStreamMessage, error)

func (PollResult) JournalEntryMessages

func (r PollResult) JournalEntryMessages() ([]JournalEntryStreamMessage, error)

type QueryEntriesInput

type QueryEntriesInput struct {
	Filter               *FilterCriteria
	OrderBy              string
	OrderDesc            bool
	Cursor               string
	Limit                int
	IncludeIdentifiers   bool
	IncludeEvidence      bool
	IncludeOriginator    bool
	IncludeChildren      bool
	ParentJournalEntryID string
}

type QueryEntriesResult

type QueryEntriesResult struct {
	Data           []JournalEntry `json:"data"`
	NextCursor     string         `json:"nextCursor"`
	HasMore        bool           `json:"hasMore"`
	Count          int            `json:"count"`
	EstimatedTotal *int           `json:"estimatedTotal"`
}

type Queue

type Queue struct {
	ID                    string         `json:"id"`
	Name                  string         `json:"name"`
	Description           string         `json:"description"`
	FilterCriteria        map[string]any `json:"filter_criteria,omitempty"`
	CadenceDays           int            `json:"cadence_days"`
	CooldownHours         int            `json:"cooldown_hours"`
	MaxContactsPerCluster *int           `json:"max_contacts_per_cluster,omitempty"`
	RotationEnabled       bool           `json:"rotation_enabled"`
	PriorityMode          string         `json:"priority_mode"`
	AutoPopulate          bool           `json:"auto_populate"`
	ActorClusterID        string         `json:"actor_cluster_id,omitempty"`
	ActorClusterName      string         `json:"actor_cluster_name,omitempty"`
	RedisStreamKey        string         `json:"redis_stream_key,omitempty"`
	StreamVersion         int            `json:"stream_version"`
	OwnerOrgID            string         `json:"owner_org_id,omitempty"`
	CreatedBy             string         `json:"created_by,omitempty"`
	IsActive              bool           `json:"is_active"`
	IsTest                bool           `json:"is_test"`
	CreatedAt             Time           `json:"created_at"`
	UpdatedAt             Time           `json:"updated_at"`
}

type QueueClusterIdentifier

type QueueClusterIdentifier struct {
	ID         string   `json:"id"`
	Value      string   `json:"value"`
	Type       string   `json:"type"`
	IsOurs     bool     `json:"is_ours"`
	Confidence *float64 `json:"confidence,omitempty"`
}

type QueueContactLog

type QueueContactLog struct {
	ID                  string `json:"id"`
	QueueItemID         string `json:"queue_item_id"`
	QueueID             string `json:"queue_id"`
	ClusterID           string `json:"cluster_id"`
	ContactedBy         string `json:"contacted_by"`
	Outcome             string `json:"outcome"`
	ContactedAt         Time   `json:"contacted_at"`
	Notes               string `json:"notes"`
	FunnelID            string `json:"funnel_id,omitempty"`
	FunnelEntryID       string `json:"funnel_entry_id,omitempty"`
	FunnelStageID       string `json:"funnel_stage_id,omitempty"`
	PersonaID           string `json:"persona_id,omitempty"`
	ActorClusterID      string `json:"actor_cluster_id,omitempty"`
	ContactIdentifierID string `json:"contact_identifier_id,omitempty"`
	JournalEntryID      string `json:"journal_entry_id,omitempty"`
	Channel             string `json:"channel,omitempty"`
}

type QueueItem

type QueueItem struct {
	ID                  string         `json:"id"`
	QueueID             string         `json:"queue_id"`
	ClusterID           string         `json:"cluster_id"`
	RepresentativeID    string         `json:"representative_id"`
	State               string         `json:"state"`
	FunnelID            string         `json:"funnel_id,omitempty"`
	FunnelEntryID       string         `json:"funnel_entry_id,omitempty"`
	FunnelStageID       string         `json:"funnel_stage_id,omitempty"`
	PersonaID           string         `json:"persona_id,omitempty"`
	ActorClusterID      string         `json:"actor_cluster_id,omitempty"`
	SelectedChannel     string         `json:"selected_channel,omitempty"`
	JourneyState        map[string]any `json:"journey_state,omitempty"`
	Provenance          string         `json:"provenance"`
	ClaimedBy           string         `json:"claimed_by,omitempty"`
	ClaimedAt           Time           `json:"claimed_at"`
	LastContactedAt     Time           `json:"last_contacted_at"`
	LastContactedBy     string         `json:"last_contacted_by,omitempty"`
	ContactCount        int            `json:"contact_count"`
	NextContactAfter    Time           `json:"next_contact_after"`
	Priority            int            `json:"priority"`
	OwnerOrgID          string         `json:"owner_org_id,omitempty"`
	IsTest              bool           `json:"is_test"`
	CreatedAt           Time           `json:"created_at"`
	UpdatedAt           Time           `json:"updated_at"`
	RepresentativeValue string         `json:"representative_value,omitempty"`
	RepresentativeType  string         `json:"representative_type,omitempty"`
	ClusterSize         *int           `json:"cluster_size,omitempty"`
}

type QueueItemEvent

type QueueItemEvent struct {
	ID                string         `json:"id"`
	QueueItemID       string         `json:"queue_item_id"`
	QueueID           string         `json:"queue_id"`
	ClusterID         string         `json:"cluster_id"`
	RepresentativeID  string         `json:"representative_id"`
	Event             string         `json:"event"`
	State             string         `json:"state"`
	ContactCount      int            `json:"contact_count"`
	Priority          int            `json:"priority"`
	StreamVersion     int            `json:"stream_version"`
	Metadata          map[string]any `json:"metadata,omitempty"`
	IsTest            bool           `json:"is_test"`
	OccurredAt        Time           `json:"occurred_at"`
	PreviousQueueID   string         `json:"previous_queue_id,omitempty"`
	TargetQueueID     string         `json:"target_queue_id,omitempty"`
	FunnelID          string         `json:"funnel_id,omitempty"`
	FunnelEntryID     string         `json:"funnel_entry_id,omitempty"`
	FunnelStageID     string         `json:"funnel_stage_id,omitempty"`
	PersonaID         string         `json:"persona_id,omitempty"`
	ActorClusterID    string         `json:"actor_cluster_id,omitempty"`
	SelectedChannel   string         `json:"selected_channel,omitempty"`
	OwnerOrgID        string         `json:"owner_org_id,omitempty"`
	QueueName         string         `json:"queue_name,omitempty"`
	PreviousQueueName string         `json:"previous_queue_name,omitempty"`
	TargetQueueName   string         `json:"target_queue_name,omitempty"`
}

type QueuePatch

type QueuePatch struct {
	Name                  *string
	Description           *string
	FilterCriteria        map[string]any
	CadenceDays           *int
	CooldownHours         *int
	MaxContactsPerCluster *int
	RotationEnabled       *bool
	PriorityMode          *string
	AutoPopulate          *bool
	ActorClusterID        *string
	IsActive              *bool
}

QueuePatch names the fields Update should change. Anything left nil keeps the queue's current value.

type QueueService

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

func (*QueueService) Claim

func (s *QueueService) Claim(ctx context.Context, queueID string) (*QueueItem, error)

Claim returns nil when the queue holds no claimable item. A missing or inaccessible queue is an error: the API answers 404 for both, but only the empty case carries a JSON body naming it.

func (*QueueService) Complete

func (s *QueueService) Complete(ctx context.Context, queueID, itemID string, in ItemActionInput) error

func (*QueueService) Create

func (s *QueueService) Create(ctx context.Context, in CreateQueueInput) (*Queue, error)

func (*QueueService) Delete

func (s *QueueService) Delete(ctx context.Context, queueID string) error

func (*QueueService) Drop

func (s *QueueService) Drop(ctx context.Context, queueID, itemID string, in ItemActionInput) error

func (*QueueService) Get

func (s *QueueService) Get(ctx context.Context, queueID string) (*Queue, error)

func (*QueueService) ItemClusterIdentifiers

func (s *QueueService) ItemClusterIdentifiers(ctx context.Context, queueID, itemID, role string) ([]QueueClusterIdentifier, error)

func (*QueueService) ItemEvents

func (s *QueueService) ItemEvents(ctx context.Context, queueID, itemID string) ([]QueueItemEvent, error)

func (*QueueService) ItemHistory

func (s *QueueService) ItemHistory(ctx context.Context, queueID, itemID string) ([]QueueContactLog, error)

func (*QueueService) List

func (s *QueueService) List(ctx context.Context) ([]Queue, error)

func (*QueueService) ListItems

func (s *QueueService) ListItems(ctx context.Context, queueID, state string) ([]QueueItem, error)

func (*QueueService) Move

func (s *QueueService) Move(ctx context.Context, queueID, itemID string, in MoveItemInput) error

func (*QueueService) ReadStream

func (s *QueueService) ReadStream(ctx context.Context, queueID string, opts *ReadStreamOptions) (*QueueStreamResponse, error)

func (*QueueService) RecordContact

func (s *QueueService) RecordContact(ctx context.Context, queueID, itemID string, in ContactInput) error

func (*QueueService) Release

func (s *QueueService) Release(ctx context.Context, queueID, itemID string) error

func (*QueueService) Stats

func (s *QueueService) Stats(ctx context.Context, queueID string) (*QueueStats, error)

func (*QueueService) Update

func (s *QueueService) Update(ctx context.Context, queueID string, patch QueuePatch) (*Queue, error)

Update reads the queue, applies the patch, and resends every field. The API has no partial update: a field the request omits is overwritten with its zero value, which would deactivate the queue and clear its description.

type QueueStats

type QueueStats struct {
	TotalItems int `json:"total_items"`
	Pending    int `json:"pending"`
	Claimed    int `json:"claimed"`
	InProgress int `json:"in_progress"`
	Contacted  int `json:"contacted"`
	Cooldown   int `json:"cooldown"`
	Ready      int `json:"ready"`
	Completed  int `json:"completed"`
	Dropped    int `json:"dropped"`
}

type QueueStreamMessage

type QueueStreamMessage struct {
	Event               string         `json:"event"`
	QueueID             string         `json:"queue_id"`
	QueueItemID         string         `json:"queue_item_id"`
	ClusterID           string         `json:"cluster_id"`
	RepresentativeID    string         `json:"representative_id"`
	State               string         `json:"state"`
	ContactCount        int            `json:"contact_count"`
	Priority            int            `json:"priority"`
	StreamVersion       int            `json:"stream_version"`
	OccurredAt          Time           `json:"occurred_at"`
	IsTest              bool           `json:"is_test"`
	Cursor              string         `json:"cursor,omitempty"`
	PreviousQueueID     string         `json:"previous_queue_id,omitempty"`
	TargetQueueID       string         `json:"target_queue_id,omitempty"`
	RepresentativeType  string         `json:"representative_type,omitempty"`
	RepresentativeValue string         `json:"representative_value,omitempty"`
	FunnelID            string         `json:"funnel_id,omitempty"`
	FunnelEntryID       string         `json:"funnel_entry_id,omitempty"`
	FunnelStageID       string         `json:"funnel_stage_id,omitempty"`
	PersonaID           string         `json:"persona_id,omitempty"`
	ActorClusterID      string         `json:"actor_cluster_id,omitempty"`
	SelectedChannel     string         `json:"selected_channel,omitempty"`
	JourneyState        map[string]any `json:"journey_state,omitempty"`
	Metadata            map[string]any `json:"metadata,omitempty"`
}

type QueueStreamResponse

type QueueStreamResponse struct {
	StreamKey     string               `json:"stream_key"`
	Cursor        string               `json:"cursor"`
	Messages      []QueueStreamMessage `json:"messages"`
	ClaimEndpoint string               `json:"claim_endpoint,omitempty"`
	SourceOfTruth string               `json:"source_of_truth"`
}

type ReadStreamOptions

type ReadStreamOptions struct {
	Cursor  string
	Limit   int
	BlockMS int
}

type RecoverResult

type RecoverResult struct {
	Status           string `json:"status"`
	Message          string `json:"message,omitempty"`
	StreamID         string `json:"stream_id"`
	StreamName       string `json:"stream_name,omitempty"`
	IgnoreCheckpoint bool   `json:"ignore_checkpoint"`
	ClearStream      bool   `json:"clear_stream"`
	TriggeredBy      string `json:"triggered_by,omitempty"`
}

RecoverResult reports a 202; recovery then runs asynchronously.

type RecoveryHistoryOptions

type RecoveryHistoryOptions struct {
	Limit    int
	Offset   int
	StreamID string
}

type RedactionDetails

type RedactionDetails struct {
	IdentifierID   string   `json:"identifier_id"`
	IdentifierType string   `json:"identifier_type"`
	OriginalHash   string   `json:"original_hash"`
	RedactedFields []string `json:"redacted_fields"`
	RedactedAt     Time     `json:"redacted_at"`
	Reason         string   `json:"reason,omitempty"`
}

type Report

type Report struct {
	ID          string `json:"report_id"`
	Status      string `json:"status"`
	DownloadURL string `json:"download_url,omitempty"`
	StatusURL   string `json:"status_url,omitempty"`
	GeneratedAt Time   `json:"generated_at"`
}

func (Report) IsCompleted

func (r Report) IsCompleted() bool

func (Report) IsFailed

func (r Report) IsFailed() bool

func (Report) IsProcessing

func (r Report) IsProcessing() bool

type ReportService

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

func (*ReportService) Download

func (s *ReportService) Download(ctx context.Context, reportID string, w io.Writer) (int64, error)

func (*ReportService) DownloadToFile

func (s *ReportService) DownloadToFile(ctx context.Context, reportID, path string) error

func (*ReportService) GenerateIdentifierReport

func (s *ReportService) GenerateIdentifierReport(ctx context.Context, in IdentifierReportInput) (*Report, error)

func (*ReportService) GenerateJournalEntryReport

func (s *ReportService) GenerateJournalEntryReport(ctx context.Context, in JournalEntryReportInput) (*Report, error)

func (*ReportService) GenerateViewReport

func (s *ReportService) GenerateViewReport(ctx context.Context, viewID string, includeEvidence, signReport bool) (*Report, error)

GenerateViewReport picks the report kind from the view's entity type.

func (*ReportService) Status

func (s *ReportService) Status(ctx context.Context, reportID string) (*Report, error)

func (*ReportService) Wait

func (s *ReportService) Wait(ctx context.Context, reportID string, pollInterval time.Duration) (*Report, error)

Wait polls until the report leaves the processing state or ctx expires.

type SSEEvent

type SSEEvent struct {
	Event string
	Data  []byte
	ID    string
}

type ScamClassificationDetails

type ScamClassificationDetails struct {
	FactorScores    []ScamFactorScoreDetail `json:"factor_scores"`
	CompositeScore  float64                 `json:"composite_score"`
	PriorComposite  float64                 `json:"prior_composite_score"`
	IsFirstAnalysis bool                    `json:"is_first_analysis"`
	Summary         string                  `json:"summary"`
	ModelUsed       string                  `json:"model_used"`
	MessageCount    int                     `json:"message_count"`
	ContextCount    int                     `json:"context_count"`
}

type ScamFactorScoreDetail

type ScamFactorScoreDetail struct {
	Factor    string  `json:"factor"`
	Score     float64 `json:"score"`
	Rationale string  `json:"rationale,omitempty"`
}

type SearchCasesInput

type SearchCasesInput struct {
	SearchQuery        string   `json:"searchQuery,omitempty"`
	Status             []string `json:"status,omitempty"`
	Priority           []string `json:"priority,omitempty"`
	Category           string   `json:"category,omitempty"`
	Tags               []string `json:"tags,omitempty"`
	AssignedTo         string   `json:"assignedTo,omitempty"`
	CreatedBy          string   `json:"createdBy,omitempty"`
	Resolution         string   `json:"resolution,omitempty"`
	CreatedAfter       string   `json:"createdAfter,omitempty"`
	CreatedBefore      string   `json:"createdBefore,omitempty"`
	UpdatedAfter       string   `json:"updatedAfter,omitempty"`
	UpdatedBefore      string   `json:"updatedBefore,omitempty"`
	ClosedAfter        string   `json:"closedAfter,omitempty"`
	ClosedBefore       string   `json:"closedBefore,omitempty"`
	IncludesIdentifier string   `json:"includesIdentifier,omitempty"`
	TeamMemberInvolved string   `json:"teamMemberInvolved,omitempty"`
	Cursor             string   `json:"cursor,omitempty"`
	Limit              int      `json:"limit,omitempty"`
	IsTest             *bool    `json:"isTest,omitempty"`
}

SearchCasesInput is camelCase on the wire, unlike the identifier search.

type SearchCasesResult

type SearchCasesResult struct {
	Data       []Case `json:"data"`
	NextCursor string `json:"nextCursor"`
	HasMore    bool   `json:"hasMore"`
}

type SearchIdentifiersInput

type SearchIdentifiersInput struct {
	Filter                *FilterCriteria
	Limit                 int
	Cursor                string
	IncludeJournalEntries bool
}

type SearchIdentifiersResult

type SearchIdentifiersResult struct {
	Data           []Identifier `json:"data"`
	NextCursor     string       `json:"nextCursor"`
	HasMore        bool         `json:"hasMore"`
	EstimatedTotal *int         `json:"estimatedTotal"`
}

type SearchService

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

func (*SearchService) Cases

func (*SearchService) Identifiers

func (*SearchService) IdentifiersAll

func (s *SearchService) IdentifiersAll(ctx context.Context, in SearchIdentifiersInput, fn func(Identifier) error) error

IdentifiersAll walks every page of an identifier search.

type Session

type Session struct {
	ID           string `json:"id"`
	JTI          string `json:"jti"`
	UserID       string `json:"user_id"`
	UserType     string `json:"user_type"`
	ClerkUserID  string `json:"clerk_user_id"`
	ExpiresAt    Time   `json:"expires_at"`
	IPAddress    string `json:"ip_address,omitempty"`
	UserAgent    string `json:"user_agent,omitempty"`
	RevokedAt    Time   `json:"revoked_at"`
	RevokedBy    string `json:"revoked_by,omitempty"`
	RevokeReason string `json:"revoke_reason,omitempty"`
	CreatedAt    Time   `json:"created_at"`
}

type SessionService

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

func (*SessionService) DeletePasskey

func (s *SessionService) DeletePasskey(ctx context.Context, passkeyID string) error

func (*SessionService) List

func (s *SessionService) List(ctx context.Context) ([]Session, error)

func (*SessionService) ListPasskeys

func (s *SessionService) ListPasskeys(ctx context.Context) ([]Passkey, error)

func (*SessionService) Revoke

func (s *SessionService) Revoke(ctx context.Context, sessionID string) error

func (*SessionService) SetTwoFactor

func (s *SessionService) SetTwoFactor(ctx context.Context, enable bool) (*TwoFactorResult, error)

SetTwoFactor sends {"enable": …}; the server reads that key, not "enabled".

func (*SessionService) TwoFactorStatus

func (s *SessionService) TwoFactorStatus(ctx context.Context) (*TwoFactorStatus, error)

type SocialMediaDetails

type SocialMediaDetails struct {
	Platform string `json:"platform,omitempty"`
	Handle   string `json:"handle,omitempty"`
}

type SortOrder

type SortOrder struct {
	Field     string `json:"field"`
	Direction string `json:"direction"`
}

type SpecialDomainRule

type SpecialDomainRule struct {
	ID            string `json:"id"`
	Domain        string `json:"domain"`
	Category      string `json:"category"`
	PathDepth     int    `json:"path_depth"`
	StripQuery    bool   `json:"strip_query"`
	StripFragment bool   `json:"strip_fragment"`
	IsActive      bool   `json:"is_active"`
	IsDefault     bool   `json:"is_default"`
	CreatedAt     Time   `json:"created_at"`
	UpdatedAt     Time   `json:"updated_at"`
}

type StreamCursors

type StreamCursors struct {
	Beginning   string `json:"beginning"`
	End         string `json:"end"`
	Default     string `json:"default"`
	Recommended string `json:"recommended"`
}

type StreamDataType

type StreamDataType string
const (
	StreamDataJournalEntry StreamDataType = "journal_entry"
	StreamDataIdentifier   StreamDataType = "identifier"
)

type StreamEvidenceInfo

type StreamEvidenceInfo struct {
	ID             string   `json:"id"`
	Type           string   `json:"type"`
	Description    string   `json:"description,omitempty"`
	Source         string   `json:"source,omitempty"`
	CollectedAt    Time     `json:"collected_at"`
	MediaIDs       []string `json:"media_ids,omitempty"`
	OriginatorID   string   `json:"originator_id,omitempty"`
	OriginatorType string   `json:"originator_type,omitempty"`
}

type StreamIdentifierInfo

type StreamIdentifierInfo struct {
	ID           string         `json:"id"`
	Type         string         `json:"type"`
	DisplayValue string         `json:"display_value"`
	Confidence   Confidence     `json:"confidence"`
	IsOurs       bool           `json:"is_ours"`
	Label        string         `json:"label,omitempty"`
	Data         map[string]any `json:"data,omitempty"`
	CreatedAt    Time           `json:"created_at"`
	UpdatedAt    Time           `json:"updated_at"`
}

type StreamInfo

type StreamInfo struct {
	StreamID           string         `json:"stream_id"`
	Name               string         `json:"name"`
	Description        string         `json:"description,omitempty"`
	DataType           string         `json:"data_type"`
	FilterCriteria     map[string]any `json:"filter_criteria,omitempty"`
	RateLimitPerMinute int            `json:"rate_limit_per_minute"`
	BatchSize          int            `json:"batch_size"`
	Cursors            StreamCursors  `json:"cursors"`
	MessagesInStream   int64          `json:"messages_in_stream"`
	FirstEntry         string         `json:"first_entry,omitempty"`
	LastEntry          string         `json:"last_entry,omitempty"`
	ConsumerGroups     any            `json:"consumer_groups,omitempty"`
}

type StreamJournalEntryInfo

type StreamJournalEntryInfo struct {
	ID             string               `json:"id"`
	Type           string               `json:"type"`
	Description    string               `json:"description"`
	PerformedAt    Time                 `json:"performed_at"`
	OriginatorID   string               `json:"originator_id,omitempty"`
	OriginatorType string               `json:"originator_type,omitempty"`
	Evidence       []StreamEvidenceInfo `json:"evidence,omitempty"`
}

type StreamMessage

type StreamMessage struct {
	Cursor string
	Raw    json.RawMessage
}

StreamMessage is one decoded payload from an SSE `batch` or `message` event.

func (StreamMessage) Identifier

func (m StreamMessage) Identifier() (IdentifierStreamMessage, error)

func (StreamMessage) JournalEntry

func (m StreamMessage) JournalEntry() (JournalEntryStreamMessage, error)

type StreamOriginatorInfo

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

type StreamService

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

func (*StreamService) BackfillIdentifiers

func (s *StreamService) BackfillIdentifiers(ctx context.Context, streamID, fromDate string) (map[string]any, error)

BackfillIdentifiers returns the raw diagnostic payload; the endpoint publishes no stable shape.

func (*StreamService) Create

func (*StreamService) CreateTemporary

func (*StreamService) Delete

func (s *StreamService) Delete(ctx context.Context, streamID string) error

func (*StreamService) Get

func (s *StreamService) Get(ctx context.Context, streamID string) (*ExportStream, error)

func (*StreamService) List

func (*StreamService) Recover

func (s *StreamService) Recover(ctx context.Context, streamID string, ignoreCheckpoint, clearStream bool) (*RecoverResult, error)

func (*StreamService) RecoveryHistory

func (s *StreamService) RecoveryHistory(ctx context.Context, opts *RecoveryHistoryOptions) (map[string]any, error)

RecoveryHistory returns the raw diagnostic payload; the endpoint publishes no stable shape.

func (*StreamService) RecoveryInfo

func (s *StreamService) RecoveryInfo(ctx context.Context, streamID string) (map[string]any, error)

RecoveryInfo returns the raw diagnostic payload; the endpoint publishes no stable shape.

type StreamTagInfo

type StreamTagInfo struct {
	TagID    string `json:"tag_id"`
	TagTitle string `json:"tag_title"`
	Value    any    `json:"value,omitempty"`
	ValueID  string `json:"value_id,omitempty"`
}

type SubscribeOptions

type SubscribeOptions struct {
	Cursor      string
	IncludeTest bool

	// Reconnect resumes from the last seen cursor after a dropped connection.
	Reconnect       bool
	MaxReconnects   int
	ReconnectDelay  time.Duration
	MaxReconnectGap time.Duration
}

type Tag

type Tag struct {
	ID                 string     `json:"id"`
	Title              string     `json:"title"`
	TagType            string     `json:"tag_type"`
	Description        string     `json:"description,omitempty"`
	Aliases            []string   `json:"aliases,omitempty"`
	ApplicableModels   []string   `json:"applicable_models,omitempty"`
	Color              string     `json:"color,omitempty"`
	Icon               string     `json:"icon,omitempty"`
	Active             bool       `json:"active"`
	IsSystem           bool       `json:"is_system"`
	IsGlobal           bool       `json:"is_global"`
	FlowUp             bool       `json:"flow_up"`
	FlowDown           bool       `json:"flow_down"`
	AllowDynamicValues bool       `json:"allow_dynamic_values"`
	AllocatesKarma     *int       `json:"allocates_karma,omitempty"`
	OwnerOrgID         string     `json:"owner_org_id,omitempty"`
	TagValues          []TagValue `json:"tag_values,omitempty"`
	CreatedAt          Time       `json:"created_at"`
	UpdatedAt          Time       `json:"updated_at"`
}

type TagDisplay

type TagDisplay struct {
	TagID            string `json:"tag_id"`
	TagTitle         string `json:"tag_title"`
	ValueID          string `json:"value_id,omitempty"`
	ValueTitle       string `json:"value_title,omitempty"`
	Display          string `json:"display"`
	IsFlowedUp       bool   `json:"is_flowed_up"`
	IsFlowedDown     bool   `json:"is_flowed_down"`
	IsInherited      bool   `json:"is_inherited,omitempty"`
	IsSystem         bool   `json:"is_system,omitempty"`
	IsSticky         bool   `json:"is_sticky,omitempty"`
	JournalEntryID   string `json:"journal_entry_id,omitempty"`
	JournalEntryType string `json:"journal_entry_type,omitempty"`
}

TagDisplay is the rendered form of a tag on an entity, including tags inherited from ancestor or descendant entries.

type TagLookup

type TagLookup struct {
	TagName       string `json:"tag_name"`
	TagValue      string `json:"tag_value,omitempty"`
	TagValueTitle string `json:"tag_value_title,omitempty"`
}

type TagOperationDetails

type TagOperationDetails struct {
	Operation    string         `json:"operation"`
	TagID        string         `json:"tag_id,omitempty"`
	TagValueID   string         `json:"tag_value_id,omitempty"`
	TagName      string         `json:"tag_name,omitempty"`
	TagValueName string         `json:"tag_value_name,omitempty"`
	Tags         []TagRef       `json:"tags,omitempty"`
	Reason       string         `json:"reason,omitempty"`
	BatchID      string         `json:"batch_id,omitempty"`
	Metadata     map[string]any `json:"metadata,omitempty"`
}

type TagRef

type TagRef struct {
	TagID      string `json:"tag_id"`
	TagValueID string `json:"tag_value_id,omitempty"`
	TagName    string `json:"tag_name,omitempty"`
}

type TagService

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

func (*TagService) Create

func (s *TagService) Create(ctx context.Context, in CreateTagInput) (*Tag, error)

func (*TagService) CreateValue

func (s *TagService) CreateValue(ctx context.Context, tagID string, in CreateTagValue) (*TagValue, error)

func (*TagService) Delete

func (s *TagService) Delete(ctx context.Context, tagID string) error

func (*TagService) DeleteValue

func (s *TagService) DeleteValue(ctx context.Context, tagID, valueID string) error

func (*TagService) Effective

func (s *TagService) Effective(ctx context.Context, entityType, entityID string) ([]TagDisplay, error)

func (*TagService) Get

func (s *TagService) Get(ctx context.Context, tagID string) (*Tag, error)

func (*TagService) List

func (s *TagService) List(ctx context.Context, page *PageRequest) (*ListTagsResult, error)

func (*TagService) ListValues

func (s *TagService) ListValues(ctx context.Context, tagID string) ([]TagValue, error)

func (*TagService) Update

func (s *TagService) Update(ctx context.Context, tagID string, in UpdateTagInput) (*Tag, error)

func (*TagService) UpdateValue

func (s *TagService) UpdateValue(ctx context.Context, tagID, valueID string, in UpdateTagValueInput) (*TagValue, error)

type TagValue

type TagValue struct {
	ID          string `json:"id"`
	TagID       string `json:"tag_id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Order       int    `json:"order"`
	Active      bool   `json:"active"`
	CreatedAt   Time   `json:"created_at"`
	UpdatedAt   Time   `json:"updated_at"`
}

type TaskAssignmentDetails

type TaskAssignmentDetails struct {
	TaskID      string `json:"task_id"`
	TaskTitle   string `json:"task_title"`
	OldAssignee string `json:"old_assignee,omitempty"`
	NewAssignee string `json:"new_assignee,omitempty"`
}

type TaskUpdateDetails

type TaskUpdateDetails struct {
	TaskID    string `json:"task_id"`
	TaskTitle string `json:"task_title"`
	OldStatus string `json:"old_status"`
	NewStatus string `json:"new_status"`
}

type TextConversationDetails

type TextConversationDetails struct {
	Platform         string         `json:"platform"`
	ConversationType string         `json:"conversation_type,omitempty"`
	ConversationID   string         `json:"conversation_id,omitempty"`
	FirstMessageAt   Time           `json:"first_message_at,omitzero"`
	LastMessageAt    Time           `json:"last_message_at,omitzero"`
	SourceType       string         `json:"source_type,omitempty"`
	Subject          string         `json:"subject,omitempty"`
	ParticipantCount int            `json:"participant_count,omitempty"`
	ExportFormat     string         `json:"export_format,omitempty"`
	CollectionMethod string         `json:"collection_method,omitempty"`
	ChainOfCustody   []CustodyEvent `json:"chain_of_custody,omitempty"`
	PlatformMetadata map[string]any `json:"platform_metadata,omitempty"`
}

type TextConversationInput

type TextConversationInput struct {
	Description                string
	Identifiers                []IdentifierLookup
	OurIdentifiers             []IdentifierLookup
	Evidence                   []Evidence
	Media                      []Media
	CaseID                     string
	Tags                       []TagLookup
	Metadata                   map[string]any
	ParentJournalEntryID       string
	Originator                 *OriginatorLookup
	IsTest                     bool
	ExternalIdentifiers        []ExternalIdentifierInput
	ExtractExternalIdentifiers bool
	Platform                   string
	StartTime                  Time
	EndTime                    Time
	InProgress                 bool
	AIExtract                  bool
	Details                    *TextConversationDetails
}

type Time

type Time struct{ time.Time }

Time accepts RFC3339 with or without a zone; a naive value is read as UTC.

func NewTime

func NewTime(t time.Time) Time

func (Time) IsSet

func (t Time) IsSet() bool

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

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

type TwoFactorResult

type TwoFactorResult struct {
	Success bool `json:"success"`
	Enabled bool `json:"enabled"`
}

type TwoFactorStatus

type TwoFactorStatus struct {
	HasPasskeys bool `json:"has_passkeys"`
	Requires2FA bool `json:"requires_2fa"`
	CanEnable   bool `json:"can_enable"`
}

type URLConsolidationStatus

type URLConsolidationStatus struct {
	Status          string `json:"status"`
	StartedAt       Time   `json:"started_at"`
	CompletedAt     Time   `json:"completed_at"`
	TotalGroups     int    `json:"total_groups"`
	ProcessedGroups int    `json:"processed_groups"`
	Merged          int    `json:"merged"`
	Skipped         int    `json:"skipped"`
	Errors          int    `json:"errors"`
	LastError       string `json:"last_error,omitempty"`
}

type URLDetails

type URLDetails struct {
	URL string `json:"url,omitempty"`
}

type URLReferencesOptions

type URLReferencesOptions struct {
	Page     int
	PageSize int
	Sort     string
	Order    string
}

type URLReferencesResult

type URLReferencesResult struct {
	URLReferences []IdentifierURLReference `json:"url_references"`
	Total         int                      `json:"total"`
	Page          int                      `json:"page"`
	PageSize      int                      `json:"page_size"`
}

type UpdateCaseInput

type UpdateCaseInput struct {
	Title    *string `json:"title,omitempty"`
	Notes    *string `json:"notes,omitempty"`
	Status   *string `json:"status,omitempty"`
	Priority *string `json:"priority,omitempty"`
	IsTest   *bool   `json:"is_test,omitempty"`

	// Both are required, and must be non-empty, when Status is "closed".
	Resolution   *string `json:"resolution,omitempty"`
	ClosureNotes *string `json:"closure_notes,omitempty"`
}

type UpdateDomainRuleInput

type UpdateDomainRuleInput struct {
	Domain        *string `json:"domain,omitempty"`
	Category      *string `json:"category,omitempty"`
	PathDepth     *int    `json:"path_depth,omitempty"`
	StripQuery    *bool   `json:"strip_query,omitempty"`
	StripFragment *bool   `json:"strip_fragment,omitempty"`
	IsActive      *bool   `json:"is_active,omitempty"`
}

type UpdatePersonaInput

type UpdatePersonaInput struct {
	Name              *string `json:"name,omitempty"`
	Description       *string `json:"description,omitempty"`
	Personality       *string `json:"personality,omitempty"`
	Background        *string `json:"background,omitempty"`
	AddressLine1      *string `json:"address_line1,omitempty"`
	AddressLine2      *string `json:"address_line2,omitempty"`
	AddressCity       *string `json:"address_city,omitempty"`
	AddressState      *string `json:"address_state,omitempty"`
	AddressPostalCode *string `json:"address_postal_code,omitempty"`
	AddressCountry    *string `json:"address_country,omitempty"`
	IsActive          *bool   `json:"is_active,omitempty"`
}

type UpdatePersonaMediaInput

type UpdatePersonaMediaInput struct {
	Category *string `json:"category,omitempty"`
	Notes    *string `json:"notes,omitempty"`
}

type UpdateQueueInput

type UpdateQueueInput struct {
	Name                  string         `json:"name"`
	Description           string         `json:"description"`
	FilterCriteria        map[string]any `json:"filter_criteria,omitempty"`
	CadenceDays           int            `json:"cadence_days"`
	CooldownHours         int            `json:"cooldown_hours"`
	MaxContactsPerCluster *int           `json:"max_contacts_per_cluster"`
	RotationEnabled       bool           `json:"rotation_enabled"`
	PriorityMode          string         `json:"priority_mode"`
	AutoPopulate          bool           `json:"auto_populate"`
	ActorClusterID        string         `json:"actor_cluster_id,omitempty"`
	IsActive              bool           `json:"is_active"`
}

UpdateQueueInput is a whole-object replace. The server applies description, max_contacts_per_cluster, rotation_enabled, actor_cluster_id, auto_populate and is_active unconditionally, so an omitted field is written as its zero value. Use Update, which reads the queue first and resends every field, rather than building this by hand.

type UpdateTagInput

type UpdateTagInput struct {
	Title              *string          `json:"title,omitempty"`
	Description        *string          `json:"description,omitempty"`
	Aliases            []string         `json:"aliases,omitempty"`
	IsGlobal           *bool            `json:"is_global,omitempty"`
	FlowUp             *bool            `json:"flow_up,omitempty"`
	FlowDown           *bool            `json:"flow_down,omitempty"`
	AllowDynamicValues *bool            `json:"allow_dynamic_values,omitempty"`
	Color              *string          `json:"color,omitempty"`
	Icon               *string          `json:"icon,omitempty"`
	Active             *bool            `json:"active,omitempty"`
	TagValues          []CreateTagValue `json:"tag_values,omitempty"`
}

type UpdateTagValueInput

type UpdateTagValueInput struct {
	Title       *string `json:"title,omitempty"`
	Description *string `json:"description,omitempty"`
	Order       *int    `json:"order,omitempty"`
	Active      *bool   `json:"active,omitempty"`
}

type UpdateViewInput

type UpdateViewInput struct {
	Name            *string         `json:"name,omitempty"`
	Description     *string         `json:"description,omitempty"`
	Visibility      *string         `json:"visibility,omitempty"`
	FilterCriteria  *FilterCriteria `json:"filter_criteria,omitempty"`
	SortOrder       *SortOrder      `json:"sort_order,omitempty"`
	QueryString     *string         `json:"query_string,omitempty"`
	DisplaySettings map[string]any  `json:"display_settings,omitempty"`
}

type View

type View struct {
	ID             string         `json:"id"`
	Name           string         `json:"name"`
	EntityType     string         `json:"entity_type"`
	Visibility     string         `json:"visibility"`
	ViewType       string         `json:"view_type"`
	Description    string         `json:"description,omitempty"`
	Alias          string         `json:"alias,omitempty"`
	FilterCriteria map[string]any `json:"filter_criteria,omitempty"`
	SortOrder      *SortOrder     `json:"sort_order,omitempty"`
	IsSystem       bool           `json:"is_system"`
	CreatedAt      Time           `json:"created_at"`
	UpdatedAt      Time           `json:"updated_at"`
	CreatedBy      string         `json:"created_by,omitempty"`
	OrgID          string         `json:"org_id,omitempty"`
}

type ViewService

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

func (*ViewService) Create

func (s *ViewService) Create(ctx context.Context, in CreateViewInput) (*View, error)

func (*ViewService) Delete

func (s *ViewService) Delete(ctx context.Context, viewID string) error

func (*ViewService) Execute

func (s *ViewService) Execute(ctx context.Context, viewID string, opts *ExecuteViewOptions) (*ExecuteViewResult, error)

func (*ViewService) ExecuteMyJournalEntries

func (s *ViewService) ExecuteMyJournalEntries(ctx context.Context, opts *ExecuteViewOptions) (*ExecuteViewResult, error)

func (*ViewService) ExecuteMyPinboard

func (s *ViewService) ExecuteMyPinboard(ctx context.Context, opts *ExecuteViewOptions) (*ExecuteViewResult, error)

func (*ViewService) Get

func (s *ViewService) Get(ctx context.Context, viewID string) (*View, error)

func (*ViewService) List

func (s *ViewService) List(ctx context.Context, page *PageRequest) (*ListViewsResult, error)

func (*ViewService) MyJournalEntries

func (s *ViewService) MyJournalEntries(ctx context.Context) (*View, error)

func (*ViewService) MyPinboard

func (s *ViewService) MyPinboard(ctx context.Context) (*View, error)

func (*ViewService) Update

func (s *ViewService) Update(ctx context.Context, viewID string, in UpdateViewInput) (*View, error)

type WSClient

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

func (*WSClient) Close

func (w *WSClient) Close() error

func (*WSClient) Connect

func (w *WSClient) Connect(ctx context.Context) error

func (*WSClient) ListenNotifications

func (w *WSClient) ListenNotifications(ctx context.Context, fn func(Notification)) error

ListenNotifications subscribes to the notifications channel and runs until ctx is cancelled. The server subscribes nothing on connect, so the frame has to be sent explicitly.

func (*WSClient) ListenStream

func (w *WSClient) ListenStream(ctx context.Context, streamID, cursor string, includeTest bool, fn func(StreamMessage)) error

ListenStream connects, subscribes, and runs until ctx is cancelled.

func (*WSClient) On

func (w *WSClient) On(channel, event string, handler WSHandler) func()

On registers a handler for a channel and event. Pass "*" as the event to receive every message on the channel. The returned function unregisters it.

func (*WSClient) Run

func (w *WSClient) Run(ctx context.Context) error

Run reads messages until ctx is cancelled, reconnecting with backoff.

func (*WSClient) SubscribeChannel

func (w *WSClient) SubscribeChannel(ctx context.Context, channel string) error

SubscribeChannel subscribes to a non-stream channel and replays the subscription after a reconnect.

func (*WSClient) SubscribeStream

func (w *WSClient) SubscribeStream(ctx context.Context, streamID, cursor string, includeTest bool) error

func (*WSClient) UnsubscribeStream

func (w *WSClient) UnsubscribeStream(ctx context.Context, streamID string) error

type WSHandler

type WSHandler func(WSMessage)

WSHandler receives the `data` payload of a matching message. A handler registered for the "*" event receives the whole message instead.

type WSMessage

type WSMessage struct {
	Type    string          `json:"type"`
	Channel string          `json:"channel"`
	Event   string          `json:"event"`
	Data    json.RawMessage `json:"data"`
}

type WSOption

type WSOption func(*WSClient)

func WithWSLogger

func WithWSLogger(l *slog.Logger) WSOption

func WithWSMaxReconnects

func WithWSMaxReconnects(n int) WSOption

func WithWSReconnectDelay

func WithWSReconnectDelay(d time.Duration) WSOption

type ZelleDetails

type ZelleDetails struct {
	Type  string `json:"type,omitempty"`
	Value string `json:"value,omitempty"`
}

Directories

Path Synopsis
examples
consume-poll command
Polls an export stream in a loop, resuming from the last cursor.
Polls an export stream in a loop, resuming from the last cursor.
consume-sse command
Reads an export stream over SSE, reconnecting from the last cursor.
Reads an export stream over SSE, reconnecting from the last cursor.
phone-call command
Uploads a recording, files a phone call with a transcript, and completes it.
Uploads a recording, files a phone call with a transcript, and completes it.
queue-worker command
Claims queue items in a loop, records contact, and completes them.
Claims queue items in a loop, records contact, and completes them.
reports command
Generates a signed identifier report and downloads the PDF.
Generates a signed identifier report and downloads the PDF.
search-and-views command
Searches identifiers, then saves the same filter as a view.
Searches identifiers, then saves the same filter as a view.
simple-detection command
Submits a detection with two identifiers and a tag.
Submits a detection with two identifiers and a tag.
websocket-stream command
Receives export stream messages and notifications over WebSocket.
Receives export stream messages and notifications over WebSocket.

Jump to

Keyboard shortcuts

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