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.3.2"
".": "0.4.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 111
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-cd6a05ae99d2a050577fa0e729e6ae89b4eacd78f61366a77269398368f8a877.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-3655d5ad0ac3e228c1519af70dbf3d0bfa3c47a2d06d4cac92a650da051b49a6.yml
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.4.0 (2025-02-21)

Full Changelog: [v0.3.2...v0.4.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.3.2...v0.4.0)

### Features

* **api:** manual updates ([#48](https://github.com/gitpod-io/gitpod-sdk-go/issues/48)) ([78b2504](https://github.com/gitpod-io/gitpod-sdk-go/commit/78b2504189e98dcfaef1427444378752ccede6cc))
* **api:** manual updates ([#50](https://github.com/gitpod-io/gitpod-sdk-go/issues/50)) ([19015d3](https://github.com/gitpod-io/gitpod-sdk-go/commit/19015d3d486ef7569342f1f08bcadebc9e5f89e3))

## 0.3.2 (2025-02-18)

Full Changelog: [v0.3.1...v0.3.2](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.3.1...v0.3.2)
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/gitpod-io/gitpod-sdk-go@v0.3.2'
go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.4.0'
```

<!-- x-release-please-end -->
Expand Down
605 changes: 39 additions & 566 deletions environment.go

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) {
Devcontainer: gitpod.F(gitpod.EnvironmentSpecDevcontainerParam{
DevcontainerFilePath: gitpod.F("devcontainerFilePath"),
Dotfiles: gitpod.F(gitpod.EnvironmentSpecDevcontainerDotfilesParam{
Repository: gitpod.F("https://example.com"),
InstallCommand: gitpod.F("installCommand"),
TargetPath: gitpod.F("targetPath"),
Repository: gitpod.F("https://example.com"),
}),
Session: gitpod.F("session"),
}),
Expand Down Expand Up @@ -300,9 +298,7 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
Devcontainer: gitpod.F(gitpod.EnvironmentSpecDevcontainerParam{
DevcontainerFilePath: gitpod.F("devcontainerFilePath"),
Dotfiles: gitpod.F(gitpod.EnvironmentSpecDevcontainerDotfilesParam{
Repository: gitpod.F("https://example.com"),
InstallCommand: gitpod.F("installCommand"),
TargetPath: gitpod.F("targetPath"),
Repository: gitpod.F("https://example.com"),
}),
Session: gitpod.F("session"),
}),
Expand Down
178 changes: 2 additions & 176 deletions environmentautomationservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,94 +355,7 @@ func (r serviceJSON) RawJSON() string {
}

type ServiceMetadata struct {
// A Timestamp represents a point in time independent of any time zone or local
// calendar, encoded as a count of seconds and fractions of seconds at nanosecond
// resolution. The count is relative to an epoch at UTC midnight on January 1,
// 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar
// backwards to year one.
//
// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
// second table is needed for interpretation, using a
// [24-hour linear smear](https://developers.google.com/time/smear).
//
// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
// restricting to that range, we ensure that we can convert to and from
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
//
// # Examples
//
// Example 1: Compute Timestamp from POSIX `time()`.
//
// Timestamp timestamp;
// timestamp.set_seconds(time(NULL));
// timestamp.set_nanos(0);
//
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
//
// struct timeval tv;
// gettimeofday(&tv, NULL);
//
// Timestamp timestamp;
// timestamp.set_seconds(tv.tv_sec);
// timestamp.set_nanos(tv.tv_usec * 1000);
//
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
//
// FILETIME ft;
// GetSystemTimeAsFileTime(&ft);
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
//
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
// Timestamp timestamp;
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
//
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
//
// long millis = System.currentTimeMillis();
//
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
// .setNanos((int) ((millis % 1000) * 1000000)).build();
//
// Example 5: Compute Timestamp from Java `Instant.now()`.
//
// Instant now = Instant.now();
//
// Timestamp timestamp =
// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
// .setNanos(now.getNano()).build();
//
// Example 6: Compute Timestamp from current time in Python.
//
// timestamp = Timestamp()
// timestamp.GetCurrentTime()
//
// # JSON Mapping
//
// In JSON format, the Timestamp type is encoded as a string in the
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is
// "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always
// expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are
// zero-padded to two digits each. The fractional seconds, which can go up to 9
// digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix
// indicates the timezone ("UTC"); the timezone is required. A proto3 JSON
// serializer should always use UTC (as indicated by "Z") when printing the
// Timestamp type and a proto3 JSON parser should be able to accept both UTC and
// other timezones (as indicated by an offset).
//
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on
// January 15, 2017.
//
// In JavaScript, one can convert a Date object to this format using the standard
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
// method. In Python, a standard `datetime.datetime` object can be converted to
// this format using
// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the
// time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the
// Joda Time's
// [`ISODateTimeFormat.dateTime()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>)
// to obtain a formatter capable of generating timestamps in this format.
// created_at is the time the service was created.
CreatedAt time.Time `json:"createdAt" format:"date-time"`
// creator describes the principal who created the service.
Creator shared.Subject `json:"creator"`
Expand Down Expand Up @@ -483,94 +396,7 @@ func (r serviceMetadataJSON) RawJSON() string {
}

type ServiceMetadataParam struct {
// A Timestamp represents a point in time independent of any time zone or local
// calendar, encoded as a count of seconds and fractions of seconds at nanosecond
// resolution. The count is relative to an epoch at UTC midnight on January 1,
// 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar
// backwards to year one.
//
// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
// second table is needed for interpretation, using a
// [24-hour linear smear](https://developers.google.com/time/smear).
//
// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
// restricting to that range, we ensure that we can convert to and from
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
//
// # Examples
//
// Example 1: Compute Timestamp from POSIX `time()`.
//
// Timestamp timestamp;
// timestamp.set_seconds(time(NULL));
// timestamp.set_nanos(0);
//
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
//
// struct timeval tv;
// gettimeofday(&tv, NULL);
//
// Timestamp timestamp;
// timestamp.set_seconds(tv.tv_sec);
// timestamp.set_nanos(tv.tv_usec * 1000);
//
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
//
// FILETIME ft;
// GetSystemTimeAsFileTime(&ft);
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
//
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
// Timestamp timestamp;
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
//
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
//
// long millis = System.currentTimeMillis();
//
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
// .setNanos((int) ((millis % 1000) * 1000000)).build();
//
// Example 5: Compute Timestamp from Java `Instant.now()`.
//
// Instant now = Instant.now();
//
// Timestamp timestamp =
// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
// .setNanos(now.getNano()).build();
//
// Example 6: Compute Timestamp from current time in Python.
//
// timestamp = Timestamp()
// timestamp.GetCurrentTime()
//
// # JSON Mapping
//
// In JSON format, the Timestamp type is encoded as a string in the
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is
// "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always
// expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are
// zero-padded to two digits each. The fractional seconds, which can go up to 9
// digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix
// indicates the timezone ("UTC"); the timezone is required. A proto3 JSON
// serializer should always use UTC (as indicated by "Z") when printing the
// Timestamp type and a proto3 JSON parser should be able to accept both UTC and
// other timezones (as indicated by an offset).
//
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on
// January 15, 2017.
//
// In JavaScript, one can convert a Date object to this format using the standard
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
// method. In Python, a standard `datetime.datetime` object can be converted to
// this format using
// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the
// time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the
// Joda Time's
// [`ISODateTimeFormat.dateTime()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>)
// to obtain a formatter capable of generating timestamps in this format.
// created_at is the time the service was created.
CreatedAt param.Field[time.Time] `json:"createdAt" format:"date-time"`
// creator describes the principal who created the service.
Creator param.Field[shared.SubjectParam] `json:"creator"`
Expand Down
74 changes: 69 additions & 5 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,32 @@ func NewEventService(opts ...option.RequestOption) (r *EventService) {
return
}

// ListAuditLogs retrieves a paginated list of audit logs for the specified
// organization
// Lists audit logs with filtering and pagination options.
//
// Use this method to:
//
// - View audit history
// - Track user actions
// - Monitor system changes
//
// ### Examples
//
// - List all logs:
//
// ```yaml
// pagination:
// pageSize: 20
// ```
//
// - Filter by actor:
//
// ```yaml
// filter:
// actorIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"]
// actorPrincipals: ["PRINCIPAL_USER"]
// pagination:
// pageSize: 20
// ```
func (r *EventService) List(ctx context.Context, params EventListParams, opts ...option.RequestOption) (res *pagination.EntriesPage[EventListResponse], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
Expand All @@ -56,13 +80,53 @@ func (r *EventService) List(ctx context.Context, params EventListParams, opts ..
return res, nil
}

// ListAuditLogs retrieves a paginated list of audit logs for the specified
// organization
// Lists audit logs with filtering and pagination options.
//
// Use this method to:
//
// - View audit history
// - Track user actions
// - Monitor system changes
//
// ### Examples
//
// - List all logs:
//
// ```yaml
// pagination:
// pageSize: 20
// ```
//
// - Filter by actor:
//
// ```yaml
// filter:
// actorIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"]
// actorPrincipals: ["PRINCIPAL_USER"]
// pagination:
// pageSize: 20
// ```
func (r *EventService) ListAutoPaging(ctx context.Context, params EventListParams, opts ...option.RequestOption) *pagination.EntriesPageAutoPager[EventListResponse] {
return pagination.NewEntriesPageAutoPager(r.List(ctx, params, opts...))
}

// WatchEvents streams all requests events to the client
// Streams events for all projects, runners, environments, tasks, and services
// based on the specified scope.
//
// Use this method to:
//
// - Monitor resource changes in real-time
// - Track system events
// - Receive notifications
//
// The scope parameter determines which events to watch:
//
// - Organization scope (default): Watch all organization-wide events including
// projects, runners and environments. Task and service events are not included.
// Use by setting organization=true or omitting the scope.
// - Environment scope: Watch events for a specific environment, including its
// tasks, task executions, and services. Use by setting environment_id to the
// UUID of the environment to watch.
func (r *EventService) WatchStreaming(ctx context.Context, body EventWatchParams, opts ...option.RequestOption) (stream *jsonl.Stream[EventWatchResponse]) {
var (
raw *http.Response
Expand Down
4 changes: 2 additions & 2 deletions event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ func TestEventListWithOptionalParams(t *testing.T) {
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.EventListParamsFilter{
ActorIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
ActorIDs: gitpod.F([]string{"d2c94c27-3b76-4a42-b88c-95a85e392c68"}),
ActorPrincipals: gitpod.F([]shared.Principal{shared.PrincipalUnspecified}),
SubjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
SubjectTypes: gitpod.F([]gitpod.ResourceType{gitpod.ResourceTypeUnspecified}),
}),
Pagination: gitpod.F(gitpod.EventListParamsPagination{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(100)),
PageSize: gitpod.F(int64(20)),
}),
})
if err != nil {
Expand Down
Loading