Documentation
¶
Index ¶
- Constants
- Variables
- func ReadBody(t testing.TB, resp *http.Response) string
- func ReadJSON(t testing.TB, resp *http.Response) map[string]any
- func RedirectParams(t testing.TB, resp *http.Response, redirectURI string) url.Values
- type Answer
- type AuthorizeForm
- type CLIResult
- type CLIRun
- type ConnectOption
- func WithElicitation(handler func(context.Context, *mcp.ElicitRequest) (*mcp.ElicitResult, error)) ConnectOption
- func WithIP(ip string) ConnectOption
- func WithProtocol(version string) ConnectOption
- func WithReceivingMiddleware(middleware mcp.Middleware) ConnectOption
- func WithToolListChanged(handler func(context.Context, *mcp.ToolListChangedRequest)) ConnectOption
- func WithoutMultiRoundTrip() ConnectOption
- type Harness
- func (h *Harness) AddAccount(t testing.TB, name, phone, profile string)
- func (h *Harness) AuditLines(t testing.TB) []map[string]any
- func (h *Harness) AuditRaw() string
- func (h *Harness) Authorize(t testing.TB, login *Login, accessName string, accounts ...string) string
- func (h *Harness) AwaitAccountState(t testing.TB, name, state string)
- func (h *Harness) AwaitPairing(t testing.TB, phone string) *fake.Pairing
- func (h *Harness) CLI(t testing.TB, args ...string) CLIResult
- func (h *Harness) CLIWithInput(t testing.TB, stdin string, args ...string) CLIResult
- func (h *Harness) Connect(t testing.TB, token string, opts ...ConnectOption) *mcp.ClientSession
- func (h *Harness) Do(t testing.TB, req *http.Request) *http.Response
- func (h *Harness) ExchangeCode(t testing.TB, login *Login, code string) (*http.Response, map[string]any)
- func (h *Harness) Get(t testing.TB, path string, opts ...RequestOption) *http.Response
- func (h *Harness) LoginFor(client OAuthClient) *Login
- func (h *Harness) MCPURL() string
- func (h *Harness) NewLogin(t testing.TB) *Login
- func (h *Harness) OAuthLogin(t testing.TB, accessName string, accounts ...string) (*Login, Tokens)
- func (h *Harness) OpenAuthorizePage(t testing.TB, query url.Values, opts ...RequestOption) AuthorizeForm
- func (h *Harness) Options(t testing.TB, path string, opts ...RequestOption) *http.Response
- func (h *Harness) Post(t testing.TB, path string, body io.Reader, contentType string, ...) *http.Response
- func (h *Harness) PostForm(t testing.TB, path string, form url.Values, opts ...RequestOption) *http.Response
- func (h *Harness) PostJSON(t testing.TB, path string, body any, opts ...RequestOption) *http.Response
- func (h *Harness) Refresh(t testing.TB, client OAuthClient, refreshToken string) (*http.Response, map[string]any)
- func (h *Harness) RegisterOAuthClient(t testing.TB, metadata map[string]any) OAuthClient
- func (h *Harness) Restart(t testing.TB)
- func (h *Harness) Resume(t testing.TB)
- func (h *Harness) StartCLI(args ...string) *CLIRun
- func (h *Harness) StartCLIWithInput(stdin string, args ...string) *CLIRun
- func (h *Harness) StartReceiver(t testing.TB, answers ...Answer) *Receiver
- func (h *Harness) StaticToken(t testing.TB, name string, accounts []string, readOnly bool) string
- func (h *Harness) Stop(t testing.TB)
- func (h *Harness) SubmitAuthorize(t testing.TB, values url.Values, opts ...RequestOption) *http.Response
- func (h *Harness) TokenRequest(t testing.TB, form url.Values, opts ...RequestOption) (*http.Response, map[string]any)
- func (h *Harness) TryConnect(token string, opts ...ConnectOption) (*mcp.ClientSession, error)
- func (h *Harness) Upload(t testing.TB, token string, data []byte, contentType string) string
- type Hosts
- type Login
- type OAuthClient
- type Option
- type PKCE
- type Random
- type Received
- type Receiver
- type RequestOption
- type Tokens
Constants ¶
View Source
const ( LegacyProtocol = "2025-11-25" StatelessProtocol = "2026-07-28" )
View Source
const ( PublicURL = "https://wpp.example.test" OwnerPassword = "owner-password-for-tests" DefaultIP = "203.0.113.7" )
View Source
const ( FakeVoiceNotePrefix = "OggS fake voice note of " FakeMediaDuration = 3400 * time.Millisecond )
View Source
const ClaudeCallback = "https://claude.ai/api/mcp/auth_callback"
View Source
const NoJitter = 0.5
View Source
const (
ReceiverPath = "/hooks/whatsapp"
)
View Source
const UploadsPath = "/uploads"
Variables ¶
View Source
var StartTime = time.Date(2026, 10, 13, 12, 0, 0, 0, time.UTC)
Functions ¶
Types ¶
type Answer ¶ added in v0.2.0
type Answer struct {
Status int
Header http.Header
Body string
Endless bool
Hold <-chan struct{}
HangUp bool
}
func EndlessBody ¶ added in v0.2.0
func ReplyWithBody ¶ added in v0.2.0
func RetryAfter ¶ added in v0.2.0
type AuthorizeForm ¶
type AuthorizeForm struct {
Hidden url.Values
Fields map[string]string
Accounts []string
Checked []string
Page string
StatusCode int
}
func ParseAuthorizeForm ¶
func ParseAuthorizeForm(status int, page string) AuthorizeForm
func (AuthorizeForm) Submission ¶
func (f AuthorizeForm) Submission(password, accessName string, accounts ...string) url.Values
type ConnectOption ¶
type ConnectOption func(*connectOptions)
func WithElicitation ¶
func WithElicitation(handler func(context.Context, *mcp.ElicitRequest) (*mcp.ElicitResult, error)) ConnectOption
func WithIP ¶
func WithIP(ip string) ConnectOption
func WithProtocol ¶
func WithProtocol(version string) ConnectOption
func WithReceivingMiddleware ¶
func WithReceivingMiddleware(middleware mcp.Middleware) ConnectOption
func WithToolListChanged ¶
func WithToolListChanged(handler func(context.Context, *mcp.ToolListChangedRequest)) ConnectOption
func WithoutMultiRoundTrip ¶
func WithoutMultiRoundTrip() ConnectOption
type Harness ¶
type Harness struct {
URL string
AdminSocket string
DataDir string
Owner *admin.Client
WhatsApp *fake.World
Clock *clock.Manual
Hosts *Hosts
Random *Random
// contains filtered or unexported fields
}
func (*Harness) AddAccount ¶
func (*Harness) AwaitAccountState ¶
func (*Harness) AwaitPairing ¶
func (*Harness) CLIWithInput ¶
func (*Harness) Connect ¶
func (h *Harness) Connect(t testing.TB, token string, opts ...ConnectOption) *mcp.ClientSession
func (*Harness) ExchangeCode ¶
func (*Harness) LoginFor ¶
func (h *Harness) LoginFor(client OAuthClient) *Login
func (*Harness) OAuthLogin ¶
func (*Harness) OpenAuthorizePage ¶
func (h *Harness) OpenAuthorizePage(t testing.TB, query url.Values, opts ...RequestOption) AuthorizeForm
func (*Harness) RegisterOAuthClient ¶
func (*Harness) StartCLIWithInput ¶
func (*Harness) StartReceiver ¶ added in v0.2.0
func (*Harness) StaticToken ¶
func (*Harness) SubmitAuthorize ¶
func (*Harness) TokenRequest ¶
func (*Harness) TryConnect ¶
func (h *Harness) TryConnect(token string, opts ...ConnectOption) (*mcp.ClientSession, error)
type Hosts ¶ added in v0.2.0
type Hosts struct {
// contains filtered or unexported fields
}
func (*Hosts) LookupNetIP ¶ added in v0.2.0
type OAuthClient ¶
type Option ¶
type Option func(*options)
func WithConfig ¶
func WithPublicURLOfTheListener ¶
func WithPublicURLOfTheListener() Option
func WithRealFFmpeg ¶
func WithRealFFmpeg() Option
func WithWebhookTimeout ¶ added in v0.2.0
type Receiver ¶ added in v0.2.0
type Receiver struct {
URL string
// contains filtered or unexported fields
}
type RequestOption ¶
func FromIP ¶
func FromIP(ip string) RequestOption
func WithBasicAuth ¶
func WithBasicAuth(user, password string) RequestOption
func WithBearer ¶
func WithBearer(token string) RequestOption
Click to show internal directories.
Click to hide internal directories.