package client import ( "context" "forge.cadoles.com/Cadoles/emissary/internal/datastore" "github.com/pkg/errors" ) func (c *Client) RegisterAgent(ctx context.Context, remoteID string) (*datastore.Agent, error) { payload := struct { RemoteID string `json:"remoteId"` }{ RemoteID: remoteID, } response := withResponse[struct { Agent *datastore.Agent `json:"agent"` }]() if err := c.apiPost(ctx, "/api/v1/register", payload, &response); err != nil { return nil, errors.WithStack(err) } if response.Error != nil { return nil, errors.WithStack(response.Error) } return response.Data.Agent, nil }