// Code generated by Fern. DO NOT EDIT.

package llmconnections

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 LLM connections in a project
func (c *Client) List(
    ctx context.Context,
    request *api.LlmConnectionsListRequest,
    opts ...option.RequestOption,
) (*api.PaginatedLlmConnections, error){
    response, err := c.WithRawResponse.List(
        ctx,
        request,
        opts...,
    )
    if err != nil {
        return nil, err
    }
    return response.Body, nil
}

// Create or update an LLM connection. The connection is upserted on provider.
func (c *Client) Upsert(
    ctx context.Context,
    request *api.UpsertLlmConnectionRequest,
    opts ...option.RequestOption,
) (*api.LlmConnection, error){
    response, err := c.WithRawResponse.Upsert(
        ctx,
        request,
        opts...,
    )
    if err != nil {
        return nil, err
    }
    return response.Body, nil
}

