38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package resolver
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
// Code generated by github.com/99designs/gqlgen version v0.17.55
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
graph "git.kmsign.ru/royalcat/tstor/src/delivery/graphql"
|
|
"git.kmsign.ru/royalcat/tstor/src/delivery/graphql/model"
|
|
)
|
|
|
|
// Torrents is the resolver for the torrents field.
|
|
func (r *qBitTorrentDaemonQueryResolver) Torrents(ctx context.Context, obj *model.QBitTorrentDaemonQuery) ([]*model.QTorrent, error) {
|
|
info, err := r.QBitTorrentDaemon.ListTorrents(ctx)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("error listing torrents: %w", err)
|
|
}
|
|
|
|
out := make([]*model.QTorrent, len(info))
|
|
for i, v := range info {
|
|
out[i] = &model.QTorrent{
|
|
Name: v.Name,
|
|
Hash: v.Hash,
|
|
}
|
|
}
|
|
|
|
return out, nil
|
|
}
|
|
|
|
// QBitTorrentDaemonQuery returns graph.QBitTorrentDaemonQueryResolver implementation.
|
|
func (r *Resolver) QBitTorrentDaemonQuery() graph.QBitTorrentDaemonQueryResolver {
|
|
return &qBitTorrentDaemonQueryResolver{r}
|
|
}
|
|
|
|
type qBitTorrentDaemonQueryResolver struct{ *Resolver }
|