httpclient

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package httpclient has clients of Google's APIs, with go-auth's auth/httpclient, so a request which isn't authorized returns an AuthError, which says a sign-in is needed.

Index

Constants

View Source
const (
	// CalendarEndpoint is the endpoint of the Google Calendar API
	CalendarEndpoint = "https://www.googleapis.com/calendar/v3"

	// CalendarScope is the scope of reading and writing calendars, and
	// CalendarReadonlyScope of reading them
	CalendarScope         = "https://www.googleapis.com/auth/calendar"
	CalendarReadonlyScope = "https://www.googleapis.com/auth/calendar.readonly"
)
View Source
const (
	// DriveEndpoint is the endpoint of the Google Drive API
	DriveEndpoint = "https://www.googleapis.com/drive/v3"

	// DriveScope is the scope of reading and writing files, and
	// DriveReadonlyScope of reading them
	DriveScope         = "https://www.googleapis.com/auth/drive"
	DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly"

	// DriveFolderType is the type of a folder, and DriveAppsPrefix the
	// prefix of the types of Google's own files, such as Docs, and
	// shortcuts, which have no content of their own
	DriveFolderType = "application/vnd.google-apps.folder"
	DriveAppsPrefix = "application/vnd.google-apps."
)
View Source
const (
	// PeopleEndpoint is the endpoint of the Google People API
	PeopleEndpoint = "https://people.googleapis.com/v1"

	// ContactsScope is the scope of reading and writing contacts, and
	// ContactsReadonlyScope of reading them
	ContactsScope         = "https://www.googleapis.com/auth/contacts"
	ContactsReadonlyScope = "https://www.googleapis.com/auth/contacts.readonly"

	// PersonFields are the fields of a contact which are read, as a vCard
	PersonFields = "metadata,names,nicknames,emailAddresses,phoneNumbers,urls,addresses,organizations,birthdays,biographies,photos"
)
View Source
const (
	// TasksEndpoint is the endpoint of the Google Tasks API
	TasksEndpoint = "https://tasks.googleapis.com/tasks/v1"

	// TasksScope is the scope of reading and writing tasks, and
	// TasksReadonlyScope of reading them
	TasksScope         = "https://www.googleapis.com/auth/tasks"
	TasksReadonlyScope = "https://www.googleapis.com/auth/tasks.readonly"
)
View Source
const (
	// UserinfoEndpoint is the endpoint of the user who signed in
	UserinfoEndpoint = "https://openidconnect.googleapis.com/v1/userinfo"

	// EmailScope is the scope of reading the email address of the user who
	// signed in
	EmailScope = "https://www.googleapis.com/auth/userinfo.email"
)
View Source
const DefaultUploadChunk = 8 << 20

DefaultUploadChunk is how much of a file is uploaded in each request, which is all that's in memory of it, as it's uploaded, a multiple of 256 KiB, as Google's resumable uploads must be

Variables

View Source
var ErrSyncTokenGone = errors.New("the sync token is gone")

ErrSyncTokenGone is the error of a sync token which Google no longer accepts, as it's expired, or the calendar's changes since it can't be listed, so its events are synced again, for another

Functions

This section is empty.

Types

type Calendar

type Calendar struct {
	Id              string `json:"id"`
	ETag            string `json:"etag,omitempty"`
	Summary         string `json:"summary,omitempty"`
	SummaryOverride string `json:"summaryOverride,omitempty"` // The name the user gave it
	TimeZone        string `json:"timeZone,omitempty"`
	Primary         bool   `json:"primary,omitempty"`
	Deleted         bool   `json:"deleted,omitempty"`
	AccessRole      string `json:"accessRole,omitempty"`
}

Calendar is a calendar of the user's calendar list Reference: https://developers.google.com/calendar/api/v3/reference/calendarList

type CalendarClient

type CalendarClient struct {
	*authclient.Client
}

CalendarClient is a client of the Google Calendar API

func NewCalendarClient

func NewCalendarClient(endpoint string, opts ...client.ClientOpt) (*CalendarClient, error)

NewCalendarClient returns a client of the Google Calendar API, at its endpoint, or CalendarEndpoint, when it's empty, with go-client's options

func (*CalendarClient) Calendars

func (c *CalendarClient) Calendars(ctx context.Context) ([]Calendar, error)

Calendars returns the calendars of the user's calendar list, a page at a time, without those which are deleted

func (*CalendarClient) Check

func (c *CalendarClient) Check(ctx context.Context) error

