get3w

package module
v0.0.0-...-536613a Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

README

A hackable static site generator for the 21st Century

Documentation: GoDoc
Build Status: Build Status
Test Coverage: Test Coverage (gocov report)

get3w requires Go version 1.1 or greater.

Usage

import "github.com/get3w/get3w/github"

Construct a new Get3W client, then use the various services on the client to access different parts of the Get3W API. For example:

client := get3w.NewClient(nil)
apps, _, err := get3w.Apps.List()

Some API methods have optional parameters that can be passed. For example, to list public repositories for the "github" organization:

client := get3w.NewClient(nil)
opt := &get3w.RepositoryListByOrgOptions{Type: "public"}
repos, _, err := client.Repositories.ListByOrg("github", opt)
Authentication

The get3w library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle authentication for you. The easiest and recommended way to do this is using the [oauth2][] library, but you can always use any other library that provides an http.Client. If you have an OAuth2 access token (for example, a [personal API token][]), you can use it with oauth2 using:

func main() {
  ts := oauth2.StaticTokenSource(
    &oauth2.Token{AccessToken: "... your access token ..."},
  )
  tc := oauth2.NewClient(oauth2.NoContext, ts)

  client := get3w.NewClient(tc)

  // list all repositories for the authenticated user
  repos, _, err := client.Repositories.List("", nil)
}

See the [oauth2 docs][] for complete instructions on using that library.

Pagination

All requests for resource collections (repos, pull requests, issues, etc) support pagination. Pagination options are described in the get3w.ListOptions struct and passed to the list methods directly or as an embedded type of a more specific list options struct (for example get3w.PullRequestListOptions). Pages information is available via get3w.Response struct.

client := get3w.NewClient(nil)
opt := &get3w.RepositoryListByOrgOptions{
  Type: "public",
  ListOptions: get3w.ListOptions{PerPage: 10, Page: 2},
}
repos, resp, err := client.Repositories.ListByOrg("get3w", opt)
fmt.Println(resp.NextPage) // outputs 3

For complete usage of get3w, see the full package docs.

License

This library is distributed under the MIT license found in the LICENSE file.

gox -osarch=darwin/amd64 gox -osarch=windows/amd64

Documentation

Index

Constants

View Source
const (

	// EnvironmentLocal indicate local enviroment
	EnvironmentLocal = "local"
	// EnvironmentStaging indicate staging enviroment
	EnvironmentStaging = "staging"
	// EnvironmentProduction indicate production enviroment
	EnvironmentProduction = "production"

	// AccessTokenScopesAll all permissions scopes
	AccessTokenScopesAll = "all"
)
View Source
const (
	FromLocal = "local"
	FromCloud = "cloud"
)

From

View Source
const (
	PayloadStatusAdded    = "added"
	PayloadStatusModified = "modified"
	PayloadStatusRemoved  = "removed"

	PayloadTypeConfig  = "config"
	PayloadTypeSite    = "site"
	PayloadTypePage    = "page"
	PayloadTypeSection = "section"
	PayloadTypeFile    = "file"
)

Payload status and type

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.

func DefaultRepositoryHost

func DefaultRepositoryHost() string

DefaultRepositoryHost returns default repository host.

func Environment

func Environment() string

Environment returns environment of running.

func Error

func Error(v string) error

Error is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify

func Stringify(message interface{}) string

Stringify attempts to create a reasonable string representation of types in the GitHub library. It does things like resolve pointers to their values and omits struct fields with nil values.

func Time

func Time(v time.Time) *time.Time

Time is a helper routine that returns a pointer to it.

Types

type App

