An API that shows different Cat Facts! (Source)
To install the library, use the following command:
go get github.com/go-api-libs/cat-facts/pkg/catfacts
package main
import (
"context"
"github.com/go-api-libs/cat-facts/pkg/catfacts"
)
func main() {
c, err := catfacts.NewClient()
if err != nil {
panic(err)
}
ctx := context.Background()
facts, err := c.GetRandom(ctx, catfacts.GetRandomParams{
Amount: 2,
AnimalType: "cat",
})
if err != nil {
panic(err)
}
// Use facts slice
}
package main
import (
"context"
"github.com/go-api-libs/cat-facts/pkg/catfacts"
)
func main() {
c, err := catfacts.NewClient()
if err != nil {
panic(err)
}
ctx := context.Background()
fact, err := c.GetFactByID(ctx, "591f9890d369931519ce3564")
if err != nil {
panic(err)
}
// Use fact object
}
- Go Reference: The Go reference documentation for the client package.
- Official Documentation: The official API documentation.
- OpenAPI Specification: The OpenAPI 3.1.0 specification.
- Go Report Card: Check the code quality report.
If you have any contributions to make, please submit a pull request or open an issue on the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for details.