-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from Arundas666/main
examples folder updated, folder-less-lists fetching added
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |