btcjam

package module
v0.0.0-...-67b5c2d Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2014 License: MIT Imports: 9 Imported by: 0

README

Go-BTCJam

Build Status

rrooding/go-btcjam is an API client for the BTCJam bitcoin lending platform.

This is currently a Work In Progress and right now we only have the following endpoints implemented:

  • /listings

Support this project: 1kfKoGgzNgvPMCvfpsqfBMFTs82LMP9pF

Documentation

Index

Constants

View Source
const (
	ListingsRoute = "Listings"

	ProfileRoute = "Profile"
)

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors. A response is considered an error if the status code is outside the 200 range

func NewAPIRouter

func NewAPIRouter() *mux.Router

Types

type AuthOptions

type AuthOptions struct {
	ApplicationID     string `url:"appid,omitempty"`
	ApplicationSecret string `url:"secret,omitempty"`
}

AuthOptions specifies key and secret used to authenticate to the API

type Client

type Client struct {
	// Services used to communicate with different parts of BTCJam.
	Listings ListingsService

	// Base URL for API requests, which should have a trailing slash.
	BaseURL *url.URL

	// Contains a struct with the authentication options for the API
	AuthenticationOptions *AuthOptions
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) error

Do sends an API request and returns the results.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string) (*http.Request, error)

func (*Client) SetAuthentication

func (c *Client) SetAuthentication(applicationID string, applicationSecret string)

SetAuthentication allows the user to set the id and secret used to authenticate against the API

type Listing

type Listing struct {
	Data ListingData `json:"listing"`
}

This holds all listing data

type ListingData

type ListingData struct {
	Id                    int
	Title                 string
	Term                  int
	Description           string
	Amount                float64         `json:",string"`
	AmountFundedRaw       json.RawMessage `json:"amount_funded,omitempty"`
	AmountFunded          float64
	NumberOfPayments      int     `json:"number_of_payments"`
	PaymentCycle          int     `json:"payment_cycle_days"`
	StartDate             string  `json:"start_date"`
	EndDate               string  `json:"end_date"`
	Rate                  float64 `json:"rate,string"`
	PeriodicPaymentAmount float64 `json:"periodic_payment_amount"`
	DenominatedIn         string  `json:"denominated_in"`
	ListingStatus         string  `json:"listing_status"`
	LoanPurpose           string  `json:"loan_purpose"`
	PercentFunded         int     `json:"percent_funded"`
	ListingScore          int     `json:"listing_score"`
	User                  User    `json:"user"`
}

All the data belonging to a single listing

type ListingsService

type ListingsService interface {
	// List all listings
	List() ([]*Listing, error)
}

ListingsService communicates with the listings endpoint of the BTCJam API.

type Profile

type Profile struct {
}

This holds all profile data

type ProfileService

type ProfileService interface {
	// Get the profile
	Get() (*Profile, error)
}

ProfileService communicates with the profile endpoint of the BTCJam API.

type User

type User struct {
	Country               string
	PositiveRepCount      int     `json:"positive_count_reputation"`
	NegativeRepCount      int     `json:"negative_count_reputation"`
	CanBorrow             bool    `json:"can_borrow"`
	CanTrade              bool    `json:"can_trade"`
	BTCTalkVerified       bool    `json:"bitcointalk_accound_verified"`
	BTCJamScore           float64 `json:"btcjam_score_numeric,string"`
	BTCJamCode            string  `json:"btcjam_score"`
	AddressVerified       bool    `json:"address_verified"`
	IdentityVerified      bool    `json:"identity_verified"`
	PhoneVerified         bool    `json:"phone_verified"`
	FacebookConnected     bool    `json:"facebook_connected"`
	FacebookFriendCount   int     `json:"facebook_friend_count"`
	LinkedinConnected     bool    `json:"linkedin_connected"`
	PaypalConnected       bool    `json:"paypal_verified_account_connected"`
	PaypalAccountDate     string  `json:"paypal_account_date"`
	RepaidLoansCount      int     `json:"repaid_loans_count"`
	RepaidLoansAmount     float64 `json:"repaid_loans_amount"`
	LateLoansCount        int     `json:"late_loans_count"`
	LateLoansAmount       float64 `json:"late_loans_amount"`
	OpenCreditLinesCount  int     `json:"open_credit_lines_count"`
	OpenCreditLinesAmount float64 `json:"open_credit_lines_amount"`
	MadeLatePaymentsCount int     `json:"made_late_payments_count"`
}

All information about a user belonging to a listing

Jump to

Keyboard shortcuts

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