acnh

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 7 Imported by: 0

README

acnh

build status

Animal Crossing: New Horizons API wrapper.

Installation

$ go get github.com/dqn/acnh

Usage

package main

import (
	"fmt"

	"github.com/dqn/acnh"
	"github.com/dqn/gonso"
)

func main() {
	accessToken, _ := gonso.Auth("SESSION_TOKEN")
	a, err := acnh.New(accessToken)
	if err != nil {
		// Handle error.
	}

	r, err := a.Users()
	if err != nil {
		// Handle error.
	}

	for _, user := range r.Users {
		fmt.Println(user)
	}
}

You can get session token and access token by using gonso.

API

func New
func New(accessToken string) *ACNH

New ACNH Client.

type ACNH
func Users
func (a *ACNH) Users() UsersResponse

Get all land users.

func AuthToken
func (a *ACNH) AuthToken(userID string) AuthTokenResponse

Get token for user.

func UserProfile
func (a *ACNH) UserProfile(token, userID string) UserProfileResponse

Get user profile.

func LandProfile
func (a *ACNH) LandProfile(token, landID string) LandProfileResponse

Get land profile.

func Friends
func (a *ACNH) Friends(token string) FriendsResponse

Get friends.

func PresenceFriends
func (a *ACNH) PresenceFriends(token string) PresenceFriendsResponse

Get online friends.

func SendMessageAll
func (a *ACNH) SendMessageAll(token, message string) SendMessageResponse

Send message to all friends.

func SendMessageFriend
func (a *ACNH) SendMessageFriend(token, userID, message string) SendMessageResponse

Send message to a friend.

func SendMessageLocal
func (a *ACNH) SendMessageLocal(token, message string) SendMessageResponse

Send message local.

Response type details

See type.go.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACNH

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

func New

func New(accessToken string) (*ACNH, error)

func (*ACNH) AuthToken

func (a *ACNH) AuthToken(userID string) (*AuthTokenResponse, error)

func (*ACNH) Friends

func (a *ACNH) Friends(token string) (*FriendsResponse, error)

func (*ACNH) LandProfile

func (a *ACNH) LandProfile(token, landID string) (*LandProfileResponse, error)

func (*ACNH) PresenceFriends

func (a *ACNH) PresenceFriends(token string) (*PresenceFriendsResponse, error)

func (*ACNH) SendMessageAll

func (a *ACNH) SendMessageAll(token, message string) (*SendMessageResponse, error)

func (*ACNH) SendMessageFriend

func (a *ACNH) SendMessageFriend(token, userID, message string) (*SendMessageResponse, error)

func (*ACNH) SendMessageLocal

func (a *ACNH) SendMessageLocal(token, message string) (*SendMessageResponse, error)

func (*ACNH) UserProfile

func (a *ACNH) UserProfile(token, userID string) (*UserProfileResponse, error)

func (*ACNH) Users

func (a *ACNH) Users() (*UsersResponse, error)

type AuthTokenRequest

type AuthTokenRequest struct {
	UserID string `json:"userId"`
}

type AuthTokenResponse

type AuthTokenResponse struct {
	ExpireAt int    `json:"expireAt"`
	Token    string `json:"token"`
	Code     code   `json:"code"`
}

type Friend

type Friend struct {
	Image  string `json:"image"`
	Land   Land   `json:"land"`
	Name   string `json:"name"`
	UserID string `json:"userId"`
}

type FriendsResponse

type FriendsResponse struct {
	Friends []Friend `json:"friends"`
	Code    code     `json:"code"`
}

type Land

type Land struct {
	DisplayID int    `json:"displayId"`
	ID        string `json:"id"`
	Name      string `json:"name"`
}

type LandProfileResponse

type LandProfileResponse struct {
	MFruit     MFruit       `json:"mFruit"`
	MLanguage  string       `json:"mLanguage"`
	MNormalNpc []MNormalNpc `json:"mNormalNpc"`
	MVNm       string       `json:"mVNm"`
	MVRuby     int          `json:"mVRuby"`
	MVer       int          `json:"mVer"`
	MVillager  []MVillager  `json:"mVillager"`
	Code       code         `json:"code"`
}

type MBirth

type MBirth struct {
	Day   int `json:"day"`
	Month int `json:"month"`
}

type MFruit

type MFruit struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type MNormalNpc

type MNormalNpc struct {
	BirthDay   int    `json:"birthDay"`
	BirthMonth int    `json:"birthMonth"`
	Image      string `json:"image"`
	Name       string `json:"name"`
}

type MTimeStamp

type MTimeStamp struct {
	Day   int `json:"day"`
	Month int `json:"month"`
	Year  int `json:"year"`
}

type MVillager

type MVillager struct {
	MJpeg  string `json:"mJpeg"`
	MPNm   string `json:"mPNm"`
	UserID string `json:"userId"`
}

type PresenceFriendsResponse

type PresenceFriendsResponse struct {
	Presences []Friend `json:"presences"`
	Code      code     `json:"code"`
}

type SendMessageRequest

type SendMessageRequest struct {
	Body   string `json:"body"`
	Type   string `json:"type"`
	UserID string `json:"userId"`
}

type SendMessageResponse

type SendMessageResponse struct {
	Status string `json:"status"`
	Code   code   `json:"code"`
}

type User

type User struct {
	ID    string `json:"id"`
	Image string `json:"image"`
	Land  Land   `json:"land"`
	Name  string `json:"name"`
}

type UserProfileResponse

type UserProfileResponse struct {
	ContentID         string     `json:"contentId"`
	CreatedAt         int        `json:"createdAt"`
	Digest            string     `json:"digest"`
	LandName          string     `json:"landName"`
	MBirth            MBirth     `json:"mBirth"`
	MComment          string     `json:"mComment"`
	MHandleName       string     `json:"mHandleName"`
	MIsLandMaster     bool       `json:"mIsLandMaster"`
	MJpeg             string     `json:"mJpeg"`
	MLanguage         string     `json:"mLanguage"`
	MMyDesignAuthorID string     `json:"mMyDesignAuthorId"`
	MPNm              string     `json:"mPNm"`
	MTimeStamp        MTimeStamp `json:"mTimeStamp"`
	MVer              int        `json:"mVer"`
	Code              code       `json:"code"`
}

type UsersResponse

type UsersResponse struct {
	Users []User `json:"users"`
	Code  code   `json:"code"`
}

Jump to

Keyboard shortcuts

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