feat: add missing endpoitn implementation
This commit is contained in:
28
client/regulationmarks.go
Normal file
28
client/regulationmarks.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/kratisto/tcgdex-golang/models"
|
||||
)
|
||||
|
||||
// RegulationMarks retrieves all regulation marks.
|
||||
func (s *tcgDexClient) RegulationMarks(ctx context.Context) ([]string, error) {
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, s.baseURL+"/regulation-marks", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return doRequestSlice[string](s.httpClient, request)
|
||||
}
|
||||
|
||||
// GetCardsByRegulationMark retrieves all cards for a given regulation mark.
|
||||
func (s *tcgDexClient) GetCardsByRegulationMark(ctx context.Context, regulationMark string) ([]models.Card, error) {
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, s.baseURL+"/regulation-marks/"+regulationMark, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return doRequestSlice[models.Card](s.httpClient, request)
|
||||
}
|
||||
Reference in New Issue
Block a user