Skip to content

Madh93/go-karakeep

Repository files navigation

go-karakeep

Go Version Latest tag Go Reference License

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.

Requirements

Installation

To install go-karakeep, use go get:

go get github.com/Madh93/go-karakeep

Usage

Here 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.

Documentation

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.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any bug fixes or enhancements.

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a Pull Request.

License

This project is licensed under the MIT license.

About

🔖 Go client for the Karakeep API

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages