Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.md

paper

A dependency-free client for the Dropbox Paper API.

Installation

Use the paper package via dep.

dep ensure -add github.com/kyleconroy/paper

Status

This client is ready to use, but only a subset of the API methods have been implemented.

Usage

package main

import (
	"log"

	"github.com/kyleconroy/paper"
)

func PaperSync(names string) error {
	client := paper.NewClient(os.Getenv("DROPBOX_API_KEY"))
	ctx := context.Background()

	list, err := client.ListDocs(ctx, &paper.ListPaperDocsArgs{Limit: 100})
	if err != nil {
		panic(err)
	}

	for _, doc := range list.DocIDs {
		folder, err := client.GetDocFolderInfo(ctx, &paper.RefPaperDoc{DocID: doc})
		if err != nil {
			panic(err)
		}
		if len(folder.Folders) > 0 {
			log.Printf("Document %s is inside folder %s", doc, folder.Folders[0].Name)
		}
		download, content, err := client.DownloadDoc(ctx, &paper.PaperDocExport{
			DocID: doc,
			Format: paper.ExportFormatMarkdown,
		})
		if err != nil {
			panic(err)
		}
		log.Println(download.Title)
		log.Println(string(content))
	}
}

About

A dependency-free cilent for the Dropbox Paper API

Resources

License

Languages

You can’t perform that action at this time.