Lennard Brinkhaus
31bd0cf639
Co-authored-by: Fenpaws <soxx@fenpa.ws> Reviewed-on: anthrove/e621-to-graph#13 Reviewed-by: SoXX <fenpaws@noreply.localhost> Co-authored-by: Lennard Brinkhaus <lennard.brinkhaus@noreply.localhost> Co-committed-by: Lennard Brinkhaus <lennard.brinkhaus@noreply.localhost>
31 lines
589 B
Go
31 lines
589 B
Go
package utils
|
|
|
|
import (
|
|
"e621_to_neo4j/e621/models"
|
|
"net/http"
|
|
)
|
|
|
|
type DataResponse[T DataType] struct {
|
|
Data T
|
|
Error error
|
|
}
|
|
|
|
type DataType interface {
|
|
models.E621User | models.PostResponseWrapper
|
|
}
|
|
|
|
type Task[T DataType] interface {
|
|
UriPath() string
|
|
HandleError(error error) DataResponse[T]
|
|
HandleStatusCode(statusCode int) DataResponse[T]
|
|
HandleResponse(responseData *http.Response) DataResponse[T]
|
|
}
|
|
|
|
type SchedulerTask interface {
|
|
UriPath() string
|
|
SendStatusCode(statusCode int)
|
|
SendError(err error)
|
|
SendResponse(response *http.Response)
|
|
BasicAuth() (string, string)
|
|
}
|