posh

package module
v0.0.0-...-8754bd9 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2017 License: MIT Imports: 6 Imported by: 0

README

GoDoc Go Report Card CircleCI

Posh

Poshmark API client for the Go programming language

Installing

You can fetch this library by running the following

go get -u github.com/joshdk/posh

Example

You can construct a simple client with the following

creds := posh.Credentials{
	Email:    "me@example.com",
	Password: "Pa$sw0rd",
}

config := posh.Config{
	Credentials: &creds,
}

client, err := posh.NewClient(config)
if err != nil {
	panic(err.Error())
}

fmt.Println(client.Session())

License

This library is distributed under the MIT License, see LICENSE.txt for more information.

Documentation

Index

Constants

View Source
const (
	EmailEnvironmentVariable    = "POSHMARK_EMAIL"
	PasswordEnvironmentVariable = "POSHMARK_PASSWORD"
	UserIDEnvironmentVariable   = "POSHMARK_USERID"
	TokenEnvironmentVariable    = "POSHMARK_TOKEN"
	BaseURL                     = "https://api.poshmark.com/api"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config Config) (*Client, error)

func (*Client) Login

func (client *Client) Login(request *LoginRequest) (*LoginResponse, error)

func (*Client) Session

func (client *Client) Session() Session

type Config

type Config struct {
	BaseURL     string
	Credentials *Credentials
}

type Credentials

type Credentials struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func NewCredentials

func NewCredentials(email string, password string) *Credentials

func NewEnvCredentials

func NewEnvCredentials() (*Credentials, error)

type LoginRequest

type LoginRequest struct {
	UserHandle string `json:"user_handle"`
	Password   string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken string `json:"access_token"`
	CreatedAt   int    `json:"created_at"`
	ExpiresAt   string `json:"expires_at"`
	User        User   `json:"user"`
}

type Session

type Session struct {
	UserID string `json:"user-id"`
	Token  string `json:"token"`
}

func NewEnvSession

func NewEnvSession() (*Session, error)

func NewSession

func NewSession(userID string, token string) *Session

type User

type User struct {
	ID            string `json:"id"`
	Email         string `json:"email"`
	Username      string `json:"username"`
	DisplayHandle string `json:"display_handle"`
	FullName      string `json:"full_name"`
	FirstName     string `json:"first_name"`
	LastName      string `json:"last_name"`
	Gender        string `json:"gender"`
}

Jump to

Keyboard shortcuts

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