This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
e621-sdk-go/internal/e621/scheduler/task.go
SoXX 802764092e refactor_folder_structure_#11 (#14)
As mentioned in Issue #11, the folder structure got an overall as some file names

Co-authored-by: Fenpaws <soxx@fenpa.ws>
Reviewed-on: anthrove/e621-to-graph#14
Reviewed-by: Lennard Brinkhaus <lennard.brinkhaus@noreply.localhost>
Co-authored-by: SoXX <fenpaws@noreply.localhost>
Co-committed-by: SoXX <fenpaws@noreply.localhost>
2023-07-17 10:57:23 +00:00

44 lines
1.0 KiB
Go

package scheduler
import (
"git.dragse.it/anthrove/e621-to-graph/pkg/e621"
"git.dragse.it/anthrove/e621-to-graph/pkg/util/queue"
"net/http"
)
type schedulerTaskImpl[T e621.DataType] struct {
task e621.Task[T]
channel chan e621.DataResponse[T]
username string
apiKey string
}
func (s schedulerTaskImpl[T]) BasicAuth() (string, string) {
return s.username, s.apiKey
}
func NewSchedulerTaskImpl[T e621.DataType](task e621.Task[T], channel chan e621.DataResponse[T], username string, apiKey string) queue.SchedulerTask {
return &schedulerTaskImpl[T]{
task: task,
channel: channel,
username: username,
apiKey: apiKey,
}
}
func (s schedulerTaskImpl[T]) SendError(err error) {
s.channel <- s.task.HandleError(err)
}
func (s schedulerTaskImpl[T]) UriPath() string {
return s.task.UriPath()
}
func (s schedulerTaskImpl[T]) SendStatusCode(statusCode int) {
s.channel <- s.task.HandleStatusCode(statusCode)
}
func (s schedulerTaskImpl[T]) SendResponse(response *http.Response) {
s.channel <- s.task.HandleResponse(response)
}