A Go client library for the Reclame AQUI API.
- ✅ Type-safe: Strongly typed Go structures with full documentation
- ✅ Easy to use: Clean and intuitive API
- ✅ Configurable: Customizable timeout and request options
- ✅ Well-documented: Complete GoDoc documentation
go get github.com/elizandrodantas/reclame-aquipackage main
import (
"context"
"fmt"
"log"
reclameaqui "github.com/elizandrodantas/reclame-aqui"
"github.com/elizandrodantas/reclame-aqui/types"
)
func main() {
// Create client with custom timeout
client := reclameaqui.New(&types.ReclameAquiOptions{
TimeoutSeconds: 30,
})
defer client.Close()
// Search for companies
results, err := client.SearchCompany(context.Background(), "Google Brasil", &types.SearchCompanyOptions{
Page: 0,
Size: 10,
})
if err != nil {
log.Fatal(err)
}
// Display results
for _, company := range *results {
fmt.Printf("%s - %s (Score: %s)\n",
company.Name,
company.StatusDescription,
company.FinalScore)
}
}// Create a new client
client := reclameaqui.New(&types.ReclameAquiOptions{
TimeoutSeconds: 30, // Optional, defaults to 30 seconds
})
defer client.Close() // Always close when doneresults, err := client.SearchCompany(ctx, "company name", &types.SearchCompanyOptions{
Page: 0, // Page number (starts at 0)
Size: 10, // Results per page (max 50)
})company, err := client.DescribeCompany(ctx, "company-slug")complaints, err := client.ListComplaints(ctx, &types.ListComplaintsOptions{
CompanyID: 12345, // Optional: filter by company ID
Status: "ANSWERED", // Optional: ANSWERED, PENDING, EVALUATED, SOLVED
Page: 0, // Page number
Size: 10, // Results per page (max 10)
Category: "", // Optional: category ID
ProblemTypeID: "", // Optional: problem type ID
})complaint, err := client.DescribeComplaint(ctx, "complaint-id")type Company struct {
ID string
Name string
Shortname string
Status string // GREAT, GOOD, NO_INDEX, NOT_RECOMMENDED
StatusDescription string
FinalScore string
SolvedPercentual string
Logo string
City string
State string
Reputation string
URL *string
Verified bool
Count int // Number of complaints
}type Complaint struct {
ID string
Title string
Description string
Solved bool
City string
State string
Status string
Created string
Company CompanyReference
}The library provides sentinel errors for better error handling:
import "errors"
results, err := client.SearchCompany(ctx, "", nil)
if err != nil {
if errors.Is(err, reclameaqui.ErrSearchCompanyNameEmpty) {
// Handle empty name error
}
if errors.Is(err, reclameaqui.ErrFailedRequest) {
// Handle request failure
}
}Available errors:
ErrCreateRequest- HTTP request creation failedErrFailedRequest- HTTP request execution failedErrUnmarshalJSON- JSON parsing failedErrClientError- API returned an errorErrPageInvalid- Invalid page numberErrSearchCompanyNameEmpty- Empty company nameErrDescribeCompanySlugEmpty- Empty company slugErrDescribeComplaintIDInvalid- Invalid complaint ID
client := reclameaqui.New(nil)
defer client.Close() // Release resourcesctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
results, err := client.SearchCompany(ctx, "company", nil)page := 0
for {
results, err := client.SearchCompany(ctx, "company", &types.SearchCompanyOptions{
Page: page,
Size: 50,
})
if err != nil {
break
}
if results.IsEmpty() {
break
}
// Process results
page++
}.
├── client.go # HTTP client implementation
├── constants.go # Package constants
├── error.go # Error definitions
├── reclame-aqui.go # Main client interface
├── company.go # Company search methods
├── company_describe.go # Company details methods
├── complaint.go # Complaint listing methods
├── complaint_describe.go # Complaint details methods
└── domain/ # Data models
├── describe.go # Detailed response models
├── list.go # List response models
├── options.go # Request options
├── search.go # Search response models
├── shared.go # Shared types
└── status.go # Status types
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This is an unofficial client library for the Reclame AQUI API. It is not affiliated with, endorsed by, or in any way associated with Reclame AQUI.