Check returns nil when the calendars can be read, or an AuthError, when a sign-in is needed

func (*CalendarClient) DeleteEvent

func (c *CalendarClient) DeleteEvent(ctx context.Context, calendar, id string) error

DeleteEvent deletes an event of a calendar, or one time an event which repeats occurs, of its id

func (*CalendarClient) Event

func (c *CalendarClient) Event(ctx context.Context, calendar, id string) (*Event, error)

Event returns an event of a calendar, or an occurrence of one, by their ids

func (*CalendarClient) Events

func (c *CalendarClient) Events(ctx context.Context, calendar string, from, to time.Time) ([]Event, error)

Events returns the events of a calendar which are between the times, a page at a time, each occurrence of an event which repeats being an event of its own, without those which are cancelled

func (*CalendarClient) InsertEvent

func (c *CalendarClient) InsertEvent(ctx context.Context, calendar string, fields EventFields) (*Event, error)

InsertEvent creates an event in a calendar, of its fields, and returns it, with the id Google gives it. Those who are invited aren't sent emails, of it, nor of a patch, or a delete.

func (*CalendarClient) PatchEvent

func (c *CalendarClient) PatchEvent(ctx context.Context, calendar, id string, fields EventFields) (*Event, error)

PatchEvent changes the fields of an event of a calendar, or of one time an event which repeats occurs, of its id, and returns it, keeping those which aren't in the fields

func (*CalendarClient) Sync

func (c *CalendarClient) Sync(ctx context.Context, calendar, token string) ([]Event, string, error)

Sync returns a calendar's events which changed since the sync token, of their ids, status, start, and what repeats, and those which are cancelled, which say they are, and the token of the changes after them. An event which repeats is itself, rather than the times it occurs, unless one of them changed on its own. Without a token, it's every event, of its id alone, for a token. Returns ErrSyncTokenGone when Google no longer accepts the token, so it's synced again without one. Reference: https://developers.google.com/calendar/api/guides/sync

type DriveChange

type DriveChange struct {
	FileId  string    `json:"fileId"`
	Removed bool      `json:"removed,omitempty"`
	File    DriveFile `json:"file"`
}

DriveChange is a change to a file: it's removed, such as when it's deleted, or no longer shared, or it's the file as it is now, which can be in the bin, or another's

type DriveClient

type DriveClient struct {
	*authclient.Client
}

DriveClient is a client of the Google Drive API, of a person's files

func NewDriveClient

func NewDriveClient(endpoint string, opts ...client.ClientOpt) (*DriveClient, error)

NewDriveClient returns a client of the Google Drive API, at its endpoint, or DriveEndpoint, when it's empty, with go-client's options, such as a token, a tracer, or a rate limit

func (*DriveClient) Changes

func (c *DriveClient) Changes(ctx context.Context, token string) ([]DriveChange, string, error)

Changes returns the changes to the files of My Drive since the token, a page at a time, and the token of the changes after them. A token which Google doesn't accept, such as one which has expired, is 400 or 404.

func (*DriveClient) CreateFile

func (c *DriveClient) CreateFile(ctx context.Context, meta DriveWrite) (*DriveFile, error)

CreateFile creates a file, without content, or a folder, of its type, of its metadata, which has its name, and the folder it's in, and returns it

func (*DriveClient) Download

func (c *DriveClient) Download(ctx context.Context, id, revision string, offset, length int64, fn func(io.Reader) error) error

Download reads the content of a file, of its id, which isn't Google's own, such as a Doc, of a revision, or the current one, when it's empty, from the offset, to the end, or of its length, when it's more than zero, with the function, as it's received, without a timeout, other than the context's, as a file can be large

func (*DriveClient) Export

func (c *DriveClient) Export(ctx context.Context, id, mimeType string, fn func(io.Reader) error) error

Export reads the content of a Google Doc, Sheet or Slides, of its id, as the type, such as a Word document, with the function, as it's received. Google exports at most 10 MB, and returns 403 for more.

func (*DriveClient) File

func (c *DriveClient) File(ctx context.Context, id string) (*DriveFile, error)

File returns a file, of its id, of the fields which are listed

func (*DriveClient) Files

func (c *DriveClient) Files(ctx context.Context) ([]DriveFile, error)

Files returns the files, and folders, which the person owns, which aren't in the bin, a page at a time. Files which others own, such as those shared with the person, aren't returned.

func (*DriveClient) Root

func (c *DriveClient) Root(ctx context.Context) (string, error)

