{"id":13305651,"url":"https://github.com/jtsalva/tasq","last_synced_at":"2025-03-10T13:32:09.026Z","repository":{"id":57533457,"uuid":"182337773","full_name":"jtsalva/tasq","owner":"jtsalva","description":"Google Tasks Go API Simplified","archived":false,"fork":false,"pushed_at":"2019-05-02T18:03:31.000Z","size":30,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T15:57:53.506Z","etag":null,"topics":["api","api-wrapper","go","golang","google-api","google-tasks","google-tasks-api","tasks"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jtsalva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-19T23:40:04.000Z","updated_at":"2021-02-08T20:01:04.000Z","dependencies_parsed_at":"2022-09-26T18:21:01.755Z","dependency_job_id":null,"html_url":"https://github.com/jtsalva/tasq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtsalva%2Ftasq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtsalva%2Ftasq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtsalva%2Ftasq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtsalva%2Ftasq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtsalva","download_url":"https://codeload.github.com/jtsalva/tasq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242859748,"owners_count":20196990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-wrapper","go","golang","google-api","google-tasks","google-tasks-api","tasks"],"created_at":"2024-07-29T17:53:56.500Z","updated_at":"2025-03-10T13:32:08.743Z","avatar_url":"https://github.com/jtsalva.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tasQ\nBuilt on top of [google.golang.org/api/tasks/v1](https://google.golang.org/api/tasks/v1) adding extra functionality making it easier to get started with the Google Tasks API in Golang.\n\n* [Getting Started](#getting-started)\n* [Listing Tasklists](#listing-tasklists)\n* [Listing Tasks](#listing-tasks)\n* [Filter and Sort Tasks](#filter-and-sort-tasks)\n* [Interacting with Tasks](#interacting-with-tasks)\n\n## Getting Started\n1. Enable Google Tasks API from [API Console](https://console.developers.google.com/)\n2. Create a new OAuth Client ID credential and download it as JSON\n3. Configure your OAuth consent screen\n4. Understand the concepts [developers.google.com/tasks/concepts](https://developers.google.com/tasks/concepts)\n5. Get tasq `go get -u github.com/jtsalva/tasq`\n6. Import tasq `import \"github.com/jtsalva/tasq\"`\n\n```Go\ntasq.Init(\u0026tasq.QConfig{\n  // Either QTasksReadWriteScope or QTasksReadOnlyScope\n  Scope:       tasq.QTasksReadWriteScope,\n  Credentials: \"/path/to/credentials.json\",\n})\n\n// Direct users here to grant access to your\n// application from their Google accounts\nauthURL := tasq.Auth.GetAuthCodeURL()\n\n// Once the user grants access and is\n// redirected to your specified URL, grab\n// the code from the query string\nauthCode := \"4/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXX\"\n\n// The auth code can only be used once\n// to generate a token, the token is\n// reusable, store it somewhere safe\ntoken, err := tasq.Auth.GetToken(authCode)\n\n\n// Create new service using token\nsvc, err := tasq.NewService(token)\n\n// List all Tasklists\ntasklists, err := svc.Tasklists.List().Do()\n\n// List Tasks from Tasklist\ntasks, err := svc.Tasks.List(tasklistId).Do()\n```\n\n## Listing Tasklists\n```Go\n// tasklists is of type QTaskLists\ntasklists, err := svc.Tasklists.List().Do()\n\n// tasklists.Items is of type []*QTaskList\nfor _, tasklist := range tasklists.Items {\n  fmt.Println(tasklist.Id, tasklist.Name)\n}\n```\n\n## Listing Tasks\n```Go\n// tasks is of type QTasks\ntasks, err := svc.Tasks.List().Do()\n\n// tasks.Items is of type []*QTask\nfor _, task := range tasks.Items {\n  fmt.Println(task.Id, task.Title, task.Notes)\n\n  // List sub-tasks of task\n  // task.Children is of type []*QTask\n  for _, child := range task.Children {\n    fmt.Println(\"\\t\", child.Id, child.Title, child.Notes)\n  }\n}\n```\n\n## Filter and Sort Tasks\nFllter by either\n* `QCompletedFilter` - show only completed tasks\n* `QNeedsActionFilter` - show only tasks needing action\n* `QOverdueFilter` - show only tasks needing action where the datetime now is more than the due datetime\n```Go\nfilteredTasks, err := svc.Tasks.List().Filter(tasq.QOverdueFilter).Do()\n```\nAdditionally, you can sort your items either by\n* `QPositionSort` - sort in the way the user positioned the tasks\n* `QLatestFirstSort` - newly updated tasks first\n* `QOldestFirstSort` - oldest updated tasks first\n```Go\nsortedTasks, err := svc.Tasks.List().Sort(tasq.QPositionSort).Do()\n```\nYou can combine filter and sort\n```Go\nfilterdAndSortedTasks, err := svc.Tasks.List().Filter(filter).Sort(sort).Do()\n```\n\n## Interacting with Tasks\nYou can directly manipulate and perform actions on a `QTaskList` and `QTask`.\n```Go\n// tasklist is of type QTaskList\ntasklist, err := svc.Tasklists.Get(tasklistid).Do()\n\n// task is of type QTask\ntask, err := svc.Tasks.Get(tasklistid, taskid).Do()\n```\n\n1. [Deleting](#deleting)\n2. [Inserting](#inserting)\n3. [Updating](#updating)\n4. [Refreshing](#refreshing)\n5. [Move to Parent](#move-to-parent)\n6. [Move to Previous](#move-to-previous)\n7. [Move to Beginning](#move-to-beginning)\n8. [Get Time of Last Update](#get-time-of-last-update)\n\n### Deleting\n```Go\n// Delete a list, including the tasks and subtasks within it\nerr := tasklist.Delete()\n\n// Delete a single task\nerr := task.Delete()\n```\n\n### Inserting\nInsert a task into another list\n```Go\ninsertedTask, err := task.Insert(anotherTasklistid)\n```\n\n### Updating\n```Go\ntasklist.Title = \"change tasklist title\"\nupdatedTasklist, err := tasklist.Update()\n\ntask.Title = \"change task title\"\nupdatedTask, err := task.Update()\n```\n\n### Refreshing\nIf there have been remote changes, update the data currently stored in memory\n```Go\nerr := tasklist.Refresh()\nerr := task.Refresh()\n```\n\n### Move to Parent\nMake task a subtask to the given parent task id\n```Go\nmovedTask, err := task.MoveToParent(parentTaskid)\n```\n\n### Move to Previous\nMove task after given previous task id\n```Go\nmovedTask, err := task.MoveToPrevious(previousTaskid)\n```\n\n### Move to Beginning\nMoves task to beginning of list\n```Go\nmovedTask, err := task.MoveToBeginning()\n```\n\n### Get Time of Last Update\nReturns time of last update as type `time.Time`\n```Go\ntasklistUpdatedTime, err := tasklist.Time()\ntaskUpdatedTime, err := task.Time()\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtsalva%2Ftasq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtsalva%2Ftasq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtsalva%2Ftasq/lists"}