Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/go-api-libs/cat-facts
Go library for the Cat Fact API. An API that shows different Cat Facts!
https://github.com/go-api-libs/cat-facts
api api-client api-library cat-facts cat-facts-api catfacts go golang integration joke joke-api openapi openapi3
Last synced: 10 days ago
JSON representation
Go library for the Cat Fact API. An API that shows different Cat Facts!
- Host: GitHub
- URL: https://github.com/go-api-libs/cat-facts
- Owner: go-api-libs
- License: mit
- Created: 2024-12-22T11:01:06.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-01-14T16:56:29.000Z (12 days ago)
- Last Synced: 2025-01-14T16:59:53.518Z (12 days ago)
- Topics: api, api-client, api-library, cat-facts, cat-facts-api, catfacts, go, golang, integration, joke, joke-api, openapi, openapi3
- Homepage:
- Size: 746 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 😽 Cat Fact API
[![Go Reference](https://pkg.go.dev/badge/github.com/go-api-libs/cat-facts.svg)](https://pkg.go.dev/github.com/go-api-libs/cat-facts/pkg/catfacts)
[![Official Documentation](https://img.shields.io/badge/docs-API-blue)](https://alexwohlbruck.github.io/cat-facts/docs/)
[![OpenAPI](https://img.shields.io/badge/OpenAPI-3.1-blue)](/api/openapi.json)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-api-libs/cat-facts)](https://goreportcard.com/report/github.com/go-api-libs/cat-facts)
![Code Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)
![API Health](https://img.shields.io/badge/API_health-89%25-green)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)An API that shows different Cat Facts! ([Source](https://freepublicapis.com/cat-fact-api))
## Installation
To install the library, use the following command:
```shell
go get github.com/go-api-libs/cat-facts/pkg/catfacts
```## Usage
### Example 1: Get random animal facts
```go
package mainimport (
"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
}```
### Example 2: Get a fact by its ID
```go
package mainimport (
"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
}```
## Additional Information
- [**Go Reference**](https://pkg.go.dev/github.com/go-api-libs/cat-facts/pkg/catfacts): The Go reference documentation for the client package.
- [**Official Documentation**](https://alexwohlbruck.github.io/cat-facts/docs/): The official API documentation.
- [**OpenAPI Specification**](./api/openapi.json): The OpenAPI 3.1.0 specification.
- [**Go Report Card**](https://goreportcard.com/report/github.com/go-api-libs/cat-facts): Check the code quality report.## Contributing
If you have any contributions to make, please submit a pull request or open an issue on the [GitHub repository](https://github.com/go-api-libs/cat-facts).
## License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.