Root returns the id of the folder of My Drive, which is how the files are checked to be readable, or an AuthError, when a sign-in is needed

func (*DriveClient) StartPageToken

func (c *DriveClient) StartPageToken(ctx context.Context) (string, error)

StartPageToken returns the token of the changes from now

func (*DriveClient) Trash

func (c *DriveClient) Trash(ctx context.Context, id string) (*DriveFile, error)

Trash moves a file, or a folder, with what's in it, of its id, to the bin, from which it can be restored, and returns it

func (*DriveClient) Upload

func (c *DriveClient) Upload(ctx context.Context, id string, meta DriveWrite, r io.Reader, chunk int) (*DriveFile, error)

Upload uploads a file's content, as a new file, of its metadata, or, of an id, as a new revision of that file, keeping its id, link, and who it's shared with, and returns it. The content is uploaded in chunks, of chunk, or DefaultUploadChunk, when it's zero, with Google's resumable upload, as it's read, so all of it isn't in memory, of requests which have the client's token, quota, and tracing, but no timeout, other than the context's. Reference: https://developers.google.com/drive/api/guides/manage-uploads#resumable

func (*DriveClient) Version

func (c *DriveClient) Version(ctx context.Context, id string) (string, error)

Version returns the version of a file, of its id, which increases whenever it's changed

type DriveFile

type DriveFile struct {
	Id           string       `json:"id"`
	Name         string       `json:"name"`
	MimeType     string       `json:"mimeType"`
	Parents      []string     `json:"parents,omitempty"`
	Size         string       `json:"size,omitempty"` // Of a file which isn't Google's own, such as a Doc, in bytes, as a string
	MD5Checksum  string       `json:"md5Checksum,omitempty"`
	ModifiedTime time.Time    `json:"modifiedTime,omitzero"`
	Version      string       `json:"version,omitempty"`        // Which increases whenever it's changed
	HeadRevision string       `json:"headRevisionId,omitempty"` // Of its content, of a file which isn't Google's own
	WebViewLink  string       `json:"webViewLink,omitempty"`
	Owners       []DriveOwner `json:"owners,omitempty"`
	Trashed      bool         `json:"trashed,omitempty"`   // Of a change, as the files listed aren't
	OwnedByMe    bool         `json:"ownedByMe,omitempty"` // Of a change, as the files listed are
}

DriveFile is a file, or a folder, of the fields which are asked for Reference: https://developers.google.com/drive/api/reference/rest/v3/files

func (*DriveFile) NotOlder

func (f *DriveFile) NotOlder(than *DriveFile) bool

NotOlder returns true when a file's version is the same as another's, or after it, or it can't be said, as either has no version

func (*DriveFile) VersionNumber

func (f *DriveFile) VersionNumber() int64

VersionNumber returns a file's version, as a number, or -1 when it has none, or it isn't one

type DriveOwner

type DriveOwner struct {
	EmailAddress string `json:"emailAddress,omitempty"`
}

DriveOwner is who owns a file

type DriveWrite

type DriveWrite struct {
	Name         string    `json:"name,omitempty"`
	Parents      []string  `json:"parents,omitempty"`
	MimeType     string    `json:"mimeType,omitempty"`
	ModifiedTime time.Time `json:"modifiedTime,omitzero"`
}

DriveWrite is the metadata of a file which is uploaded: its name, and folder, of one which is created, its type, and when it was modified

type Event

type Event struct {
	Id                string        `json:"id"`
	ETag              string        `json:"etag,omitempty"`
	Status            string        `json:"status,omitempty"` // confirmed, tentative or cancelled
	HTMLLink          string        `json:"htmlLink,omitempty"`
	Created           time.Time     `json:"created,omitzero"`
	Updated           time.Time     `json:"updated,omitzero"`
	Summary           string        `json:"summary,omitempty"`
	Description       string        `json:"description,omitempty"`
	Location          string        `json:"location,omitempty"`
	Start             EventTime     `json:"start,omitzero"`
	End               EventTime     `json:"end,omitzero"`
	Recurrence        []string      `json:"recurrence,omitempty"` // Of an event which repeats, rather than a time it occurs
	RecurringEventId  string        `json:"recurringEventId,omitempty"`
	OriginalStartTime EventTime     `json:"originalStartTime,omitzero"`
	Transparency      string        `json:"transparency,omitempty"` // opaque, or transparent, which isn't busy
	ICalUID           string        `json:"iCalUID,omitempty"`
	Sequence          int           `json:"sequence,omitempty"`
	Organizer         EventPerson   `json:"organizer,omitzero"`
	Attendees         []EventPerson `json:"attendees,omitempty"`
	EventType         string        `json:"eventType,omitempty"` // default, birthday, outOfOffice, focusTime, workingLocation, fromGmail
}

