Skip to content

Commit

Permalink
Merge pull request #62 from Arundas666/main
Browse files Browse the repository at this point in the history
examples folder updated, folder-less-lists fetching added
  • Loading branch information
w-haibara authored Oct 2, 2024
2 parents c1d94a3 + 91b8df4 commit 60c057c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions example/folderless-lists/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// The simple command demonstrates the functionality that
// prompts the user for a Clickup list and lists which are not belonging to any folder inside a space.
// that are related to the specified space.
package main

import (
"context"
"fmt"
"os"

"github.com/raksul/go-clickup/clickup"
)

func fetchLists(spaceId string) ([]clickup.List, error) {
api_key := os.Getenv("CLICKUP_API_KEY")
client := clickup.NewClient(nil, api_key)

lists, _, err := client.Lists.GetFolderlessLists(context.Background(), spaceId, false)
return lists, err
}

func main() {
var spaceId string
fmt.Print("Enter clickup spaceId: ")
fmt.Scanf("%s", &spaceId)

lists, err := fetchLists(spaceId)

if err != nil {
fmt.Printf("Error: %v\n", err)
return
}

for _, list := range lists {
fmt.Println(list.Name)
}
}

0 comments on commit 60c057c

Please sign in to comment.