wipchat

package module
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: Apache-2.0, MIT Imports: 9 Imported by: 0

README

wipchat

😄 wipchat

CI go.dev reference License GitHub release Go Report Card CodeFactor codecov Docker Metrics GolangCI Made by Manfred Touron

Usage

$ export WIPCHAT_KEY=XXX
$ wipchat todo 👋 hello world
{
  "CreateTodo": {
    "ID": "150865",
    "CreatedAt": "2020-05-24T23:43:14Z",
    "UpdatedAt": "2020-05-24T23:43:14Z",
    "Body": "👋 hello world",
    "User": {
      "ID": "1780",
      "URL": "https://wip.co/@moul"
    }
  }
}
$ wipchat done "👋 hello world #oss"wipchat
{
  "CreateTodo": {
    "ID": "150866",
    "CreatedAt": "2020-05-24T23:44:15Z",
    "CompletedAt": "2020-05-24T23:44:15Z",
    "UpdatedAt": "2020-05-24T23:44:15Z",
    "Body": "👋 hello world #oss",
    "Product": {
      "ID": "3493",
      "Hashtag": "oss",
      "URL": "https://wip.co/products/oss"
    },
    "User": {
      "ID": "1780",
      "URL": "https://wip.co/@moul"
    }
  }
}
$ wipchat me  | jq . | head -11
{
  "Viewer": {
    "ID": "1780",
    "URL": "https://wip.co/@moul",
    "Username": "moul",
    "Firstname": "Manfred",
    "Lastname": "Touron 🇫🇷",
    "AvatarURL": "https://wip.imgix.net/cache/user/1780/avatar/acb8193abf5d107a8d644da41b071494.png?ixlib=rb-3.2.1&w=64&h=64&fit=crop&s=1b2e60b141240f8b3f975a2dc42f5cb5",
    "CompletedTodosCount": 128,
    "BestStreak": 16,
    "Streaking": true,
$ wipchat me | jq '.Viewer.Todos[].Body'
"🟨 join WIP #life"
"🟨 add #berty on WIP"
"🟨 add #oss on WIP"
"♻️ find or make an integration to have my todos on WIP without leaving trello #life"
"🐛 fix an AMP bug in a hugo-template, that I missed for multiple weeks on my personal website #life"
$ wipchat me | jq '.Viewer.Products[].Name'
"Missions"
"protoc-gen-gotemplate"
"Alfred TOTP"
"Scaleway"
"gRPCb.in"
"FranceP2P / Paris P2P"
"Ultreme"
"Wulo"
"WIP Tools"
"Berty"
"Manfred's Life"
"Open-source stuff"
"Millipede"
"multiarch"
"Pathwar"
"depviz"
"sshportal"
"assh"

Install

Using go
$ go get -u moul.io/wipchat
Releases

See https://github.com/moul/wipchat/releases

License

© 2020 Manfred Touron

Licensed under the Apache License, Version 2.0 (LICENSE-APACHE) or the MIT license (LICENSE-MIT), at your option. See the COPYRIGHT file for more details.

SPDX-License-Identifier: (Apache-2.0 OR MIT)

Documentation

Overview

message from the author:

+--------------------------------------------------------------+
| * * * ░░░░░░░░░░░░░░░░░░░░  Hello  ░░░░░░░░░░░░░░░░░░░░░░░░░░|
+--------------------------------------------------------------+
|                                                              |
|     ++              ______________________________________   |
|     ++++           /                                      \  |
|      ++++          |                                      |  |
|    ++++++++++      |   Feel free to contribute to this    |  |
|   +++       |      |       project or contact me on       |  |
|   ++         |     |    manfred.life if you like this     |  |
|   +  -==   ==|     |               project!               |  |
|  (   <*>   <*>     |                                      |  |
|   |          |    /|                  :)                  |  |
|   |         _)   / |                                      |  |
|   |      +++    /  \______________________________________/  |
|    \      =+   /                                             |
|     \      +                                                 |
|     |\++++++                                                 |
|     |  ++++      ||//                                        |
|  ___|   |___    _||/__                                     __|
| /    ---    \   \|  |||                   __ _  ___  __ __/ /|
|/  |       |  \    \ /                    /  ' \/ _ \/ // / / |
||  |       |  |    | |                   /_/_/_/\___/\_,_/_/  |
+--------------------------------------------------------------+

Index

Constants

View Source
const (
	ErrTokenRequired = Error("token required")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	ID          graphql.ID `graphql:"id" json:"id,omitempty"`
	AspectRatio float64    `graphql:"aspectRatio" json:"aspect_ratio,omitempty"`
	CreatedAt   *time.Time `graphql:"createdAt" json:"created_at,omitempty"`
	Filename    string     `graphql:"filename" json:"filename,omitempty"`
	MimeType    string     `graphql:"mimeType" json:"mime_type,omitempty"`
	Size        int        `graphql:"size" json:"size,omitempty"`
	UpdatedAt   *time.Time `graphql:"updatedAt" json:"updated_at,omitempty"`
	URL         string     `graphql:"url" json:"url,omitempty"`
}

type Client

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

func New

func New(apikey string) Client

func (Client) MutateCreateTodo

func (c Client) MutateCreateTodo(ctx context.Context, body string, completedAt *time.Time, attachments []FilePayload) (*Todo, error)

func (Client) QueryProducts

func (c Client) QueryProducts(ctx context.Context, limit int) ([]Product, error)

func (Client) QueryTodos

func (c Client) QueryTodos(ctx context.Context, opts *QueryTodosOptions) ([]Todo, error)

func (Client) QueryUser

func (c Client) QueryUser(ctx context.Context, opts *QueryUserOptions) (*User, error)

func (Client) QueryViewer

func (c Client) QueryViewer(ctx context.Context, opts *QueryViewerOptions) (*User, error)

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type FilePayload

type FilePayload struct {
	Filename string
	Bytes    []byte
}

type Product

type Product struct {
	ID         graphql.ID `graphql:"id" json:"id,omitempty"`
	CreatedAt  *time.Time `graphql:"created_at" json:"created_at,omitempty"`
	Hashtag    string     `graphql:"hashtag" json:"hashtag,omitempty"`
	Name       string     `graphql:"name" json:"name,omitempty"`
	Pitch      string     `graphql:"pitch" json:"pitch,omitempty"`
	UpdatedAt  *time.Time `graphql:"updated_at" json:"updated_at,omitempty"`
	URL        string     `graphql:"url" json:"url,omitempty"`
	WebsiteURL string     `graphql:"website_url" json:"website_url,omitempty"`
	Makers     []User     `graphql:"makers" json:"makers,omitempty"`
	Todos      []Todo     `graphql:"todos" json:"todos,omitempty"`
}

type QueryTodosOptions

type QueryTodosOptions struct {
	TodosCompleted bool
	TodosLimit     int
	TodosFilter    string
}

func (*QueryTodosOptions) ApplyDefaults

func (opts *QueryTodosOptions) ApplyDefaults()

type QueryUserOptions

type QueryUserOptions struct {
	TodosCompleted bool
	TodosLimit     int
	TodosOffset    int
	TodosFilter    string
	TodosOrder     string
	AvatarSize     int
	UserID         string
	Username       string
}

func (*QueryUserOptions) ApplyDefaults

func (opts *QueryUserOptions) ApplyDefaults()

type QueryViewerOptions

type QueryViewerOptions struct {
	TodosCompleted bool
	TodosLimit     int
	TodosOffset    int
	TodosFilter    string
	TodosOrder     string
	AvatarSize     int
}

func (*QueryViewerOptions) ApplyDefaults

func (opts *QueryViewerOptions) ApplyDefaults()

type Todo

type Todo struct {
	ID          graphql.ID   `graphql:"id" json:"id,omitempty"`
	Product     *Product     `graphql:"product" json:"product,omitempty"`
	UpdatedAt   *time.Time   `graphql:"updated_at" json:"updated_at,omitempty"`
	User        *User        `graphql:"user" json:"user,omitempty"`
	CreatedAt   *time.Time   `graphql:"created_at" json:"created_at,omitempty"`
	CompletedAt *time.Time   `graphql:"completed_at" json:"completed_at,omitempty"`
	Body        string       `graphql:"body" json:"body,omitempty"`
	Attachments []Attachment `graphql:"attachments" json:"attachments,omitempty"`
}

func (*Todo) CanonicalURL

func (t *Todo) CanonicalURL() string

type TodoInput

type TodoInput struct {
	Body        graphql.String    `json:"body"`
	CompletedAt *time.Time        `json:"completed_at,omitempty"`
	Attachments []attachmentInput `json:"attachments"`
}

type User

type User struct {
	ID                  graphql.ID `graphql:"id" json:"id,omitempty"`
	URL                 string     `graphql:"url" json:"url,omitempty"`
	Username            string     `graphql:"username" json:"username,omitempty"`
	Firstname           string     `graphql:"first_name" json:"first_name,omitempty"`
	Lastname            string     `graphql:"last_name" json:"last_name,omitempty"`
	AvatarURL           string     `graphql:"avatar_url" json:"avatar_url,omitempty"`
	CompletedTodosCount int        `graphql:"completed_todos_count" json:"completed_todos_count,omitempty"`
	BestStreak          int        `graphql:"best_streak" json:"best_streak,omitempty"`
	Streaking           bool       `graphql:"streaking" json:"streaking,omitempty"`
	Todos               []Todo     `graphql:"todos" json:"todos,omitempty"`
	Products            []Product  `graphql:"products" json:"products,omitempty"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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