Event is an event of a calendar, or an occurrence of one which repeats, whose RecurringEventId is the event's Reference: https://developers.google.com/calendar/api/v3/reference/events

type EventFields

type EventFields map[string]any

EventFields are the fields of an event which are written, by their names in the API, such as "summary", or "start"

type EventPerson

type EventPerson struct {
	Email          string `json:"email,omitempty"`
	DisplayName    string `json:"displayName,omitempty"`
	Self           bool   `json:"self,omitempty"`
	ResponseStatus string `json:"responseStatus,omitempty"`
}

EventPerson is the organiser, or an attendee, of an event

type EventTime

type EventTime struct {
	Date     string `json:"date,omitempty"`     // Such as 2026-11-20
	DateTime string `json:"dateTime,omitempty"` // Such as 2026-11-20T09:00:00+01:00
	TimeZone string `json:"timeZone,omitempty"` // Such as Europe/Berlin
}

EventTime is when an event starts or ends: a date, of an all-day event, or a time, with its offset, and its zone, when it's set

type FieldMetadata

type FieldMetadata struct {
	Primary bool `json:"primary,omitempty"`
}

FieldMetadata is whether a field is the person's primary one

type PeopleClient

type PeopleClient struct {
	*authclient.Client
}

PeopleClient is a client of the Google People API, of a person's contacts

func NewPeopleClient

func NewPeopleClient(endpoint string, opts ...client.ClientOpt) (*PeopleClient, error)

NewPeopleClient returns a client of the Google People API, at its endpoint, or PeopleEndpoint, when it's empty, with go-client's options, such as a token, a tracer, or a rate limit

func (*PeopleClient) Check

func (c *PeopleClient) Check(ctx context.Context) error

Check returns nil when the contacts can be read, or an AuthError, when a sign-in is needed

func (*PeopleClient) Connections

func (c *PeopleClient) Connections(ctx context.Context, fields string) ([]Person, error)

Connections returns the contacts, of the fields, such as PersonFields, or "metadata", of their entity tags, a page at a time

func (*PeopleClient) CreateContact

func (c *PeopleClient) CreateContact(ctx context.Context, person Person, fields string) (*Person, error)

CreateContact creates a contact, of the person's fields, and returns it, of the fields, with the resource name Google gives it

func (*PeopleClient) DeleteContact

func (c *PeopleClient) DeleteContact(ctx context.Context, resourceName string) error

DeleteContact deletes a contact, of its resource name

func (*PeopleClient) Person

func (c *PeopleClient) Person(ctx context.Context, resourceName, fields string) (*Person, error)

Person returns a contact, by its resource name, such as people/c123, of the fields

func (*PeopleClient) SyncConnections

func (c *PeopleClient) SyncConnections(ctx context.Context, fields, token string) ([]Person, string, error)

SyncConnections returns the contacts, of the fields, such as PersonFields, a page at a time, and the token of the changes after them, or, of a token, those which changed since, of which those which are deleted have metadata.deleted. Returns ErrSyncTokenGone when Google no longer accepts the token, such as one which is more than seven days old, when every contact is got again. Reference: https://developers.google.com/people/api/rest/v1/people.connections/list

func (*PeopleClient) UpdateContact

func (c *PeopleClient) UpdateContact(ctx context.Context, resourceName string, person Person, updated []string, fields string) (*Person, error)

UpdateContact changes the fields of a contact, of its resource name, which are updated, such as names, of the person, whose entity tag must be the contact's, and returns it, of the fields

type Person

type Person struct {
	ResourceName   string         `json:"resourceName,omitempty"`
	ETag           string         `json:"etag,omitempty"`
	Metadata       PersonMetadata `json:"metadata,omitzero"`
	Names          []PersonName   `json:"names,omitempty"`
	Nicknames      []PersonValue  `json:"nicknames,omitempty"`
	EmailAddresses []PersonValue  `json:"emailAddresses,omitempty"`
	PhoneNumbers   []PersonValue  `json:"phoneNumbers,omitempty"`
	URLs           []PersonValue  `json:"urls,omitempty"`
	Addresses      []PersonAddr   `json:"addresses,omitempty"`
	Organizations  []PersonOrg    `json:"organizations,omitempty"`
	Birthdays      []PersonDate   `json:"birthdays,omitempty"`
	Biographies    []PersonValue  `json:"biographies,omitempty"`
	Photos         []PersonPhoto  `json:"photos,omitempty"`
}

