Giter VIP home page Giter VIP logo

pstodoist's Introduction

PSTodoist

About PSTodoist

A powershell module that uses the Todoist V8 BETA api.

This module or author is NOT affiliated with TODOIST.

Download

Latest build

https://github.com/AlexAsplund/PSTodoist/archive/master.zip

v0.0.3

https://github.com/AlexAsplund/PSTodoist/archive/v0.0.3.zip

Install

See install

Help

Refer to the docs

Get API-token from todoist.

On the todoist website, go to: Todoist Settings -> Account -> API token.

Usage

You can either set the todoist token with:

Set-TodoistToken -Token <YourToken>

Or supply it as a parameter on every command

Get-TodoistTask -Token <Yourtoken>

Some examples:

Set-TodoistToken -Token abcdef12345
Get-TodoistTask | Where-Object {$_.Content -eq "Do dishes"} | Update-TodoistTask -Content "Buy dishwasher"

Set-TodoistToken -Token abcdef12345
$Task = Get-TodoistTask | Where-Object {$_.Content -eq "Do dishes"}

# To close task
$Task | Close-TodoistTask

# To reopen Task
$Task | Open-Todoist Task

# To update task with class method
$Task.Content = 'Buy dishwasher'
$Task.Update()

# To close task with class method
$Task.Close()

# To update a class with function
Update-TodoistTask -Id $Task.Id -Content "Buy cheap dishwasher"

# To add comment to task
$Task | New-TodoistComment -Category Task -Content "Researched dishwashers online"

# To add comment with a file to task
$Task | New-TodoistComment -Category Task -Content "PDF of dishwasher" -AddAttachment -AttachmentResourceType "file" -AttachmentFileType "application/pdf" -AttachmentFileUrl "http://contoso.com/files/dishwasher.pdf" -AttachmentFileName "Dishwasher.pdf"

# To remove task
$Task | Remove-TodoistTask

# To create a new label
New-TodoistLabel -Name "At home"

# To create a new project
New-TodoistProject -Name "Repair dishwasher"

About the author

Author: https://github.com/AlexAsplund

Website: https://automativity.com

pstodoist's People

Contributors

alexasplund avatar bastienperez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pstodoist's Issues

Issues with LabelIDs

Code:

New-TodoistTask -Content "Test" -LabelIDs 2161886937 -Priority 3 -ProjectID 2297125583

Response:

New-TodoistTask: Cannot process argument transformation on parameter 'LabelIDs'. Cannot convert value "2161886937" to type "System.Int32[]". Error: "Cannot convert value "2161886937" to type "System.Int32". Error: "Value was either too large or too small for an Int32.""

Obviously the Integer is to big to be an Int32 (Range from −2147483648 to 2147483647), which is why I changed the type to Int64.

After changing the type to Int64:
Response:

Invoke-RestMethod: C:\PowerShell\Modules\PSTodoist\Public\New-TodoistTask.ps1:100:21
Line |
 100 |  … $Response = Invoke-RestMethod -Uri $Uri -Headers $Header -Body ($Body …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | label_ids must be an array of label ids

Write-Verbose: C:\PowerShell\Modules\PSTodoist\Public\New-TodoistTask.ps1:101:23
Line |
 101 |          Write-Verbose $Response
     |                        ~~~~~~~~~
     | Cannot bind argument to parameter 'Message' because it is null.

After defining an array of IDs:
Code:

$array = @(2161886937,2161886938)
New-TodoistTask -Content "Test" -LabelIDs $array -Priority 3 -ProjectID 2297125583

Response:

PS C:\Share\Scripts> New-TodoistTask -Content "Test" -LabelIDs $array -Priority 3 -ProjectID 2297125583
New-TodoistTask: Cannot process argument transformation on parameter 'LabelIDs'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int64".

I also played around with constellations like this:

$array = @('2161886937','2161886938')
$array = @("2161886937","2161886938")
$array = @([long]2161886937,[long]2161886938)

But I always get the same error.

Can you tell me how the array has to be defined, so I can get this to work?

Thank you for your help.

Best Regards, Chris

Outdated Todoist API

Error: Invoke-RestMethod: C:\Users\jimbr\OneDrive\Documents\PowerShell\Modules\PSTodoist\Public\Get-TodoistTask.ps1:37
$Request = Invoke-RestMethod -Headers $Header -Method Get -Uri 'http …
| Please use https://api.todoist.com/rest/v1/ endpoint. 
| See https://developer.todoist.com/rest/v1/ for details.   

No longer works because it is using the deprecated API

I tried to call Get-TodoistProject, and the error that came back was:

Invoke-RestMethod : This endpoint is deprecated.
If you're reading this on a browser, there's a good chance you can change
the v8 part on the URL to v9 and get away with it. ;)
If you're using the API directly, please update your use case to rely
on the new API endpoints, available under /sync/v9/ or /rest/v2/ prefixes.
For more details, please see documentation at
https://developer.todoist.com/guides/#our-apis

It looks like it needs to get migrated to the new API

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.