Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0"
".": "0.2.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 64
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/calvinfo-o4h6u5/cerca-a3610b6045d1d701859276e09dff35829bdf50509b762116860d8005831b0297.yml
openapi_spec_hash: 2a240632b5ef4814881e36247ec3c8dc
config_hash: 5d687451efd1d2898e81fa3ddb25f8ed
configured_endpoints: 66
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/calvinfo-o4h6u5/cerca-b1933e28ba1d2a81cae6514fd41ec2ac5289660666174bfa4466d456e1740fb1.yml
openapi_spec_hash: d1e63b49a56f6c27dc3dac475c34d612
config_hash: 411e4c3ec8f57219c56018ea49c09614
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.2.0 (2026-05-06)

Full Changelog: [v0.1.0...v0.2.0](https://github.com/matrices/cerca-go/compare/v0.1.0...v0.2.0)

### Features

* **api:** api update ([d64f019](https://github.com/matrices/cerca-go/commit/d64f019fa5da77a390e42a75244c1fc96f762865))

## 0.1.0 (2026-05-01)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/matrices/cerca-go/compare/v0.0.1...v0.1.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/matrices/cerca-go@v0.1.0'
go get -u 'github.com/matrices/cerca-go@v0.2.0'
```

<!-- x-release-please-end -->
Expand Down
6 changes: 6 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,18 @@ Params Types:

Response Types:

- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ActivityDetail">ActivityDetail</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ActivitySummary">ActivitySummary</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#CompiledContext">CompiledContext</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ContentBlock">ContentBlock</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Message">Message</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#MessagePage">MessagePage</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Status">Status</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#SteerResult">SteerResult</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#SubThreadSummary">SubThreadSummary</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Thread">Thread</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadSummary">ThreadSummary</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadTurnSummary">ThreadTurnSummary</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#TokenUsage">TokenUsage</a>
- <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Turn">Turn</a>

Expand All @@ -212,9 +216,11 @@ Methods:
- <code title="post /agents/{agentId}/threads">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadNewParams">ThreadNewParams</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Thread">Thread</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /agents/{agentId}/threads/{threadId}">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, threadID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadGetParams">ThreadGetParams</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Thread">Thread</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /agents/{agentId}/threads">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadListParams">ThreadListParams</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go/packages/pagination#ThreadsCursorPage">ThreadsCursorPage</a>[<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadSummary">ThreadSummary</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /agents/{agentId}/threads/{threadId}/activity">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.Activity">Activity</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, threadID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadActivityParams">ThreadActivityParams</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ActivityDetail">ActivityDetail</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /agents/{agentId}/threads/{threadId}/cancel">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.Cancel">Cancel</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, threadID <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Thread">Thread</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /agents/{agentId}/threads/{threadId}/close">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.Close">Close</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, threadID <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Thread">Thread</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /agents/{agentId}/threads/{threadId}/compact">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.Compact">Compact</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, threadID <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Thread">Thread</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /agents/{agentId}/threads/{threadId}/messages">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.ListMessages">ListMessages</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, threadID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadListMessagesParams">ThreadListMessagesParams</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go/packages/pagination#ThreadMessagesCursorPage">ThreadMessagesCursorPage</a>[<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Message">Message</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /agents/{agentId}/threads/{threadId}/turns">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.StartTurn">StartTurn</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, threadID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadStartTurnParams">ThreadStartTurnParams</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#Turn">Turn</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /agents/{agentId}/threads/{threadId}/steer">client.Threads.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadService.Steer">Steer</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, agentID <a href="https://pkg.go.dev/builtin#string">string</a>, threadID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#ThreadSteerParams">ThreadSteerParams</a>) (\*<a href="https://pkg.go.dev/github.com/matrices/cerca-go">cercago</a>.<a href="https://pkg.go.dev/github.com/matrices/cerca-go#SteerResult">SteerResult</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.1.0" // x-release-please-version
const PackageVersion = "0.2.0" // x-release-please-version
110 changes: 110 additions & 0 deletions packages/pagination/pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -1219,3 +1219,113 @@ func (r *ThreadsCursorPageAutoPager[T]) Err() error {
func (r *ThreadsCursorPageAutoPager[T]) Index() int {
return r.run
}

type ThreadMessagesCursorPage[T any] struct {
Messages []T `json:"messages"`
Cursor string `json:"cursor" api:"nullable"`
HasMore bool `json:"hasMore"`
JSON threadMessagesCursorPageJSON `json:"-"`
cfg *requestconfig.RequestConfig
res *http.Response
}

// threadMessagesCursorPageJSON contains the JSON metadata for the struct
// [ThreadMessagesCursorPage[T]]
type threadMessagesCursorPageJSON struct {
Messages apijson.Field
Cursor apijson.Field
HasMore apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *ThreadMessagesCursorPage[T]) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r threadMessagesCursorPageJSON) RawJSON() string {
return r.raw
}

// GetNextPage returns the next page as defined by this pagination style. When
// there is no next page, this function will return a 'nil' for the page value, but
// will not return an error
func (r *ThreadMessagesCursorPage[T]) GetNextPage() (res *ThreadMessagesCursorPage[T], err error) {
if len(r.Messages) == 0 {
return nil, nil
}

if !r.JSON.HasMore.IsMissing() && r.HasMore == false {
return nil, nil
}
next := r.Cursor
if len(next) == 0 {
return nil, nil
}
cfg := r.cfg.Clone(r.cfg.Context)
err = cfg.Apply(option.WithQuery("cursor", next))
if err != nil {
return nil, err
}
var raw *http.Response
cfg.ResponseInto = &raw
cfg.ResponseBodyInto = &res
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}

func (r *ThreadMessagesCursorPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
if r == nil {
r = &ThreadMessagesCursorPage[T]{}
}
r.cfg = cfg
r.res = res
}

type ThreadMessagesCursorPageAutoPager[T any] struct {
page *ThreadMessagesCursorPage[T]
cur T
idx int
run int
err error
}

func NewThreadMessagesCursorPageAutoPager[T any](page *ThreadMessagesCursorPage[T], err error) *ThreadMessagesCursorPageAutoPager[T] {
return &ThreadMessagesCursorPageAutoPager[T]{
page: page,
err: err,
}
}

func (r *ThreadMessagesCursorPageAutoPager[T]) Next() bool {
if r.page == nil || len(r.page.Messages) == 0 {
return false
}
if r.idx >= len(r.page.Messages) {
r.idx = 0
r.page, r.err = r.page.GetNextPage()
if r.err != nil || r.page == nil || len(r.page.Messages) == 0 {
return false
}
}
r.cur = r.page.Messages[r.idx]
r.run += 1
r.idx += 1
return true
}

func (r *ThreadMessagesCursorPageAutoPager[T]) Current() T {
return r.cur
}

func (r *ThreadMessagesCursorPageAutoPager[T]) Err() error {
return r.err
}

func (r *ThreadMessagesCursorPageAutoPager[T]) Index() int {
return r.run
}
Loading
Loading