Person is a contact, of the fields which are asked for

type PersonAddr

type PersonAddr struct {
	Metadata        FieldMetadata `json:"metadata,omitzero"`
	FormattedValue  string        `json:"formattedValue,omitempty"`
	Type            string        `json:"type,omitempty"`
	POBox           string        `json:"poBox,omitempty"`
	ExtendedAddress string        `json:"extendedAddress,omitempty"`
	StreetAddress   string        `json:"streetAddress,omitempty"`
	City            string        `json:"city,omitempty"`
	Region          string        `json:"region,omitempty"`
	PostalCode      string        `json:"postalCode,omitempty"`
	Country         string        `json:"country,omitempty"`
}

PersonAddr is a postal address of a person

type PersonDate

type PersonDate struct {
	Metadata FieldMetadata `json:"metadata,omitzero"`
	Date     struct {
		Year  int `json:"year,omitempty"`
		Month int `json:"month,omitempty"`
		Day   int `json:"day,omitempty"`
	} `json:"date,omitzero"`
	Text string `json:"text,omitempty"`
}

PersonDate is a date of a person, such as a birthday, whose year is zero when it isn't known

type PersonMetadata

type PersonMetadata struct {
	Sources []PersonSource `json:"sources,omitempty"`
	Deleted bool           `json:"deleted,omitempty"`
}

PersonMetadata is when a person's sources were updated, such as the contact, and whether it's deleted

type PersonName

type PersonName struct {
	Metadata        FieldMetadata `json:"metadata,omitzero"`
	DisplayName     string        `json:"displayName,omitempty"`
	FamilyName      string        `json:"familyName,omitempty"`
	GivenName       string        `json:"givenName,omitempty"`
	MiddleName      string        `json:"middleName,omitempty"`
	HonorificPrefix string        `json:"honorificPrefix,omitempty"`
	HonorificSuffix string        `json:"honorificSuffix,omitempty"`
}

PersonName is the name of a person

type PersonOrg

type PersonOrg struct {
	Metadata   FieldMetadata `json:"metadata,omitzero"`
	Name       string        `json:"name,omitempty"`
	Department string        `json:"department,omitempty"`
	Title      string        `json:"title,omitempty"`
}

PersonOrg is an organisation of a person, with their title in it

type PersonPhoto

type PersonPhoto struct {
	Metadata FieldMetadata `json:"metadata,omitzero"`
	URL      string        `json:"url,omitempty"`
	Default  bool          `json:"default,omitempty"`
}

PersonPhoto is a photo of a person, which is a link, and whether it's the default, of their initials, rather than one of them

type PersonSource

type PersonSource struct {
	Type       string    `json:"type,omitempty"`
	ID         string    `json:"id,omitempty"`
	ETag       string    `json:"etag,omitempty"`
	UpdateTime time.Time `json:"updateTime,omitzero"`
}

PersonSource is a source of a person, such as a CONTACT, or a PROFILE

type PersonValue

type PersonValue struct {
	Metadata FieldMetadata `json:"metadata,omitzero"`
	Value    string        `json:"value,omitempty"`
	Type     string        `json:"type,omitempty"`
}

PersonValue is a value of a person, such as an email address, a phone number, a URL, a nickname, or a biography, with its type, such as home

type Task

type Task struct {
	Id          string     `json:"id"`
	ETag        string     `json:"etag,omitempty"`
	Title       string     `json:"title,omitempty"`
	Notes       string     `json:"notes,omitempty"`
	Status      string     `json:"status,omitempty"` // needsAction or completed
	Due         *time.Time `json:"due,omitempty"`
	Completed   *time.Time `json:"completed,omitempty"`
	Updated     time.Time  `json:"updated,omitzero"`
	Parent      string     `json:"parent,omitempty"`   // The task this is a subtask of
	Position    string     `json:"position,omitempty"` // Its position among its siblings
	Deleted     bool       `json:"deleted,omitempty"`
	Hidden      bool       `json:"hidden,omitempty"` // Completed, and cleared from the list
	Links       []TaskLink `json:"links,omitempty"`
	WebViewLink string     `json:"webViewLink,omitempty"`
}

Task is a task of a list. Its due date has no time, though it's a time, at midnight, in UTC.

type TaskFields