type App struct {
	ID          string `json:"id"`
	Owner       string `json:"owner"`
	Name        string `json:"name"`
	From        string `json:"from"`
	Path        string `json:"path"`
	Private     bool   `json:"private"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	StarCount   int64  `json:"star_count"`
	CloneCount  int64  `json:"clone_count"`
	Origin      string `json:"origin"`
	Host        string `json:"host"`
	Description string `json:"description"`
	Tags        string `json:"tags"`
	ThumbSmall  string `json:"thumb_small"`
	ThumbLarge  string `json:"thumb_large"`
}

App contains the information of the app

type AppAddInput

type AppAddInput struct {
	DirPath string `json:"dir_path"`
	Origin  string `json:"origin"`
	Check   bool   `json:"check"`
}

AppAddInput specifies fields to the AppsService.Add method.

type AppAddOutput

type AppAddOutput struct {
	Config bool `json:"config"`
	App    *App `json:"app"`
}

AppAddOutput specifies response of the AppsService.Add method.

type AppCreateInput

type AppCreateInput struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Tags        string `json:"tags,omitempty"`
	Origin      string `json:"origin,omitempty"`
	Private     bool   `json:"private,omitempty"`
}

AppCreateInput specifies fields to the AppsService.Create method.

type AppDeleteInput

type AppDeleteInput struct {
	KeepFiles bool `json:"keep_files,omitempty"`
}

AppDeleteInput specifies fields to the AppsService.Delete method.

type AppLoadInput

type AppLoadInput struct {
	LastModified string `json:"last_modified,omitempty"`
}

AppLoadInput specifies optional parameters to the AppsService.Load method.

type AppLoadOutput

type AppLoadOutput struct {
	LastModified string  `json:"last_modified,omitempty"`
	App          *App    `json:"app,omitempty"`
	Config       *Config `json:"config,omitempty"`
	Sites        []*Site `json:"sites,omitempty"`
}

AppLoadOutput specifies response of the AppsService.Load method.

type AppResult

type AppResult struct {
	App  *App  `json:"app"`
	User *User `json:"user"`
}

AppResult represents a app search result.

type AppSaveInput

type AppSaveInput struct {
	Payloads []*SavePayload `json:"payloads,omitempty"`
}

AppSaveInput specifies optional parameters to the AppsService.Save method.

type AppSaveOutput

type AppSaveOutput struct {
	LastModified string `json:"last_modified,omitempty"`
}

AppSaveOutput specifies response of the AppsService.Save method.

type AppStarInput

type AppStarInput struct {
	Star bool `json:"star,omitempty"`
}

AppStarInput specifies optional parameters to the AppsService.Star method.

type AppStarOutput

type AppStarOutput struct {
	StarCount int64 `json:"star,omitempty"`
}

AppStarOutput specifies response of the AppsService.Star method.

type AppSyncOutput

type AppSyncOutput struct {
	Log string `json:"log,omitempty"`
}

AppSyncOutput specifies response of the AppsService.Sync method.

type AppsSearchResult

type AppsSearchResult struct {
	TotalCount int          `json:"total_count"`
	AppResults []*AppResult `json:"items"`
}

AppsSearchResult represents the result of a Apps search.

type AppsService

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

AppsService handles communication with the file related methods of the Get3W API.

func (*AppsService) Add

func (s *AppsService) Add(input *AppAddInput) (*AppAddOutput, *Response, error)

Add a new app, local only.

func (*AppsService) Create

func (s *AppsService) Create(input *AppCreateInput) (*App, *Response, error)

Create a new app

func (*AppsService) CreateFolder

func (s *AppsService) CreateFolder(appPath string, input *FolderCreateInput) (*FolderCreateOutput, *Response, error)

CreateFolder create Folder

func (*AppsService) Delete

func (s *AppsService) Delete(appPath string, input *AppDeleteInput) (*App, *Response, error)

Delete app

func (*AppsService) DeleteFile

func (s *AppsService) DeleteFile(appPath, path string) (*FileDeleteOutput, *Response, error)

DeleteFile delete file

func (*AppsService) DeleteFolder

func (s *AppsService) DeleteFolder(appPath string, input *FolderDeleteInput) (*FolderDeleteOutput, *Response, error)

DeleteFolder delete Folder

func (*AppsService) Edit

func (s *AppsService) Edit(appPath string, input map[string]interface{}) (*App, *Response, error)

Edit app

func (*AppsService) EditFile

func (s *AppsService) EditFile(appPath, path string, input *FileEditInput) (*FileEditOutput, *Response, error)

EditFile edit file content

func (*AppsService) FilesChecksum

func (s *AppsService) FilesChecksum(owner, name string) (*FilesChecksumOutput, *Response, error)

FilesChecksum get path and checksum map of all files

func (*AppsService) FilesPush

func (s *AppsService) FilesPush(owner, name string, input *FilesPushInput) (*FilesPushOutput, *Response, error)

FilesPush app files and folders.

func (*AppsService) Get

func (s *AppsService) Get(appPath string) (*App, *Response, error)

Get app

func (*AppsService) GetFile

func (s *AppsService) GetFile(owner, name, path string) (*FileGetOutput, *Response, error)

GetFile get file content

func (*AppsService) List

func (s *AppsService) List() (*[]App, *Response, error)

List app

func (*AppsService) ListFiles

func (s *AppsService) ListFiles(owner, name, path string) ([]File, *Response, error)

ListFiles lists app files and folders.

func (*AppsService) Load

func (s *AppsService) Load(appPath string, input *AppLoadInput) (*AppLoadOutput, *Response, error)

Load app data

func (*AppsService) Publish

func (s *AppsService) Publish(appPath string) (*Response, error)

Publish app

func (*AppsService) Save

func (s *AppsService) Save(appPath string, input *AppSaveInput) (*AppSaveOutput, *Response, error)

Save app data

func (*AppsService) Star

func (s *AppsService) Star(appPath string, input *AppStarInput) (*AppStarOutput, *Response, error)

Star app data

func (*AppsService) Sync

func (s *AppsService) Sync(appPath string) (*AppSyncOutput, *Response, error)

Sync app data, local only

type Client

type Client struct {

	// Base URL for API requests.  BaseURL should
	// always be specified with a trailing slash.
	BaseURL *url.URL

	// Base URL for uploading files.
	UploadURL *url.URL

	// User agent used when communicating with the Get3W API.
	UserAgent string

	// Services used for talking to different parts of the Get3W API.
	Apps   *AppsService
	User   *UserService
	Users  *UsersService
	Search *SearchService
	// contains filtered or unexported fields
}

A Client manages communication with the Get3W API.

func NewClient

func NewClient(accessToken string) *Client

NewClient returns a new Get3W API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).

func (*Client) Do

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

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) NewUploadRequest

func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, mediaType string) (*http.Request, error)

NewUploadRequest creates an upload request. A relative URL can be provided in urlStr, in which case it is resolved relative to the UploadURL of the Client. Relative URLs should always be specified without a preceding slash.

type Config

type Config struct {
	Title       string `yaml:"title,omitempty" json:"title" structs:"title"`
	Keywords    string `yaml:"keywords,omitempty" json:"keywords" structs:"keywords"`
	Description string `yaml:"description,omitempty" json:"description" structs:"description"`
	FaviconURL  string `yaml:"favicon_url,omitempty" json:"favicon_url" structs:"favicon_url"`
	Layout      string `yaml:"layout,omitempty" json:"layout" structs:"layout"`
	// Where things are
	Source      string `yaml:"source,omitempty" json:"source" structs:"source"`
	Destination string `yaml:"destination,omitempty" json:"destination" structs:"destination"`
	LayoutsDir  string `yaml:"layouts_dir,omitempty" json:"layouts_dir" structs:"layouts_dir"`
	LogsDir     string `yaml:"logs_dir,omitempty" json:"logs_dir" structs:"logs_dir"`
	IncludesDir string `yaml:"includes_dir,omitempty" json:"includes_dir" structs:"includes_dir"`
	SectionsDir string `yaml:"sections_dir,omitempty" json:"sections_dir" structs:"sections_dir"`
	ImagesDir   string `yaml:"images_dir,omitempty" json:"images_dir" structs:"images_dir"`
	UploadsDir  string `yaml:"uploads_dir,omitempty" json:"uploads_dir" structs:"uploads_dir"`
	// Handling Reading
	Include []string `yaml:"include,omitempty" json:"include" structs:"include"`
	Exclude []string `yaml:"exclude,omitempty" json:"exclude" structs:"exclude"`
}

Config contains the information of the app config

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
	Status  int    `json:"status"`
}

An ErrorResponse reports one or more errors caused by an API request.

Get3W API docs: http://developer.github.com/v3/#client-errors

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type File

type File struct {
	IsDir        bool   `json:"is_dir"`
	Path         string `json:"path"`
	Name         string `json:"name"`
	Size         int64  `json:"size"`
	Checksum     string `json:"checksum"`
	LastModified string `json:"last_modified"`
}

File represents a file or folder.

type FileDeleteOutput

type FileDeleteOutput struct {
	LastModified string `json:"last_modified,omitempty"`
}

FileDeleteOutput specifies response of the UsersService.Login method.

type FileEditInput

type FileEditInput struct {
	//Content contains file content, Base64 encoded.
	Content string `json:"content,omitempty"`
}

FileEditInput specifies account and password to the UsersService.Login method.

type FileEditOutput

type FileEditOutput struct {
	LastModified string `json:"last_modified,omitempty"`
}

FileEditOutput specifies response of the UsersService.Login method.

type FileGetOutput

type FileGetOutput struct {
	Content string `json:"content,omitempty"`
}

FileGetOutput specifies response of the UsersService.Login method.

type FilesChecksumOutput

type FilesChecksumOutput struct {
	Files map[string]string `json:"files,omitempty"`
}

FilesChecksumOutput specifies response of the AppsService.Checksum method.

type FilesPushInput

type FilesPushInput struct {
	Removed  []string `json:"removed,omitempty"`
	Added    []string `json:"added,omitempty"`
	Modified []string `json:"modified,omitempty"`
	// Blob The updated tar.gz file content, Base64 encoded.
	Blob string `json:"blob,omitempty"`
}

FilesPushInput specifies optional parameters to the AppsService.FilesPush method.

type FilesPushOutput

type FilesPushOutput struct {
	LastModified string `json:"last_modified,omitempty"`
}

FilesPushOutput specifies response of the AppsService.FilesPush method.

type FolderCreateInput

type FolderCreateInput struct {
	Path string `json:"path,omitempty"`
}

FolderCreateInput specifies account and password to the UsersService.Login method.

type FolderCreateOutput

type FolderCreateOutput struct {
	LastModified string `json:"last_modified,omitempty"`
}

FolderCreateOutput specifies response of the UsersService.Login method.

type FolderDeleteInput

type FolderDeleteInput struct {
	Path string `json:"path,omitempty"`
}

FolderDeleteInput specifies account and password to the UsersService.Login method.

type FolderDeleteOutput

type FolderDeleteOutput struct {
	LastModified string `json:"last_modified,omitempty"`
}

FolderDeleteOutput specifies response of the UsersService.Login method.

type Layout

type Layout struct {
	Path         string `yaml:"path,omitempty" json:"path"`
	Layout       string `yaml:"layout,omitempty" json:"layout"`
	Content      string `yaml:"content,omitempty" json:"content"`
	FinalContent string `yaml:"final_content,omitempty" json:"final_content"`
}

Layout contains the information of the app layout

type Page

type Page struct {
	Title       string   `yaml:"title,omitempty" json:"title" structs:"title"`
	Keywords    string   `yaml:"keywords,omitempty" json:"keywords" structs:"keywords"`
	Description string   `yaml:"description,omitempty" json:"description" structs:"description"`
	Sections    []string `yaml:"sections,omitempty" json:"sections" structs:"sections"`

	Layout   string `yaml:"layout,omitempty" json:"layout" structs:"layout"`
	URL      string `yaml:"url,omitempty" json:"url" structs:"url"`
	PostPath string `yaml:"post_path,omitempty" json:"post_path" structs:"post_path"`
	Paginate int    `yaml:"paginate,omitempty" json:"paginate" structs:"paginate"`

	Name     string  `yaml:"-" json:"name" structs:"name"`
	Path     string  `yaml:"-" json:"path" structs:"path"`
	Content  string  `yaml:"-" json:"content" structs:"content"`
	Children []*Page `yaml:"-" json:"children" structs:"children"`

	Posts         []*Post                `yaml:"-" json:"-" structs:"posts"`
	AllParameters map[string]interface{} `yaml:"-" json:"-" structs:"-"`
}

Page contains the information of the app page

type PageSummary

type PageSummary struct {
	Name string `yaml:"-" json:"name"`
	Path string `yaml:"-" json:"path"`
	URL  string `yaml:"-" json:"url"`

	Children []*PageSummary `yaml:"-" json:"children"`
}

PageSummary contains page information

type Paginator

type Paginator struct {
	// current page number
	Page int `yaml:"page,omitempty" json:"page" structs:"page"`
	// number of posts per page
	PerPage int `yaml:"per_page,omitempty" json:"per_page" structs:"per_page"`
	// a list of posts for the current page
	Posts []*Post `yaml:"posts,omitempty" json:"posts" structs:"posts"`
	// total number of posts in the site
	TotalPosts int `yaml:"total_posts,omitempty" json:"total_posts" structs:"total_posts"`
	// number of pagination pages
	TotalPages int `yaml:"total_pages,omitempty" json:"total_pages" structs:"total_pages"`
	// page number of the previous pagination page, or nil if no previous page exists
	PreviousPage int `yaml:"previous_page,omitempty" json:"previous_page" structs:"previous_page"`
	// path of previous pagination page, or blank if no previous page exists
	PreviousPagePath string `yaml:"previous_page_path,omitempty" json:"previous_page_path" structs:"previous_page_path"`
	// page number of the next pagination page, or nil if no subsequent page exists
	NextPage int `yaml:"next_page,omitempty" json:"next_page" structs:"next_page"`
	// path of next pagination page, or nil if no subsequent page exists
	NextPagePath string `yaml:"next_page_path,omitempty" json:"next_page_path" structs:"next_page_path"`
	// path of current pagination page
	Path string `yaml:"path,omitempty" json:"path" structs:"path"`
}

Paginator describes a paginator

type Post

type Post struct {
	ID       string `yaml:"id,omitempty" json:"id" structs:"id"`
	Title    string `yaml:"title,omitempty" json:"title" structs:"title"`
	Layout   string `yaml:"layout,omitempty" json:"layout" structs:"layout"`
	Path     string `yaml:"path,omitempty" json:"path" structs:"path"`
	URL      string `yaml:"url,omitempty" json:"url" structs:"url"`
	Paginate int    `yaml:"paginate,omitempty" json:"paginate" structs:"paginate"`
	Content  string `yaml:"-" json:"content" structs:"content"`

	AllParameters map[string]interface{} `yaml:"-" json:"-" structs:"-"`
}

Post contains the information of the post

type Response

type Response struct {
	*http.Response

	NextPage  int
	PrevPage  int
	FirstPage int
	LastPage  int
}

Response is a Get3W API response. This wraps the standard http.Response returned from Get3W and provides convenient access to things like pagination links.

type SavePayload

type SavePayload struct {
	Path   string                 `json:"path"`
	Type   string                 `json:"type"`
	Status string                 `json:"status"`
	Data   map[string]interface{} `json:"data"`
}

SavePayload contains data for save method

type SearchOptions

type SearchOptions struct {
	Query string `url:"query,omitempty"`
	Tag   string `url:"tag,omitempty"`

	// Default is to sort by best match.
	Sort string `url:"sort,omitempty"`
	// Sort order if sort parameter is provided. Possible values are: asc,
	// desc. Default is desc.
	Order string `url:"order,omitempty"`
}

SearchOptions specifies optional parameters to the SearchService methods.

type SearchService

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

SearchService handles communication with the search related methods of the Get3w API.

func (*SearchService) Apps

Apps searches apps via various criteria.

type Section

type Section struct {
	Path string `yaml:"path,omitempty" json:"path"`
	HTML string `yaml:"html,omitempty" json:"html"`
	CSS  string `yaml:"css,omitempty" json:"css"`
	JS   string `yaml:"js,omitempty" json:"js"`
}

Section contains the information of the app section

type Site

type Site struct {
	Name string `yaml:"-" json:"name" structs:"name"`
	Path string `yaml:"-" json:"path" structs:"path"`
	URL  string `yaml:"-" json:"url" structs:"url"`

	Posts         []*Post             `yaml:"-" json:"posts" structs:"posts"`
	PageSummaries []*PageSummary      `yaml:"-" json:"page_summaries" structs:"page_summaries"`
	Pages         []*Page             `yaml:"-" json:"pages" structs:"pages"`
	Sections      map[string]*Section `yaml:"-" json:"sections" structs:"sections"`
	Layouts       map[string]*Layout  `yaml:"-" json:"layouts" structs:"layouts"`

	AllParameters map[string]interface{} `yaml:"-" json:"-" structs:"-"`
}

Site describes a language

type Token

type Token struct {
	// Owner is hash key
	Owner string `json:"owner"`
	// Scope is range key
	Scopes string `json:"scopes"`
	// AccessToken is golbal key
	AccessToken string `json:"access_token"`
	CreatedAt   string `json:"created_at"`
}

Token contains user's access token

type TokenCreateInput

type TokenCreateInput struct {
	Scopes string `json:"scopes,omitempty"`
}

TokenCreateInput specifies optional parameters to the token methods.

type TokenGetOptions

type TokenGetOptions struct {
	Scopes string `url:"scopes,omitempty"`
}

TokenGetOptions specifies optional parameters to the token methods.

type TokenRegenerateInput

type TokenRegenerateInput struct {
	Scopes string `json:"scopes,omitempty"`
}

TokenRegenerateInput specifies optional parameters to the token methods.

type UploadOptions

type UploadOptions struct {
	Name string `url:"name,omitempty"`
}

UploadOptions specifies the parameters to methods that support uploads.

type User

type User struct {
	ID                string `json:"id"`
	Username          string `json:"username"`
	Email             string `json:"email"`
	AvatarURL         string `json:"avatar_url"`
	CreatedAt         string `json:"created_at"`
	UpdatedAt         string `json:"updated_at"`
	Starred           int64  `json:"starred"`
	Locale            string `json:"locale"`
	Company           string `json:"company"`
	Location          string `json:"location"`
	URL               string `json:"url"`
	BillingPlanID     string `json:"billing_plan_id"`
	BillingCustomerID string `json:"billing_customer_id"`
	BillingCardID     string `json:"billing_card_id"`
}

User represents a Get3W user.

type UserDeleteInput

type UserDeleteInput struct {
	Password string `json:"password,omitempty"`
}

UserDeleteInput specifies parameters to the UsersService.Delete method.

type UserLoginInput

type UserLoginInput struct {
	Account  string `json:"account,omitempty"`
	Password string `json:"password,omitempty"`
}

UserLoginInput specifies account and password to the UsersService.Login method.

type UserLoginOutput

type UserLoginOutput struct {
	User        *User  `json:"user,omitempty"`
	AccessToken string `json:"access_token,omitempty"`
}

UserLoginOutput specifies response of the UsersService.Login method.

type UserPasswordForgotInput

type UserPasswordForgotInput struct {
	Email string `json:"email,omitempty"`
}

UserPasswordForgotInput specifies parameters to the UsersService.PasswordForgot method.

type UserPasswordResetInput

type UserPasswordResetInput struct {
	CurrentPassword string `json:"current_password,omitempty"`
	NewPassword     string `json:"new_password,omitempty"`
}

UserPasswordResetInput specifies parameters to the UsersService.PasswordReset method.

type UserService

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

UserService handles communication with the user related methods of the Get3w API.

func (*UserService) Get

func (s *UserService) Get() (*User, *Response, error)

Get the authenticated user.

type UserSignupInput

type UserSignupInput struct {
	Username string `json:"username,omitempty"`
	Email    string `json:"email,omitempty"`
	Password string `json:"password,omitempty"`
}

UserSignupInput specifies account and password to the UsersService.Signup method.

type UserSignupOutput

type UserSignupOutput struct {
	User        *User  `json:"user,omitempty"`
	AccessToken string `json:"access_token,omitempty"`
}

UserSignupOutput specifies response of the UsersService.Signup method.

type UsersService

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

UsersService handles communication with the user related methods of the Get3w API.

func (*UsersService) CreateToken

func (s *UsersService) CreateToken(input *TokenCreateInput) (*Token, *Response, error)

CreateToken create token.

func (*UsersService) Delete

func (s *UsersService) Delete(input *UserDeleteInput) (*Response, error)

Delete users.

func (*UsersService) DeleteToken

func (s *UsersService) DeleteToken(accessToken string) (*Response, error)

DeleteToken delete token.

func (*UsersService) Edit

func (s *UsersService) Edit(input map[string]interface{}) (*User, *Response, error)

Edit the authenticated user.

func (*UsersService) GetToken

func (s *UsersService) GetToken(opt *TokenGetOptions) (*Token, *Response, error)

GetToken get the token.

func (*UsersService) ListTokens

func (s *UsersService) ListTokens() ([]Token, *Response, error)

ListTokens get the token list.

func (*UsersService) Login

func (s *UsersService) Login(input *UserLoginInput) (*UserLoginOutput, *Response, error)

Login by the account and password.

func (*UsersService) PasswordForgot

func (s *UsersService) PasswordForgot(input *UserPasswordForgotInput) (*Response, error)

PasswordForgot send password to mail if exists

func (*UsersService) PasswordReset

func (s *UsersService) PasswordReset(input *UserPasswordResetInput) (*Response, error)

PasswordReset send password to mail if exists

func (*UsersService) RegenerateToken

func (s *UsersService) RegenerateToken(input *TokenRegenerateInput) (*Token, *Response, error)

RegenerateToken regenerate token.

func (*UsersService) Signup

Signup user

Directories

Path Synopsis
cli
types
Package types is used for API stability in the types and response to the consumers of the API stats endpoint.
Package types is used for API stability in the types and response to the consumers of the API stats endpoint.
engines
liquid/core
shared interfaces and utility functions
shared interfaces and utility functions
pkg
listenbuffer
Package listenbuffer uses the kernel's listening backlog functionality to queue connections, allowing applications to start listening immediately and handle connections later.
Package listenbuffer uses the kernel's listening backlog functionality to queue connections, allowing applications to start listening immediately and handle connections later.
locker
Package locker provides a mechanism for creating finer-grained locking to help free up more global locks to handle other tasks.
Package locker provides a mechanism for creating finer-grained locking to help free up more global locks to handle other tasks.
nat
parsers
Package parsers provides helper functions to parse and validate different type of string.
Package parsers provides helper functions to parse and validate different type of string.
parsers/filters
Package filters provides helper function to parse and handle command line filter, used for example in docker ps or docker images commands.
Package filters provides helper function to parse and handle command line filter, used for example in docker ps or docker images commands.
parsers/kernel
Package kernel provides helper function to get, parse and compare kernel versions for different platforms.
Package kernel provides helper function to get, parse and compare kernel versions for different platforms.
parsers/operatingsystem
Package operatingsystem provides helper function to get the operating system name for different platforms.
Package operatingsystem provides helper function to get the operating system name for different platforms.
pidfile
Package pidfile provides structure and helper functions to create and remove PID file.
Package pidfile provides structure and helper functions to create and remove PID file.
plugins
Package plugins provides structures and helper functions to manage Docker plugins.
Package plugins provides structures and helper functions to manage Docker plugins.
pools
Package pools provides a collection of pools which provide various data types with buffers.
Package pools provides a collection of pools which provide various data types with buffers.
progressreader
Package progressreader provides a Reader with a progress bar that can be printed out using the streamformatter package.
Package progressreader provides a Reader with a progress bar that can be printed out using the streamformatter package.
proxy
Package proxy provides a network Proxy interface and implementations for TCP and UDP.
Package proxy provides a network Proxy interface and implementations for TCP and UDP.
signal
Package signal provides helper functions for dealing with signals across various operating systems.
Package signal provides helper functions for dealing with signals across various operating systems.
sockets
Package sockets provides helper functions to create and configure Unix or TCP sockets.
Package sockets provides helper functions to create and configure Unix or TCP sockets.
streamformatter
Package streamformatter provides helper functions to format a stream.
Package streamformatter provides helper functions to format a stream.
stringid
Package stringid provides helper functions for dealing with string identifiers
Package stringid provides helper functions for dealing with string identifiers
stringutils
Package stringutils provides helper functions for dealing with strings.
Package stringutils provides helper functions for dealing with strings.
tailfile
Package tailfile provides helper functions to read the nth lines of any ReadSeeker.
Package tailfile provides helper functions to read the nth lines of any ReadSeeker.
tarsum
Package tarsum provides algorithms to perform checksum calculation on filesystem layers.
Package tarsum provides algorithms to perform checksum calculation on filesystem layers.
term
Package term provides provides structures and helper functions to work with terminal (state, sizes).
Package term provides provides structures and helper functions to work with terminal (state, sizes).
timeoutconn
Package timeoutconn provides overridden net.Conn that supports deadline (timeout).
Package timeoutconn provides overridden net.Conn that supports deadline (timeout).
timeutils
Package timeutils provides helper functions to parse and print time (time.Time).
Package timeutils provides helper functions to parse and print time (time.Time).
tlsconfig
Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers.
Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers.
ulimit
Package ulimit provides structure and helper function to parse and represent resource limits (Rlimit and Ulimit, its human friendly version).
Package ulimit provides structure and helper function to parse and represent resource limits (Rlimit and Ulimit, its human friendly version).
units
Package units provides helper function to parse and print size and time units in human-readable format.
Package units provides helper function to parse and print size and time units in human-readable format.
urlutil
Package urlutil provides helper function to check urls kind.
Package urlutil provides helper function to check urls kind.
useragent
Package useragent provides helper functions to pack version information into a single User-Agent header.
Package useragent provides helper functions to pack version information into a single User-Agent header.
plugins
hello-world
Always create a new binary
Always create a new binary
highlight
Always create a new binary
Always create a new binary
api
s3

Jump to

Keyboard shortcuts

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