workgroups/vendor/github.com/DisgoOrg/restclient/custom_route.go
Marvin Preuss 1d4ae27878
All checks were successful
continuous-integration/drone/push Build is passing
ci: drone yaml with reusable anchors
2021-09-24 17:34:17 +02:00

27 lines
664 B
Go

package restclient
// CustomRoute is APIRoute but custom for you
type CustomRoute struct {
*APIRoute
}
// Compile returns a CompiledAPIRoute
func (r CustomRoute) Compile(queryValues QueryValues, args ...interface{}) (*CompiledAPIRoute, error) {
compiledRoute, err := r.Route.Compile(queryValues, args...)
if err != nil {
return nil, err
}
return &CompiledAPIRoute{
CompiledRoute: compiledRoute,
method: r.method,
}, nil
}
// NewCustomRoute generates a new custom route struct
func NewCustomRoute(method Method, url string, queryParams ...string) *APIRoute {
return &APIRoute{
Route: newRoute("", url, queryParams),
method: method,
}
}