Initial Marktplaats SDK scaffold

Clone the twdehands SDK into mrktplaats and retarget naming and defaults for app.marktplaats.nl while keeping the same request/response bodies and endpoint behavior.
This commit is contained in:
2026-04-15 23:45:49 +02:00
commit 25410749db
27 changed files with 3481 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package mrktplaats
import (
"errors"
"fmt"
)
// APIError is returned when the API responds with a non-2xx status code.
type APIError struct {
StatusCode int
Body []byte
}
func (e *APIError) Error() string {
return fmt.Sprintf("mrktplaats: API error %d: %s", e.StatusCode, string(e.Body))
}
// IsNotFound reports whether err is an API 404 response.
func IsNotFound(err error) bool {
var apiErr *APIError
return errors.As(err, &apiErr) && apiErr.StatusCode == 404
}
// IsUnauthorized reports whether err is an API 401 response.
func IsUnauthorized(err error) bool {
var apiErr *APIError
return errors.As(err, &apiErr) && apiErr.StatusCode == 401
}