🤬
Enable build support by adding .buildspec.yml
cmd/cspam Loading last commit info...
LICENSE
README.md
apiv1_client.go
apiv1_client_test.go
apiv1_model.go
example_test.go
rest.go
rest_test.go
README.md

cspam.go

crash.fyi API Client for Go and CLI tool

crash.fyi Disposable email service

This package provides a basic REST client for crash.fyi
For API details, please refer official documentation.

$ go get -u crash.software/crash.fyi/cspam.go

Usage

type Client

type Client struct {
}

Client accesses crash.fyi REST API v1

func New

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

New creates a new v1 REST API client given the base URL of the server,
ex: "https://crash.fyi"

func (*Client) DeleteMessage

func (c *Client) DeleteMessage(name, id string) error

DeleteMessage deletes a single message given the mailbox name and message ID.

func (*Client) GetMessage

func (c *Client) GetMessage(name, id string) (message *Message, err error)

GetMessage returns the message details given a mailbox name and message ID.

func (*Client) GetMessageSource

func (c *Client) GetMessageSource(name, id string) (*bytes.Buffer, error)

GetMessageSource returns the message source given a mailbox name and message ID.

func (*Client) ListMailbox

func (c *Client) ListMailbox(name string) (headers []*MessageHeader, err error)

ListMailbox returns a list of messages for the requested mailbox

func (*Client) MarkSeen

func (c *Client) MarkSeen(name, id string) error

MarkSeen marks the specified message as having been read.

func (*Client) PurgeMailbox

func (c *Client) PurgeMailbox(name string) error

PurgeMailbox deletes all messages in the given mailbox

type Message

type Message struct {
	*model.JSONMessageV1
}

Message represents a crash.fyi message including content

func (*Message) Delete

func (m *Message) Delete() error

Delete deletes this message from the mailbox

func (*Message) GetSource

func (m *Message) GetSource() (*bytes.Buffer, error)

GetSource returns the source for this message

type MessageHeader

type MessageHeader struct {
	*model.JSONMessageHeaderV1
}

MessageHeader represents a crash.fyi message sans content

func (*MessageHeader) Delete

func (h *MessageHeader) Delete() error

Delete deletes this message from the mailbox

func (*MessageHeader) GetMessage

func (h *MessageHeader) GetMessage() (message *Message, err error)

GetMessage returns this message with content

func (*MessageHeader) GetSource

func (h *MessageHeader) GetSource() (*bytes.Buffer, error)

GetSource returns the source for this message

CLI

$ go install crash.software/crash.fyi/cspam.go/cmd/cspam
❯ cspam --help

Usage: cspam <flags> <subcommand> <subcommand args>

Subcommands:
        commands         list all command names
        flags            describe all known top-level flags
        help             describe subcommands and their syntax
        list             list contents of mailbox
        match            output messages matching criteria
        mbox             output mailbox in mbox format

Top-level flags (use "client flags" for a full list):
  -host=crash.fyi: host/IP of crash.fyi server
  -port=443: HTTPS port of crash.fyi server

Author

James Hillyerd

Copyright (c) 2012 James Hillyerd

Code released under the MIT license.

Please wait...
Page is in error, reload to recover