// Code generated by Fern. DO NOT EDIT.

package datasets

import (
    core "pentagi/pkg/observability/langfuse/api/core"
    internal "pentagi/pkg/observability/langfuse/api/internal"
    context "context"
    api "pentagi/pkg/observability/langfuse/api"
    option "pentagi/pkg/observability/langfuse/api/option"
)


type Client struct {
    WithRawResponse *RawClient

    options *core.RequestOptions
    baseURL string
    caller *internal.Caller
}

func NewClient(options *core.RequestOptions) *Client {
    return &Client{
        WithRawResponse: NewRawClient(options),
        options: options,
        baseURL: options.BaseURL,
        caller: internal.NewCaller(
            &internal.CallerParams{
                Client: options.HTTPClient,
                MaxAttempts: options.MaxAttempts,
            },
        ),
    }
}

// Get all datasets
func (c *Client) List(
    ctx context.Context,
    request *api.DatasetsListRequest,
    opts ...option.RequestOption,
) (*api.PaginatedDatasets, error){
    response, err := c.WithRawResponse.List(
        ctx,
        request,
        opts...,
    )
    if err != nil {
        return nil, err
    }
    return response.Body, nil
}

// Create a dataset
func (c *Client) Create(
    ctx context.Context,
    request *api.CreateDatasetRequest,
    opts ...option.RequestOption,
) (*api.Dataset, error){
    response, err := c.WithRawResponse.Create(
        ctx,
        request,
        opts...,
    )
    if err != nil {
        return nil, err
    }
    return response.Body, nil
}

// Get a dataset
func (c *Client) Get(
    ctx context.Context,
    request *api.DatasetsGetRequest,
    opts ...option.RequestOption,
) (*api.Dataset, error){
    response, err := c.WithRawResponse.Get(
        ctx,
        request,
        opts...,
    )
    if err != nil {
        return nil, err
    }
    return response.Body, nil
}

// Get a dataset run and its items
func (c *Client) Getrun(
    ctx context.Context,
    request *api.DatasetsGetRunRequest,
    opts ...option.RequestOption,
) (*api.DatasetRunWithItems, error){
    response, err := c.WithRawResponse.Getrun(
        ctx,
        request,
        opts...,
    )
    if err != nil {
        return nil, err
    }
    return response.Body, nil
}

// Delete a dataset run and all its run items. This action is irreversible.
func (c *Client) Deleterun(
    ctx context.Context,
    request *api.DatasetsDeleteRunRequest,
    opts ...option.RequestOption,
) (*api.DeleteDatasetRunResponse, error){
    response, err := c.WithRawResponse.Deleterun(
        ctx,
        request,
        opts...,
    )
    if err != nil {
        return nil, err
    }
    return response.Body, nil
}

// Get dataset runs
func (c *Client) Getruns(
    ctx context.Context,
    request *api.DatasetsGetRunsRequest,
    opts ...option.RequestOption,
) (*api.PaginatedDatasetRuns, error){
    response, err := c.WithRawResponse.Getruns(
        ctx,
        request,
        opts...,
    )
    if err != nil {
        return nil, err
    }
    return response.Body, nil
}

