28 lines
498 B
Go
28 lines
498 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"forge.cadoles.com/arcad/arcast/pkg/server"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type Status = server.StatusResponse
|
|
|
|
func (c *Client) Cast(ctx context.Context, addr string, url string) (*Status, error) {
|
|
endpoint := fmt.Sprintf("http://%s/api/v1/cast", addr)
|
|
|
|
req := &server.CastRequest{
|
|
URL: url,
|
|
}
|
|
|
|
res := &server.StatusResponse{}
|
|
|
|
if err := c.apiPost(ctx, endpoint, &req, &res); err != nil {
|
|
return nil, errors.WithStack(err)
|
|
}
|
|
|
|
return res, nil
|
|
}
|