Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples folder updated, folder-less-lists fetching added #62

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
Loading