tstor/daemons/kemono/daemon.go
royalcat 585f317478
Some checks failed
docker / build-docker (push) Failing after 34s
daemons separation
2024-11-24 20:32:26 +03:00

42 lines
702 B
Go

package kemono
import (
"context"
"fmt"
"git.kmsign.ru/royalcat/tstor/daemons/kemono/client"
)
type Daemon struct {
client client.ClientWithResponsesInterface
}
type creator struct {
Service string
CreatorID string
}
func NewDaemon(server string) (*Daemon, error) {
cl, err := client.NewClientWithResponses(server)
if err != nil {
return nil, err
}
return &Daemon{
client: cl,
}, nil
}
func (d *Daemon) scrapCreator(ctx context.Context, creator creator) error {
resp, err := d.client.GetServiceUserCreatorIdWithResponse(ctx, creator.Service, creator.CreatorID, nil)
if err != nil {
return err
}
for _, post := range *resp.JSON200 {
fmt.Println(post)
}
return nil
}