package builder import ( "git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints" "git.dragse.it/anthrove/e621-to-graph/pkg/e621/model" "strconv" ) type PoolBuilder interface { ID(poolID int) PoolBuilder Execute() (model.Pool, error) } func NewGetPoolBuilder(requestContext model.RequestContext) PoolBuilder { return &getPool{requestContext: requestContext} } type getPool struct { requestContext model.RequestContext id int } func (g getPool) ID(poolID int) PoolBuilder { g.id = poolID return g } func (g getPool) Execute() (model.Pool, error) { pool, err := endpoints.GetPool(g.requestContext, strconv.Itoa(g.id)) if err != nil { return model.Pool{}, err } return pool, nil }