Go client library for Karakeep.
The go-karakeep client is auto-generated using the
oapi-codegen tool, which allows convert Karakeep OpenAPI specification to Go code.
To install go-karakeep, use go get:
go get github.com/Madh93/go-karakeepHere is a basic example of how to use the go-karakeep library:
package main
import (
"context"
"fmt"
"log"
"net/http"
"github.com/Madh93/go-karakeep"
)
func main() {
// Basic configuration
apiUrl := "https://<YOUR_KARAKEEP_HOSTNAME>/api/v1" // Replace this with your API URL
apiKey := "<YOUR_KARAKEEP_API_KEY>" // Replace this with your actual token
// Set up Bearer authentication
auth := func(ctx context.Context, req *http.Request) error {
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
return nil
}
// Create the Karakeep client
client, err := karakeep.NewClient(apiUrl, karakeep.WithRequestEditorFn(auth))
if err != nil {
log.Fatalf("Error creating client: %v", err)
}
log.Printf("Hello world from %s", client.Server)
}For more code examples, check out the examples directory.
For detailed usage and API documentation, refer to the GoDoc.
Additionally, it's recommended to check out the latest Karakeep API documentation for more information.
Contributions are welcome! Please open an issue or submit a pull request for any bug fixes or enhancements.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-branch). - Open a Pull Request.
This project is licensed under the MIT license.