tstor/daemons/kemono/daemon.go

43 lines
702 B
Go
Raw Normal View History

2024-11-24 17:32:26 +00:00
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
}