type TaskFields map[string]any

TaskFields are the fields of a task which are written, by their names in the API, where a nil value clears a field, such as "due"

type TaskLink struct {
	Type        string `json:"type,omitempty"`
	Description string `json:"description,omitempty"`
	Link        string `json:"link,omitempty"`
}

TaskLink is a link of a task, such as to the email it was created from

type TaskList

type TaskList struct {
	Id      string    `json:"id"`
	ETag    string    `json:"etag,omitempty"`
	Title   string    `json:"title,omitempty"`
	Updated time.Time `json:"updated,omitzero"`
}

TaskList is a list of tasks

type TasksClient

type TasksClient struct {
	*authclient.Client
}

TasksClient is a client of the Google Tasks API

func NewTasksClient

func NewTasksClient(endpoint string, opts ...client.ClientOpt) (*TasksClient, error)

NewTasksClient returns a client of the Google Tasks API, at its endpoint, or TasksEndpoint, when it's empty, with go-client's options, such as a token, a tracer, or a rate limit

func (*TasksClient) Check

func (c *TasksClient) Check(ctx context.Context) error

Check returns nil when the task lists can be read, or an AuthError, when a sign-in is needed

func (*TasksClient) DeleteTask

func (c *TasksClient) DeleteTask(ctx context.Context, list, id string) error

DeleteTask deletes a task of a list, by their ids, and its subtasks, which are kept, and say they're deleted

func (*TasksClient) DeleteTaskList

func (c *TasksClient) DeleteTaskList(ctx context.Context, id string) error

DeleteTaskList deletes a task list, and its tasks, by its id

func (*TasksClient) InsertTask

func (c *TasksClient) InsertTask(ctx context.Context, list, parent string, fields TaskFields) (*Task, error)

InsertTask creates a task in a list, beneath the parent, unless it's empty, and returns it, with the id Google gives it

func (*TasksClient) InsertTaskList

func (c *TasksClient) InsertTaskList(ctx context.Context, title string) (*TaskList, error)

InsertTaskList creates a task list, of its title, and returns it, with the id Google gives it

func (*TasksClient) MoveTask

func (c *TasksClient) MoveTask(ctx context.Context, list, id, parent string) (*Task, error)

MoveTask moves a task beneath the parent, or to the top of its list, when it's empty, and returns it

func (*TasksClient) PatchTask

func (c *TasksClient) PatchTask(ctx context.Context, list, id string, fields TaskFields) (*Task, error)

PatchTask changes the fields of a task, and returns it, keeping those which aren't in the fields

func (*TasksClient) PatchTaskList

func (c *TasksClient) PatchTaskList(ctx context.Context, id, title string) (*TaskList, error)

PatchTaskList changes the title of a task list, by its id, and returns it

func (*TasksClient) Task

func (c *TasksClient) Task(ctx context.Context, list, id string) (*Task, error)

Task returns a task of a list, by their ids

func (*TasksClient) TaskList

func (c *TasksClient) TaskList(ctx context.Context, id string) (*TaskList, error)

TaskList returns a task list, by its id

func (*TasksClient) TaskLists

func (c *TasksClient) TaskLists(ctx context.Context) ([]TaskList, error)

TaskLists returns all of the task lists, a page at a time

func (*TasksClient) Tasks

func (c *TasksClient) Tasks(ctx context.Context, list string) ([]Task, error)

Tasks returns all of the tasks of a list, a page at a time, including those which are completed, hidden, assigned, such as from Docs or Chat spaces, or deleted, which say they are, and when they were

type Userinfo

type Userinfo struct {
	Email string `json:"email,omitempty"`
	Name  string `json:"name,omitempty"`
}

Userinfo is the user who signed in: their email address, when the sign-in has EmailScope, and their name, when it has the profile scope

type UserinfoClient

type UserinfoClient struct {
	*authclient.Client
}

UserinfoClient is a client of Google's OpenID Connect userinfo endpoint, of the user who signed in

func NewUserinfoClient

func NewUserinfoClient(endpoint string, opts ...client.ClientOpt) (*UserinfoClient, error)

NewUserinfoClient returns a client of the userinfo endpoint, or UserinfoEndpoint, when it's empty, with go-client's options, such as a token

func (*UserinfoClient) Userinfo

func (c *UserinfoClient) Userinfo(ctx context.Context) (*Userinfo, error)

Userinfo returns the user who signed in, or an AuthError, when the sign-in can't read it

Jump to

Keyboard shortcuts

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