serval

package module
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

README

Serval Go API Library

Go Reference

The Serval Go library provides convenient access to the Serval REST API from applications written in Go.

Installation

import (
	"github.com/ServalHQ/serval-go" // imported as serval
)

Or to pin the version:

go get -u 'github.com/ServalHQ/serval-go@v0.23.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/ServalHQ/serval-go"
	"github.com/ServalHQ/serval-go/option"
)

func main() {
	client := serval.NewClient(
		option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("SERVAL_BEARER_TOKEN")
	)
	accessPolicy, err := client.AccessPolicies.New(context.TODO(), serval.AccessPolicyNewParams{
		Name:   "Example Access Policy",
		TeamID: "teamId",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", accessPolicy.ID)
}

Request fields

The serval library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, serval.String(string), serval.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := serval.ExampleParams{
	ID:   "id_xxx",             // required property
	Name: serval.String("..."), // optional property

	Point: serval.Point{
		X: 0,             // required field will serialize as 0
		Y: serval.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: serval.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[serval.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := serval.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.AccessPolicies.List(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.AccessPolicies.ListAutoPaging(context.TODO(), serval.AccessPolicyListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	accessPolicy := iter.Current()
	fmt.Printf("%+v\n", accessPolicy)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.AccessPolicies.List(context.TODO(), serval.AccessPolicyListParams{})
for page != nil {
	for _, accessPolicy := range page.Data {
		fmt.Printf("%+v\n", accessPolicy)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *serval.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.AccessPolicies.Get(context.TODO(), "nonexistent-id")
if err != nil {
	var apierr *serval.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v2/access-policies/{id}": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.AccessPolicies.List(
	ctx,
	serval.AccessPolicyListParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper serval.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := serval.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.AccessPolicies.List(
	context.TODO(),
	serval.AccessPolicyListParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
page, err := client.AccessPolicies.List(
	context.TODO(),
	serval.AccessPolicyListParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", page)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: serval.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := serval.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (SERVAL_CLIENT_ID, SERVAL_CLIENT_SECRET, SERVAL_BEARER_TOKEN, SERVAL_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AccessPolicy

type AccessPolicy struct {
	// The ID of the access policy.
	ID string `json:"id"`
	// A description of the access policy.
	Description string `json:"description" api:"nullable"`
	// The maximum number of minutes that access can be granted for.
	MaxAccessMinutes int64 `json:"maxAccessMinutes" api:"nullable"`
	// The name of the access policy.
	Name string `json:"name"`
	// The recommended duration in minutes for access requests (optional).
	RecommendedAccessMinutes int64 `json:"recommendedAccessMinutes" api:"nullable"`
	// Whether a business justification is required when requesting access.
	RequireBusinessJustification bool `json:"requireBusinessJustification" api:"nullable"`
	// The ID of the team that the access policy belongs to.
	TeamID string `json:"teamId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                           respjson.Field
		Description                  respjson.Field
		MaxAccessMinutes             respjson.Field
		Name                         respjson.Field
		RecommendedAccessMinutes     respjson.Field
		RequireBusinessJustification respjson.Field
		TeamID                       respjson.Field
		ExtraFields                  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicy) RawJSON

func (r AccessPolicy) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccessPolicy) UnmarshalJSON

func (r *AccessPolicy) UnmarshalJSON(data []byte) error

type AccessPolicyApprovalProcedure

type AccessPolicyApprovalProcedure struct {
	// The ID of the access policy approval procedure.
	ID string `json:"id"`
	// The ID of the access policy this approval procedure belongs to.
	AccessPolicyID string `json:"accessPolicyId"`
	// The steps in the approval procedure.
	Steps []AccessPolicyApprovalProcedureStep `json:"steps"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		AccessPolicyID respjson.Field
		Steps          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyApprovalProcedure) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedure) UnmarshalJSON

func (r *AccessPolicyApprovalProcedure) UnmarshalJSON(data []byte) error

type AccessPolicyApprovalProcedureDeleteParams

type AccessPolicyApprovalProcedureDeleteParams struct {
	// The ID of the access policy.
	AccessPolicyID string `path:"access_policy_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type AccessPolicyApprovalProcedureDeleteResponse

type AccessPolicyApprovalProcedureDeleteResponse = any

type AccessPolicyApprovalProcedureGetParams

type AccessPolicyApprovalProcedureGetParams struct {
	// The ID of the access policy.
	AccessPolicyID string `path:"access_policy_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type AccessPolicyApprovalProcedureGetResponseEnvelope

type AccessPolicyApprovalProcedureGetResponseEnvelope struct {
	// The approval procedure.
	Data AccessPolicyApprovalProcedure `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyApprovalProcedureGetResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureGetResponseEnvelope) UnmarshalJSON

type AccessPolicyApprovalProcedureListByTeamParams added in v0.17.0

type AccessPolicyApprovalProcedureListByTeamParams struct {
	// The ID of the team.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// Maximum number of results to return. Default is 1000, maximum is 1000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AccessPolicyApprovalProcedureListByTeamParams) URLQuery added in v0.17.0

URLQuery serializes AccessPolicyApprovalProcedureListByTeamParams's query parameters as `url.Values`.

type AccessPolicyApprovalProcedureListByTeamResponse added in v0.17.0

type AccessPolicyApprovalProcedureListByTeamResponse struct {
	// The list of access policy approval procedures for the team.
	Data []AccessPolicyApprovalProcedure `json:"data"`
	// Token for retrieving the next page of results. Empty if no more results.
	NextPageToken string `json:"nextPageToken,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data          respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyApprovalProcedureListByTeamResponse) RawJSON added in v0.17.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureListByTeamResponse) UnmarshalJSON added in v0.17.0

type AccessPolicyApprovalProcedureListResponseEnvelope

type AccessPolicyApprovalProcedureListResponseEnvelope struct {
	// The list of approval procedures (typically 0 or 1).
	Data []AccessPolicyApprovalProcedure `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyApprovalProcedureListResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureListResponseEnvelope) UnmarshalJSON

type AccessPolicyApprovalProcedureNewParams

type AccessPolicyApprovalProcedureNewParams struct {
	// The approval steps for the procedure.
	Steps []AccessPolicyApprovalProcedureNewParamsStep `json:"steps,omitzero"`
	// contains filtered or unexported fields
}

func (AccessPolicyApprovalProcedureNewParams) MarshalJSON

func (r AccessPolicyApprovalProcedureNewParams) MarshalJSON() (data []byte, err error)

func (*AccessPolicyApprovalProcedureNewParams) UnmarshalJSON

func (r *AccessPolicyApprovalProcedureNewParams) UnmarshalJSON(data []byte) error

type AccessPolicyApprovalProcedureNewParamsStep

type AccessPolicyApprovalProcedureNewParamsStep struct {
	// Whether the step can be approved by the requester themselves. optional so server
	// can distinguish "not set" from "explicitly false" (DB defaults to TRUE; proto3
	// defaults bool to false)
	AllowSelfApproval param.Opt[bool] `json:"allowSelfApproval,omitzero"`
	// Configuration for a custom workflow that determines approvers or auto-approves.
	CustomWorkflow AccessPolicyApprovalProcedureNewParamsStepCustomWorkflow `json:"customWorkflow,omitzero"`
	// Exactly one of approvers or custom_workflow must be set. Mutual exclusivity
	// validated server-side.
	Approvers []AccessPolicyApprovalProcedureNewParamsStepApproverUnion `json:"approvers,omitzero"`
	// contains filtered or unexported fields
}

func (AccessPolicyApprovalProcedureNewParamsStep) MarshalJSON

func (r AccessPolicyApprovalProcedureNewParamsStep) MarshalJSON() (data []byte, err error)

func (*AccessPolicyApprovalProcedureNewParamsStep) UnmarshalJSON

func (r *AccessPolicyApprovalProcedureNewParamsStep) UnmarshalJSON(data []byte) error

type AccessPolicyApprovalProcedureNewParamsStepApproverAppOwner added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverAppOwner struct {
	// App owners as approvers. Only valid for access policy approval procedures.
	AppOwner any `json:"appOwner,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

App owners as approvers. Only valid for access policy approval procedures.

The property AppOwner is required.

func (AccessPolicyApprovalProcedureNewParamsStepApproverAppOwner) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureNewParamsStepApproverAppOwner) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverGroup added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverGroup struct {
	// A Serval group as approvers.
	Group AccessPolicyApprovalProcedureNewParamsStepApproverGroupGroup `json:"group,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

A Serval group as approvers.

The property Group is required.

func (AccessPolicyApprovalProcedureNewParamsStepApproverGroup) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureNewParamsStepApproverGroup) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverGroupGroup added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverGroupGroup struct {
	// The ID of the Serval group.
	GroupID param.Opt[string] `json:"groupId,omitzero"`
	// contains filtered or unexported fields
}

A Serval group as approvers.

func (AccessPolicyApprovalProcedureNewParamsStepApproverGroupGroup) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureNewParamsStepApproverGroupGroup) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverManager added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverManager struct {
	// The requester's manager as an approver.
	Manager any `json:"manager,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

The requester's manager as an approver.

The property Manager is required.

func (AccessPolicyApprovalProcedureNewParamsStepApproverManager) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureNewParamsStepApproverManager) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverUnion added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverUnion struct {
	OfAppOwner *AccessPolicyApprovalProcedureNewParamsStepApproverAppOwner `json:",omitzero,inline"`
	OfGroup    *AccessPolicyApprovalProcedureNewParamsStepApproverGroup    `json:",omitzero,inline"`
	OfManager  *AccessPolicyApprovalProcedureNewParamsStepApproverManager  `json:",omitzero,inline"`
	OfUser     *AccessPolicyApprovalProcedureNewParamsStepApproverUser     `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (AccessPolicyApprovalProcedureNewParamsStepApproverUnion) GetAppOwner added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureNewParamsStepApproverUnion) GetGroup added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureNewParamsStepApproverUnion) GetManager added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureNewParamsStepApproverUnion) GetNotify added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureNewParamsStepApproverUnion) GetUser added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureNewParamsStepApproverUnion) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureNewParamsStepApproverUnion) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverUser added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverUser struct {
	// A specific user as an approver.
	User AccessPolicyApprovalProcedureNewParamsStepApproverUserUser `json:"user,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

A specific user as an approver.

The property User is required.

func (AccessPolicyApprovalProcedureNewParamsStepApproverUser) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureNewParamsStepApproverUser) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverUserUser added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepApproverUserUser struct {
	// The ID of the user.
	UserID param.Opt[string] `json:"userId,omitzero"`
	// contains filtered or unexported fields
}

A specific user as an approver.

func (AccessPolicyApprovalProcedureNewParamsStepApproverUserUser) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureNewParamsStepApproverUserUser) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepCustomWorkflow added in v0.20.0

type AccessPolicyApprovalProcedureNewParamsStepCustomWorkflow struct {
	// The ID of the workflow to execute.
	WorkflowID param.Opt[string] `json:"workflowId,omitzero"`
	// contains filtered or unexported fields
}

Configuration for a custom workflow that determines approvers or auto-approves.

func (AccessPolicyApprovalProcedureNewParamsStepCustomWorkflow) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureNewParamsStepCustomWorkflow) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureNewResponseEnvelope

type AccessPolicyApprovalProcedureNewResponseEnvelope struct {
	// The created approval procedure.
	Data AccessPolicyApprovalProcedure `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyApprovalProcedureNewResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureNewResponseEnvelope) UnmarshalJSON

type AccessPolicyApprovalProcedureService

type AccessPolicyApprovalProcedureService struct {
	Options []option.RequestOption
}

AccessPolicyApprovalProcedureService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccessPolicyApprovalProcedureService method instead.

func NewAccessPolicyApprovalProcedureService

func NewAccessPolicyApprovalProcedureService(opts ...option.RequestOption) (r AccessPolicyApprovalProcedureService)

NewAccessPolicyApprovalProcedureService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccessPolicyApprovalProcedureService) Delete

Delete an approval procedure for an access policy.

func (*AccessPolicyApprovalProcedureService) Get

Get a specific approval procedure by ID for an access policy.

func (*AccessPolicyApprovalProcedureService) List

List all approval procedures for an access policy.

func (*AccessPolicyApprovalProcedureService) ListByTeam added in v0.17.0

List all access policy approval procedures for a team.

func (*AccessPolicyApprovalProcedureService) New

Create a new approval procedure for an access policy.

func (*AccessPolicyApprovalProcedureService) Update

Update an existing approval procedure for an access policy.

type AccessPolicyApprovalProcedureStep

type AccessPolicyApprovalProcedureStep struct {
	// The ID of the approval step.
	ID string `json:"id"`
	// Whether the step can be approved by the requester themselves. optional so server
	// can distinguish "not set" from "explicitly false" (DB defaults to TRUE; proto3
	// defaults bool to false)
	AllowSelfApproval bool `json:"allowSelfApproval" api:"nullable"`
	// Exactly one of approvers or custom_workflow must be set. Mutual exclusivity
	// validated server-side.
	Approvers []AccessPolicyApprovalProcedureStepApproverUnion `json:"approvers"`
	// Configuration for a custom workflow that determines approvers or auto-approves.
	CustomWorkflow AccessPolicyApprovalProcedureStepCustomWorkflow `json:"customWorkflow" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		AllowSelfApproval respjson.Field
		Approvers         respjson.Field
		CustomWorkflow    respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyApprovalProcedureStep) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStep) UnmarshalJSON

func (r *AccessPolicyApprovalProcedureStep) UnmarshalJSON(data []byte) error

type AccessPolicyApprovalProcedureStepApproverAppOwner added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverAppOwner struct {
	// App owners as approvers. Only valid for access policy approval procedures.
	AppOwner any `json:"appOwner" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify bool `json:"notify"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AppOwner    respjson.Field
		Notify      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

App owners as approvers. Only valid for access policy approval procedures.

func (AccessPolicyApprovalProcedureStepApproverAppOwner) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStepApproverAppOwner) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverGroup added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverGroup struct {
	// A Serval group as approvers.
	Group AccessPolicyApprovalProcedureStepApproverGroupGroup `json:"group" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify bool `json:"notify"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Group       respjson.Field
		Notify      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Serval group as approvers.

func (AccessPolicyApprovalProcedureStepApproverGroup) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStepApproverGroup) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverGroupGroup added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverGroupGroup struct {
	// The ID of the Serval group.
	GroupID string `json:"groupId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GroupID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Serval group as approvers.

func (AccessPolicyApprovalProcedureStepApproverGroupGroup) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStepApproverGroupGroup) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverManager added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverManager struct {
	// The requester's manager as an approver.
	Manager any `json:"manager" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify bool `json:"notify"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Manager     respjson.Field
		Notify      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The requester's manager as an approver.

func (AccessPolicyApprovalProcedureStepApproverManager) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStepApproverManager) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverUnion added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverUnion struct {
	// This field is from variant [AccessPolicyApprovalProcedureStepApproverAppOwner].
	AppOwner any  `json:"appOwner"`
	Notify   bool `json:"notify"`
	// This field is from variant [AccessPolicyApprovalProcedureStepApproverGroup].
	Group AccessPolicyApprovalProcedureStepApproverGroupGroup `json:"group"`
	// This field is from variant [AccessPolicyApprovalProcedureStepApproverManager].
	Manager any `json:"manager"`
	// This field is from variant [AccessPolicyApprovalProcedureStepApproverUser].
	User AccessPolicyApprovalProcedureStepApproverUserUser `json:"user"`
	JSON struct {
		AppOwner respjson.Field
		Notify   respjson.Field
		Group    respjson.Field
		Manager  respjson.Field
		User     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AccessPolicyApprovalProcedureStepApproverUnion contains all possible properties and values from AccessPolicyApprovalProcedureStepApproverAppOwner, AccessPolicyApprovalProcedureStepApproverGroup, AccessPolicyApprovalProcedureStepApproverManager, AccessPolicyApprovalProcedureStepApproverUser.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (AccessPolicyApprovalProcedureStepApproverUnion) AsAppOwner added in v0.20.0

func (AccessPolicyApprovalProcedureStepApproverUnion) AsGroup added in v0.20.0

func (AccessPolicyApprovalProcedureStepApproverUnion) AsManager added in v0.20.0

func (AccessPolicyApprovalProcedureStepApproverUnion) AsUser added in v0.20.0

func (AccessPolicyApprovalProcedureStepApproverUnion) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStepApproverUnion) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverUser added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverUser struct {
	// A specific user as an approver.
	User AccessPolicyApprovalProcedureStepApproverUserUser `json:"user" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify bool `json:"notify"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		User        respjson.Field
		Notify      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A specific user as an approver.

func (AccessPolicyApprovalProcedureStepApproverUser) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStepApproverUser) UnmarshalJSON added in v0.20.0

func (r *AccessPolicyApprovalProcedureStepApproverUser) UnmarshalJSON(data []byte) error

type AccessPolicyApprovalProcedureStepApproverUserUser added in v0.20.0

type AccessPolicyApprovalProcedureStepApproverUserUser struct {
	// The ID of the user.
	UserID string `json:"userId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		UserID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A specific user as an approver.

func (AccessPolicyApprovalProcedureStepApproverUserUser) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStepApproverUserUser) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureStepCustomWorkflow added in v0.20.0

type AccessPolicyApprovalProcedureStepCustomWorkflow struct {
	// The ID of the workflow to execute.
	WorkflowID string `json:"workflowId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		WorkflowID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a custom workflow that determines approvers or auto-approves.

func (AccessPolicyApprovalProcedureStepCustomWorkflow) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureStepCustomWorkflow) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParams

type AccessPolicyApprovalProcedureUpdateParams struct {
	// The ID of the access policy.
	AccessPolicyID string `path:"access_policy_id" api:"required" json:"-"`
	// The approval steps for the procedure.
	Steps []AccessPolicyApprovalProcedureUpdateParamsStep `json:"steps,omitzero"`
	// contains filtered or unexported fields
}

func (AccessPolicyApprovalProcedureUpdateParams) MarshalJSON

func (r AccessPolicyApprovalProcedureUpdateParams) MarshalJSON() (data []byte, err error)

func (*AccessPolicyApprovalProcedureUpdateParams) UnmarshalJSON

func (r *AccessPolicyApprovalProcedureUpdateParams) UnmarshalJSON(data []byte) error

type AccessPolicyApprovalProcedureUpdateParamsStep

type AccessPolicyApprovalProcedureUpdateParamsStep struct {
	// Whether the step can be approved by the requester themselves. optional so server
	// can distinguish "not set" from "explicitly false" (DB defaults to TRUE; proto3
	// defaults bool to false)
	AllowSelfApproval param.Opt[bool] `json:"allowSelfApproval,omitzero"`
	// Configuration for a custom workflow that determines approvers or auto-approves.
	CustomWorkflow AccessPolicyApprovalProcedureUpdateParamsStepCustomWorkflow `json:"customWorkflow,omitzero"`
	// Exactly one of approvers or custom_workflow must be set. Mutual exclusivity
	// validated server-side.
	Approvers []AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion `json:"approvers,omitzero"`
	// contains filtered or unexported fields
}

func (AccessPolicyApprovalProcedureUpdateParamsStep) MarshalJSON

func (r AccessPolicyApprovalProcedureUpdateParamsStep) MarshalJSON() (data []byte, err error)

func (*AccessPolicyApprovalProcedureUpdateParamsStep) UnmarshalJSON

func (r *AccessPolicyApprovalProcedureUpdateParamsStep) UnmarshalJSON(data []byte) error

type AccessPolicyApprovalProcedureUpdateParamsStepApproverAppOwner added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverAppOwner struct {
	// App owners as approvers. Only valid for access policy approval procedures.
	AppOwner any `json:"appOwner,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

App owners as approvers. Only valid for access policy approval procedures.

The property AppOwner is required.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverAppOwner) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureUpdateParamsStepApproverAppOwner) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverGroup added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverGroup struct {
	// A Serval group as approvers.
	Group AccessPolicyApprovalProcedureUpdateParamsStepApproverGroupGroup `json:"group,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

A Serval group as approvers.

The property Group is required.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverGroup) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureUpdateParamsStepApproverGroup) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverGroupGroup added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverGroupGroup struct {
	// The ID of the Serval group.
	GroupID param.Opt[string] `json:"groupId,omitzero"`
	// contains filtered or unexported fields
}

A Serval group as approvers.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverGroupGroup) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureUpdateParamsStepApproverGroupGroup) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverManager added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverManager struct {
	// The requester's manager as an approver.
	Manager any `json:"manager,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

The requester's manager as an approver.

The property Manager is required.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverManager) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureUpdateParamsStepApproverManager) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion struct {
	OfAppOwner *AccessPolicyApprovalProcedureUpdateParamsStepApproverAppOwner `json:",omitzero,inline"`
	OfGroup    *AccessPolicyApprovalProcedureUpdateParamsStepApproverGroup    `json:",omitzero,inline"`
	OfManager  *AccessPolicyApprovalProcedureUpdateParamsStepApproverManager  `json:",omitzero,inline"`
	OfUser     *AccessPolicyApprovalProcedureUpdateParamsStepApproverUser     `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion) GetAppOwner added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion) GetGroup added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion) GetManager added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion) GetNotify added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion) GetUser added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureUpdateParamsStepApproverUnion) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverUser added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverUser struct {
	// A specific user as an approver.
	User AccessPolicyApprovalProcedureUpdateParamsStepApproverUserUser `json:"user,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

A specific user as an approver.

The property User is required.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverUser) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureUpdateParamsStepApproverUser) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverUserUser added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepApproverUserUser struct {
	// The ID of the user.
	UserID param.Opt[string] `json:"userId,omitzero"`
	// contains filtered or unexported fields
}

A specific user as an approver.

func (AccessPolicyApprovalProcedureUpdateParamsStepApproverUserUser) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureUpdateParamsStepApproverUserUser) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepCustomWorkflow added in v0.20.0

type AccessPolicyApprovalProcedureUpdateParamsStepCustomWorkflow struct {
	// The ID of the workflow to execute.
	WorkflowID param.Opt[string] `json:"workflowId,omitzero"`
	// contains filtered or unexported fields
}

Configuration for a custom workflow that determines approvers or auto-approves.

func (AccessPolicyApprovalProcedureUpdateParamsStepCustomWorkflow) MarshalJSON added in v0.20.0

func (*AccessPolicyApprovalProcedureUpdateParamsStepCustomWorkflow) UnmarshalJSON added in v0.20.0

type AccessPolicyApprovalProcedureUpdateResponseEnvelope

type AccessPolicyApprovalProcedureUpdateResponseEnvelope struct {
	// The updated approval procedure.
	Data AccessPolicyApprovalProcedure `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyApprovalProcedureUpdateResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyApprovalProcedureUpdateResponseEnvelope) UnmarshalJSON

type AccessPolicyDeleteResponse

type AccessPolicyDeleteResponse = any

type AccessPolicyGetResponseEnvelope

type AccessPolicyGetResponseEnvelope struct {
	// The access policy.
	Data AccessPolicy `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyGetResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyGetResponseEnvelope) UnmarshalJSON

func (r *AccessPolicyGetResponseEnvelope) UnmarshalJSON(data []byte) error

type AccessPolicyListParams

type AccessPolicyListParams struct {
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// The ID of the team.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AccessPolicyListParams) URLQuery

func (r AccessPolicyListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AccessPolicyListParams's query parameters as `url.Values`.

type AccessPolicyNewParams

type AccessPolicyNewParams struct {
	// The name of the access policy.
	Name string `json:"name" api:"required"`
	// The ID of the team.
	TeamID string `json:"teamId" api:"required"`
	// The maximum number of minutes that access can be granted for (optional).
	MaxAccessMinutes param.Opt[int64] `json:"maxAccessMinutes,omitzero"`
	// The recommended duration in minutes for access requests (optional).
	RecommendedAccessMinutes param.Opt[int64] `json:"recommendedAccessMinutes,omitzero"`
	// Whether a business justification is required when requesting access (optional).
	RequireBusinessJustification param.Opt[bool] `json:"requireBusinessJustification,omitzero"`
	// A description of the access policy.
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (AccessPolicyNewParams) MarshalJSON

func (r AccessPolicyNewParams) MarshalJSON() (data []byte, err error)

func (*AccessPolicyNewParams) UnmarshalJSON

func (r *AccessPolicyNewParams) UnmarshalJSON(data []byte) error

type AccessPolicyNewResponseEnvelope

type AccessPolicyNewResponseEnvelope struct {
	// The created access policy.
	Data AccessPolicy `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyNewResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyNewResponseEnvelope) UnmarshalJSON

func (r *AccessPolicyNewResponseEnvelope) UnmarshalJSON(data []byte) error

type AccessPolicyService

type AccessPolicyService struct {
	Options            []option.RequestOption
	ApprovalProcedures AccessPolicyApprovalProcedureService
}

AccessPolicyService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccessPolicyService method instead.

func NewAccessPolicyService

func NewAccessPolicyService(opts ...option.RequestOption) (r AccessPolicyService)

NewAccessPolicyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccessPolicyService) Delete

Delete an access policy.

func (*AccessPolicyService) Get

func (r *AccessPolicyService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *AccessPolicy, err error)

Get a specific access policy by ID.

func (*AccessPolicyService) List

List all access policies for a team.

func (*AccessPolicyService) ListAutoPaging added in v0.19.0

List all access policies for a team.

func (*AccessPolicyService) New

Create a new access policy for a team.

func (*AccessPolicyService) Update

Update an existing access policy.

type AccessPolicyUpdateParams

type AccessPolicyUpdateParams struct {
	// The recommended duration in minutes for access requests (optional).
	RecommendedAccessMinutes param.Opt[int64] `json:"recommendedAccessMinutes,omitzero"`
	// A description of the access policy.
	Description param.Opt[string] `json:"description,omitzero"`
	// The maximum number of minutes that access can be granted for.
	MaxAccessMinutes param.Opt[int64] `json:"maxAccessMinutes,omitzero"`
	// The name of the access policy.
	Name param.Opt[string] `json:"name,omitzero"`
	// Whether a business justification is required when requesting access.
	RequireBusinessJustification param.Opt[bool] `json:"requireBusinessJustification,omitzero"`
	// contains filtered or unexported fields
}

func (AccessPolicyUpdateParams) MarshalJSON

func (r AccessPolicyUpdateParams) MarshalJSON() (data []byte, err error)

func (*AccessPolicyUpdateParams) UnmarshalJSON

func (r *AccessPolicyUpdateParams) UnmarshalJSON(data []byte) error

type AccessPolicyUpdateResponseEnvelope

type AccessPolicyUpdateResponseEnvelope struct {
	// The updated access policy.
	Data AccessPolicy `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessPolicyUpdateResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AccessPolicyUpdateResponseEnvelope) UnmarshalJSON

func (r *AccessPolicyUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type AccessRequest added in v0.17.0

type AccessRequest struct {
	// The unique ID of the access request.
	ID string `json:"id"`
	// The timestamp when the access request was created.
	CreatedAt string `json:"createdAt"`
	// The timestamp when the currently active time allocation expires. This is only
	// set when the access request has been provisioned and is not yet concluded. If
	// the request has been extended, this reflects the expiry of the latest (current)
	// time allocation, not the original one.
	ExpiresAt string `json:"expiresAt" api:"nullable"`
	// The ID of the ticket that originated this access request. This always matches
	// the linked_ticket_id of the first time allocation. Extensions may be created
	// from a different ticket — see each time allocation's linked_ticket_id for that.
	LinkedTicketID string `json:"linkedTicketId" api:"nullable"`
	// The ID of the requested role.
	RequestedRoleID string `json:"requestedRoleId"`
	// The status of the access request.
	//
	// Any of "ACCESS_REQUEST_STATUS_UNSPECIFIED", "ACCESS_REQUEST_STATUS_PENDING",
	// "ACCESS_REQUEST_STATUS_APPROVED", "ACCESS_REQUEST_STATUS_DENIED",
	// "ACCESS_REQUEST_STATUS_EXPIRED", "ACCESS_REQUEST_STATUS_REVOKED",
	// "ACCESS_REQUEST_STATUS_CANCELED", "ACCESS_REQUEST_STATUS_FAILED".
	Status AccessRequestStatus `json:"status"`
	// The ID of the target user for whom access was requested.
	TargetUserID string `json:"targetUserId"`
	// The ID of the team that the access request belongs to.
	TeamID string `json:"teamId"`
	// Every access request contains one or more time allocations. A time allocation
	// represents a discrete grant (or pending grant) of access for a specific
	// duration. The first time allocation is created with the initial request. When a
	// user extends an existing access request, a new time allocation is appended — the
	// previous one is invalidated (superseded) and the new one becomes the active or
	// pending allocation. At most one time allocation is active and at most one is
	// pending at any given time.
	//
	// Ordered by creation time ascending.
	TimeAllocations []AccessRequestTimeAllocation `json:"timeAllocations"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		CreatedAt       respjson.Field
		ExpiresAt       respjson.Field
		LinkedTicketID  respjson.Field
		RequestedRoleID respjson.Field
		Status          respjson.Field
		TargetUserID    respjson.Field
		TeamID          respjson.Field
		TimeAllocations respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AccessRequest represents a request for access to an entitlement.

func (AccessRequest) RawJSON added in v0.17.0

func (r AccessRequest) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccessRequest) UnmarshalJSON added in v0.17.0

func (r *AccessRequest) UnmarshalJSON(data []byte) error

type AccessRequestGetResponseEnvelope added in v0.17.0

type AccessRequestGetResponseEnvelope struct {
	// The access request.
	Data AccessRequest `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessRequestGetResponseEnvelope) RawJSON added in v0.17.0

Returns the unmodified JSON received from the API

func (*AccessRequestGetResponseEnvelope) UnmarshalJSON added in v0.17.0

func (r *AccessRequestGetResponseEnvelope) UnmarshalJSON(data []byte) error

type AccessRequestListParams added in v0.17.0

type AccessRequestListParams struct {
	// Maximum number of results to return. Default is 1000, maximum is 5000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// The ID of the team. Required.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AccessRequestListParams) URLQuery added in v0.17.0

func (r AccessRequestListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AccessRequestListParams's query parameters as `url.Values`.

type AccessRequestSearchParams added in v0.17.0

type AccessRequestSearchParams struct {
	// Filter by app instance ID.
	AppInstanceID param.Opt[string] `json:"appInstanceId,omitzero"`
	// Filter by requests created after this timestamp (RFC3339 format).
	CreatedAfter param.Opt[string] `json:"createdAfter,omitzero"`
	// Filter by requests created before this timestamp (RFC3339 format).
	CreatedBefore param.Opt[string] `json:"createdBefore,omitzero"`
	// Filter by linked ticket ID.
	LinkedTicketID param.Opt[string] `json:"linkedTicketId,omitzero"`
	// Maximum number of results to return. Default is 1000, maximum is 5000.
	PageSize param.Opt[int64] `json:"pageSize,omitzero"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `json:"pageToken,omitzero"`
	// Filter by the user who requested access.
	RequestedByUserID param.Opt[string] `json:"requestedByUserId,omitzero"`
	// Filter by requested role ID.
	RequestedRoleID param.Opt[string] `json:"requestedRoleId,omitzero"`
	// Filter by the target user for whom access was requested.
	TargetUserID param.Opt[string] `json:"targetUserId,omitzero"`
	// The ID of the team. Required.
	TeamID param.Opt[string] `json:"teamId,omitzero"`
	// Filter by statuses (multiple allowed).
	//
	// Any of "ACCESS_REQUEST_STATUS_UNSPECIFIED", "ACCESS_REQUEST_STATUS_PENDING",
	// "ACCESS_REQUEST_STATUS_APPROVED", "ACCESS_REQUEST_STATUS_DENIED",
	// "ACCESS_REQUEST_STATUS_EXPIRED", "ACCESS_REQUEST_STATUS_REVOKED",
	// "ACCESS_REQUEST_STATUS_CANCELED", "ACCESS_REQUEST_STATUS_FAILED".
	Statuses []string `json:"statuses,omitzero"`
	// contains filtered or unexported fields
}

func (AccessRequestSearchParams) MarshalJSON added in v0.17.0

func (r AccessRequestSearchParams) MarshalJSON() (data []byte, err error)

func (*AccessRequestSearchParams) UnmarshalJSON added in v0.17.0

func (r *AccessRequestSearchParams) UnmarshalJSON(data []byte) error

type AccessRequestSearchResponse added in v0.17.0

type AccessRequestSearchResponse struct {
	// The list of access requests.
	Data []AccessRequest `json:"data"`
	// Token for retrieving the next page of results. Empty if no more results.
	NextPageToken string `json:"nextPageToken" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data          respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessRequestSearchResponse) RawJSON added in v0.17.0

func (r AccessRequestSearchResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccessRequestSearchResponse) UnmarshalJSON added in v0.17.0

func (r *AccessRequestSearchResponse) UnmarshalJSON(data []byte) error

type AccessRequestService added in v0.17.0

type AccessRequestService struct {
	Options []option.RequestOption
}

AccessRequestService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccessRequestService method instead.

func NewAccessRequestService added in v0.17.0

func NewAccessRequestService(opts ...option.RequestOption) (r AccessRequestService)

NewAccessRequestService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccessRequestService) Get added in v0.17.0

func (r *AccessRequestService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *AccessRequest, err error)

Get a specific access request by ID.

func (*AccessRequestService) List added in v0.17.0

List access requests for a team. Filter by user, entitlement, app instance, status, or time range.

func (*AccessRequestService) ListAutoPaging added in v0.19.0

List access requests for a team. Filter by user, entitlement, app instance, status, or time range.

func (*AccessRequestService) Search added in v0.17.0

Search access requests with filters. Supports filtering by entitlement, app instance, status, user IDs, time range, and linked ticket.

type AccessRequestStatus added in v0.17.0

type AccessRequestStatus string

The status of the access request.

const (
	AccessRequestStatusAccessRequestStatusUnspecified AccessRequestStatus = "ACCESS_REQUEST_STATUS_UNSPECIFIED"
	AccessRequestStatusAccessRequestStatusPending     AccessRequestStatus = "ACCESS_REQUEST_STATUS_PENDING"
	AccessRequestStatusAccessRequestStatusApproved    AccessRequestStatus = "ACCESS_REQUEST_STATUS_APPROVED"
	AccessRequestStatusAccessRequestStatusDenied      AccessRequestStatus = "ACCESS_REQUEST_STATUS_DENIED"
	AccessRequestStatusAccessRequestStatusExpired     AccessRequestStatus = "ACCESS_REQUEST_STATUS_EXPIRED"
	AccessRequestStatusAccessRequestStatusRevoked     AccessRequestStatus = "ACCESS_REQUEST_STATUS_REVOKED"
	AccessRequestStatusAccessRequestStatusCanceled    AccessRequestStatus = "ACCESS_REQUEST_STATUS_CANCELED"
	AccessRequestStatusAccessRequestStatusFailed      AccessRequestStatus = "ACCESS_REQUEST_STATUS_FAILED"
)

type AccessRequestTimeAllocation added in v0.22.0

type AccessRequestTimeAllocation struct {
	// The unique ID of the time allocation.
	ID string `json:"id"`
	// The ID of the approval request for this time allocation, if any. Each time
	// allocation may have its own approval round (e.g., initial request vs. extension
	// each go through separate approval).
	ApprovalRequestID string `json:"approvalRequestId" api:"nullable"`
	// The number of minutes actually approved. Null while the time allocation is
	// pending.
	ApprovedMinutes int64 `json:"approvedMinutes" api:"nullable"`
	// The business justification provided for this time allocation.
	BusinessJustification string `json:"businessJustification" api:"nullable"`
	// The timestamp when the time allocation was created.
	CreatedAt string `json:"createdAt"`
	// Why the time allocation was invalidated. Only set when status is INVALIDATED.
	//
	// Any of "ACCESS_REQUEST_TIME_ALLOCATION_INVALIDATION_REASON_UNSPECIFIED",
	// "ACCESS_REQUEST_TIME_ALLOCATION_INVALIDATION_REASON_SUPERSEDED",
	// "ACCESS_REQUEST_TIME_ALLOCATION_INVALIDATION_REASON_CANCELED",
	// "ACCESS_REQUEST_TIME_ALLOCATION_INVALIDATION_REASON_REJECTED",
	// "ACCESS_REQUEST_TIME_ALLOCATION_INVALIDATION_REASON_CONCLUDED".
	InvalidationReason string `json:"invalidationReason" api:"nullable"`
	// The ID of the ticket this time allocation was created from, if any. For the
	// initial allocation this is the ticket that originated the access request. For
	// extensions this may be a different ticket.
	LinkedTicketID string `json:"linkedTicketId" api:"nullable"`
	// The ID of the user who requested this time allocation (may differ from the
	// original requester for extensions).
	RequestedByUserID string `json:"requestedByUserId"`
	// The number of minutes of access requested in this time allocation.
	RequestedMinutes int64 `json:"requestedMinutes"`
	// The status of this time allocation.
	//
	// Any of "ACCESS_REQUEST_TIME_ALLOCATION_STATUS_UNSPECIFIED",
	// "ACCESS_REQUEST_TIME_ALLOCATION_STATUS_PENDING",
	// "ACCESS_REQUEST_TIME_ALLOCATION_STATUS_ACTIVE",
	// "ACCESS_REQUEST_TIME_ALLOCATION_STATUS_INVALIDATED".
	Status string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		ApprovalRequestID     respjson.Field
		ApprovedMinutes       respjson.Field
		BusinessJustification respjson.Field
		CreatedAt             respjson.Field
		InvalidationReason    respjson.Field
		LinkedTicketID        respjson.Field
		RequestedByUserID     respjson.Field
		RequestedMinutes      respjson.Field
		Status                respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A time allocation represents a single grant (or pending grant) of access time within an access request. When an access request is first created, one time allocation is created alongside it with the initially requested duration. If the user later extends the request, the current time allocation is invalidated (reason = SUPERSEDED) and a brand-new time allocation is created with the updated duration. This means an access request accumulates a history of time allocations over its lifetime, but at most one is active and at most one is pending at any given moment.

func (AccessRequestTimeAllocation) RawJSON added in v0.22.0

func (r AccessRequestTimeAllocation) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccessRequestTimeAllocation) UnmarshalJSON added in v0.22.0

func (r *AccessRequestTimeAllocation) UnmarshalJSON(data []byte) error

type AppInstance

type AppInstance struct {
	// The ID of the app instance.
	ID string `json:"id"`
	// Whether access requests are enabled for the app instance.
	AccessRequestsEnabled bool `json:"accessRequestsEnabled"`
	// **Option: custom_service_id** — The ID of the custom service (for custom apps).
	CustomServiceID string `json:"customServiceId"`
	// The default access policy for the app instance.
	DefaultAccessPolicyID string `json:"defaultAccessPolicyId" api:"nullable"`
	// The external service instance ID (e.g., GitHub org name, Okta domain, AWS
	// account ID).
	ExternalServiceInstanceID string `json:"externalServiceInstanceId"`
	// The name of the app instance.
	Name string `json:"name"`
	// **Option: service** — The service identifier (for built-in services like
	// "github", "okta", "aws").
	Service string `json:"service"`
	// The ID of the Serval team that the app instance belongs to.
	TeamID string `json:"teamId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		AccessRequestsEnabled     respjson.Field
		CustomServiceID           respjson.Field
		DefaultAccessPolicyID     respjson.Field
		ExternalServiceInstanceID respjson.Field
		Name                      respjson.Field
		Service                   respjson.Field
		TeamID                    respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration object.

**Set exactly ONE of:** customServiceId, service

func (AppInstance) RawJSON

func (r AppInstance) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppInstance) UnmarshalJSON

func (r *AppInstance) UnmarshalJSON(data []byte) error

type AppInstanceDeleteResponse

type AppInstanceDeleteResponse = any

type AppInstanceGetResponseEnvelope

type AppInstanceGetResponseEnvelope struct {
	// The app instance.
	Data AppInstance `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppInstanceGetResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AppInstanceGetResponseEnvelope) UnmarshalJSON

func (r *AppInstanceGetResponseEnvelope) UnmarshalJSON(data []byte) error

type AppInstanceListParams

type AppInstanceListParams struct {
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// The ID of the team.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AppInstanceListParams) URLQuery

func (r AppInstanceListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AppInstanceListParams's query parameters as `url.Values`.

type AppInstanceNewParams

type AppInstanceNewParams struct {
	// The external service instance ID (e.g., GitHub org name, Okta domain, AWS
	// account ID).
	ExternalServiceInstanceID string `json:"externalServiceInstanceId" api:"required"`
	// The name of the app instance.
	Name string `json:"name" api:"required"`
	// The ID of the team.
	TeamID string `json:"teamId" api:"required"`
	// The default access policy for the app instance (optional).
	DefaultAccessPolicyID param.Opt[string] `json:"defaultAccessPolicyId,omitzero"`
	// Whether access requests are enabled for the app instance.
	AccessRequestsEnabled param.Opt[bool] `json:"accessRequestsEnabled,omitzero"`
	// **Option: custom_service_id** — The ID of a custom service to create the app
	// instance for.
	CustomServiceID param.Opt[string] `json:"customServiceId,omitzero"`
	// **Option: service** — The service identifier (for built-in services like
	// "github", "okta", "aws").
	Service param.Opt[string] `json:"service,omitzero"`
	// contains filtered or unexported fields
}

func (AppInstanceNewParams) MarshalJSON

func (r AppInstanceNewParams) MarshalJSON() (data []byte, err error)

func (*AppInstanceNewParams) UnmarshalJSON

func (r *AppInstanceNewParams) UnmarshalJSON(data []byte) error

type AppInstanceNewResponseEnvelope

type AppInstanceNewResponseEnvelope struct {
	// The created app instance.
	Data AppInstance `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppInstanceNewResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AppInstanceNewResponseEnvelope) UnmarshalJSON

func (r *AppInstanceNewResponseEnvelope) UnmarshalJSON(data []byte) error

type AppInstanceService

type AppInstanceService struct {
	Options []option.RequestOption
}

AppInstanceService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAppInstanceService method instead.

func NewAppInstanceService

func NewAppInstanceService(opts ...option.RequestOption) (r AppInstanceService)

NewAppInstanceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AppInstanceService) Delete

Delete an app instance.

func (*AppInstanceService) Get

func (r *AppInstanceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *AppInstance, err error)

Get a specific app instance by ID.

func (*AppInstanceService) List

List all app instances for a team.

func (*AppInstanceService) ListAutoPaging added in v0.19.0

List all app instances for a team.

func (*AppInstanceService) New

Create a new app instance for a team.

func (*AppInstanceService) Update

Update an existing app instance.

type AppInstanceUpdateParams

type AppInstanceUpdateParams struct {
	// The default access policy for the app instance (optional).
	DefaultAccessPolicyID param.Opt[string] `json:"defaultAccessPolicyId,omitzero"`
	// Whether access requests are enabled for the app instance.
	AccessRequestsEnabled param.Opt[bool] `json:"accessRequestsEnabled,omitzero"`
	// The external service instance ID (e.g., GitHub org name, Okta domain, AWS
	// account ID).
	ExternalServiceInstanceID param.Opt[string] `json:"externalServiceInstanceId,omitzero"`
	// The name of the app instance.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (AppInstanceUpdateParams) MarshalJSON

func (r AppInstanceUpdateParams) MarshalJSON() (data []byte, err error)

func (*AppInstanceUpdateParams) UnmarshalJSON

func (r *AppInstanceUpdateParams) UnmarshalJSON(data []byte) error

type AppInstanceUpdateResponseEnvelope

type AppInstanceUpdateResponseEnvelope struct {
	// The updated app instance.
	Data AppInstance `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppInstanceUpdateResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AppInstanceUpdateResponseEnvelope) UnmarshalJSON

func (r *AppInstanceUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type AppResource

type AppResource struct {
	// The ID of the resource.
	ID string `json:"id"`
	// The ID of the app instance that the resource belongs to.
	AppInstanceID string `json:"appInstanceId"`
	// A description of the resource.
	Description string `json:"description" api:"nullable"`
	// The external ID of the resource.
	ExternalID string `json:"externalId" api:"nullable"`
	// The name of the resource.
	Name string `json:"name"`
	// The type of the resource.
	ResourceType string `json:"resourceType"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		AppInstanceID respjson.Field
		Description   respjson.Field
		ExternalID    respjson.Field
		Name          respjson.Field
		ResourceType  respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResource) RawJSON

func (r AppResource) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppResource) UnmarshalJSON

func (r *AppResource) UnmarshalJSON(data []byte) error

type AppResourceDeleteResponse

type AppResourceDeleteResponse = any

type AppResourceGetResponseEnvelope

type AppResourceGetResponseEnvelope struct {
	// The resource.
	Data AppResource `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceGetResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AppResourceGetResponseEnvelope) UnmarshalJSON

func (r *AppResourceGetResponseEnvelope) UnmarshalJSON(data []byte) error

type AppResourceListParams

type AppResourceListParams struct {
	// Filter by app instance ID. At least one of team_id or app_instance_id must be
	// provided.
	AppInstanceID param.Opt[string] `query:"appInstanceId,omitzero" json:"-"`
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// Filter by team ID. At least one of team_id or app_instance_id must be provided.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AppResourceListParams) URLQuery

func (r AppResourceListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AppResourceListParams's query parameters as `url.Values`.

type AppResourceNewParams

type AppResourceNewParams struct {
	// The ID of the app instance.
	AppInstanceID string `json:"appInstanceId" api:"required"`
	// The name of the resource.
	Name string `json:"name" api:"required"`
	// The type of the resource.
	ResourceType string `json:"resourceType" api:"required"`
	// The external ID of the resource (optional).
	ExternalID param.Opt[string] `json:"externalId,omitzero"`
	// A description of the resource.
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (AppResourceNewParams) MarshalJSON

func (r AppResourceNewParams) MarshalJSON() (data []byte, err error)

func (*AppResourceNewParams) UnmarshalJSON

func (r *AppResourceNewParams) UnmarshalJSON(data []byte) error

type AppResourceNewResponseEnvelope

type AppResourceNewResponseEnvelope struct {
	// The created resource.
	Data AppResource `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceNewResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AppResourceNewResponseEnvelope) UnmarshalJSON

func (r *AppResourceNewResponseEnvelope) UnmarshalJSON(data []byte) error

type AppResourceRole added in v0.7.0

type AppResourceRole struct {
	// The ID of the role.
	ID string `json:"id"`
	// The default access policy for the role.
	AccessPolicyID string `json:"accessPolicyId" api:"nullable"`
	// A description of the role.
	Description string `json:"description"`
	// Data from the external system as a JSON string (computed by server).
	ExternalData string `json:"externalData" api:"nullable"`
	// The external ID of the role in the external system (optional).
	ExternalID string `json:"externalId" api:"nullable"`
	// The name of the role.
	Name string `json:"name"`
	// Provisioning configuration. **Exactly one method should be set.**
	ProvisioningMethod AppResourceRoleProvisioningMethodUnion `json:"provisioningMethod"`
	// Whether requests are enabled for the role.
	RequestsEnabled bool `json:"requestsEnabled"`
	// The ID of the resource that the role belongs to.
	ResourceID string `json:"resourceId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                 respjson.Field
		AccessPolicyID     respjson.Field
		Description        respjson.Field
		ExternalData       respjson.Field
		ExternalID         respjson.Field
		Name               respjson.Field
		ProvisioningMethod respjson.Field
		RequestsEnabled    respjson.Field
		ResourceID         respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Role represents a requestable role on an app resource.

func (AppResourceRole) RawJSON added in v0.7.0

func (r AppResourceRole) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppResourceRole) UnmarshalJSON added in v0.7.0

func (r *AppResourceRole) UnmarshalJSON(data []byte) error

type AppResourceRoleDeleteResponse added in v0.7.0

type AppResourceRoleDeleteResponse = any

type AppResourceRoleGetResponseEnvelope added in v0.7.0

type AppResourceRoleGetResponseEnvelope struct {
	// The role.
	Data AppResourceRole `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceRoleGetResponseEnvelope) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleGetResponseEnvelope) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleGetResponseEnvelope) UnmarshalJSON(data []byte) error

type AppResourceRoleListParams added in v0.7.0

type AppResourceRoleListParams struct {
	// Filter by app instance ID. At least one of team_id, app_instance_id, or
	// resource_id must be provided.
	AppInstanceID param.Opt[string] `query:"appInstanceId,omitzero" json:"-"`
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// Filter by resource ID. At least one of team_id, app_instance_id, or resource_id
	// must be provided.
	ResourceID param.Opt[string] `query:"resourceId,omitzero" json:"-"`
	// Filter by team ID. At least one of team_id, app_instance_id, or resource_id must
	// be provided.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AppResourceRoleListParams) URLQuery added in v0.7.0

func (r AppResourceRoleListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AppResourceRoleListParams's query parameters as `url.Values`.

type AppResourceRoleNewParams added in v0.7.0

type AppResourceRoleNewParams struct {
	// The name of the role.
	Name string `json:"name" api:"required"`
	// Provisioning configuration. Exactly one method should be set.
	ProvisioningMethod AppResourceRoleNewParamsProvisioningMethodUnion `json:"provisioningMethod,omitzero" api:"required"`
	// The ID of the resource.
	ResourceID string `json:"resourceId" api:"required"`
	// The default access policy for the role (optional).
	AccessPolicyID param.Opt[string] `json:"accessPolicyId,omitzero"`
	// Data from the external system as a JSON string (optional).
	ExternalData param.Opt[string] `json:"externalData,omitzero"`
	// The external ID of the role in the external system (optional).
	ExternalID param.Opt[string] `json:"externalId,omitzero"`
	// A description of the role.
	Description param.Opt[string] `json:"description,omitzero"`
	// Whether requests are enabled for the role.
	RequestsEnabled param.Opt[bool] `json:"requestsEnabled,omitzero"`
	// contains filtered or unexported fields
}

func (AppResourceRoleNewParams) MarshalJSON added in v0.7.0

func (r AppResourceRoleNewParams) MarshalJSON() (data []byte, err error)

func (*AppResourceRoleNewParams) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleNewParams) UnmarshalJSON(data []byte) error

type AppResourceRoleNewParamsProvisioningMethodBuiltinWorkflow added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodBuiltinWorkflow struct {
	// Provisioning is handled by the service's builtin workflow integration.
	BuiltinWorkflow any `json:"builtinWorkflow,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property BuiltinWorkflow is required.

func (AppResourceRoleNewParamsProvisioningMethodBuiltinWorkflow) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodBuiltinWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodCustomWorkflow added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodCustomWorkflow struct {
	// Provisioning is handled by custom workflows for provision + deprovision.
	CustomWorkflow AppResourceRoleNewParamsProvisioningMethodCustomWorkflowCustomWorkflow `json:"customWorkflow,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property CustomWorkflow is required.

func (AppResourceRoleNewParamsProvisioningMethodCustomWorkflow) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodCustomWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodCustomWorkflowCustomWorkflow added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodCustomWorkflowCustomWorkflow struct {
	// The workflow ID to deprovision access.
	DeprovisionWorkflowID param.Opt[string] `json:"deprovisionWorkflowId,omitzero"`
	// The workflow ID to provision access.
	ProvisionWorkflowID param.Opt[string] `json:"provisionWorkflowId,omitzero"`
	// contains filtered or unexported fields
}

Provisioning is handled by custom workflows for provision + deprovision.

func (AppResourceRoleNewParamsProvisioningMethodCustomWorkflowCustomWorkflow) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodCustomWorkflowCustomWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodLinkedRoles added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodLinkedRoles struct {
	// Provisioning depends on prerequisite roles being provisioned first.
	LinkedRoles AppResourceRoleNewParamsProvisioningMethodLinkedRolesLinkedRoles `json:"linkedRoles,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property LinkedRoles is required.

func (AppResourceRoleNewParamsProvisioningMethodLinkedRoles) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodLinkedRoles) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodLinkedRolesLinkedRoles added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodLinkedRolesLinkedRoles struct {
	// The IDs of prerequisite roles.
	LinkedRoleIDs []string `json:"linkedRoleIds,omitzero"`
	// contains filtered or unexported fields
}

Provisioning depends on prerequisite roles being provisioned first.

func (AppResourceRoleNewParamsProvisioningMethodLinkedRolesLinkedRoles) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodLinkedRolesLinkedRoles) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodManual added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodManual struct {
	// Provisioning is handled manually by assigned users/groups.
	Manual AppResourceRoleNewParamsProvisioningMethodManualManual `json:"manual,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property Manual is required.

func (AppResourceRoleNewParamsProvisioningMethodManual) MarshalJSON added in v0.7.0

func (r AppResourceRoleNewParamsProvisioningMethodManual) MarshalJSON() (data []byte, err error)

func (*AppResourceRoleNewParamsProvisioningMethodManual) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodManualManual added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodManualManual struct {
	// Users and groups that should be assigned/notified for manual provisioning.
	Assignees []AppResourceRoleNewParamsProvisioningMethodManualManualAssignee `json:"assignees,omitzero"`
	// contains filtered or unexported fields
}

Provisioning is handled manually by assigned users/groups.

func (AppResourceRoleNewParamsProvisioningMethodManualManual) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodManualManual) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodManualManualAssignee added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodManualManualAssignee struct {
	// The ID of the user or group.
	AssigneeID param.Opt[string] `json:"assigneeId,omitzero"`
	// The type of assignee.
	//
	// Any of "MANUAL_PROVISIONING_ASSIGNEE_TYPE_UNSPECIFIED",
	// "MANUAL_PROVISIONING_ASSIGNEE_TYPE_USER",
	// "MANUAL_PROVISIONING_ASSIGNEE_TYPE_GROUP".
	AssigneeType string `json:"assigneeType,omitzero"`
	// contains filtered or unexported fields
}

func (AppResourceRoleNewParamsProvisioningMethodManualManualAssignee) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodManualManualAssignee) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodUnion added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodUnion struct {
	OfBuiltinWorkflow *AppResourceRoleNewParamsProvisioningMethodBuiltinWorkflow `json:",omitzero,inline"`
	OfCustomWorkflow  *AppResourceRoleNewParamsProvisioningMethodCustomWorkflow  `json:",omitzero,inline"`
	OfLinkedRoles     *AppResourceRoleNewParamsProvisioningMethodLinkedRoles     `json:",omitzero,inline"`
	OfManual          *AppResourceRoleNewParamsProvisioningMethodManual          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (AppResourceRoleNewParamsProvisioningMethodUnion) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodUnion) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewResponseEnvelope added in v0.7.0

type AppResourceRoleNewResponseEnvelope struct {
	// The created role.
	Data AppResourceRole `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceRoleNewResponseEnvelope) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleNewResponseEnvelope) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleNewResponseEnvelope) UnmarshalJSON(data []byte) error

type AppResourceRoleProvisioningMethodBuiltinWorkflow added in v0.7.0

type AppResourceRoleProvisioningMethodBuiltinWorkflow struct {
	// Provisioning is handled by the service's builtin workflow integration.
	BuiltinWorkflow any `json:"builtinWorkflow" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BuiltinWorkflow respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceRoleProvisioningMethodBuiltinWorkflow) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodBuiltinWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleProvisioningMethodCustomWorkflow added in v0.7.0

type AppResourceRoleProvisioningMethodCustomWorkflow struct {
	// Provisioning is handled by custom workflows for provision + deprovision.
	CustomWorkflow AppResourceRoleProvisioningMethodCustomWorkflowCustomWorkflow `json:"customWorkflow" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CustomWorkflow respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceRoleProvisioningMethodCustomWorkflow) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodCustomWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleProvisioningMethodCustomWorkflowCustomWorkflow added in v0.7.0

type AppResourceRoleProvisioningMethodCustomWorkflowCustomWorkflow struct {
	// The workflow ID to deprovision access.
	DeprovisionWorkflowID string `json:"deprovisionWorkflowId"`
	// The workflow ID to provision access.
	ProvisionWorkflowID string `json:"provisionWorkflowId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DeprovisionWorkflowID respjson.Field
		ProvisionWorkflowID   respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Provisioning is handled by custom workflows for provision + deprovision.

func (AppResourceRoleProvisioningMethodCustomWorkflowCustomWorkflow) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodCustomWorkflowCustomWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleProvisioningMethodLinkedRoles added in v0.7.0

type AppResourceRoleProvisioningMethodLinkedRoles struct {
	// Provisioning depends on prerequisite roles being provisioned first.
	LinkedRoles AppResourceRoleProvisioningMethodLinkedRolesLinkedRoles `json:"linkedRoles" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LinkedRoles respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceRoleProvisioningMethodLinkedRoles) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodLinkedRoles) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleProvisioningMethodLinkedRoles) UnmarshalJSON(data []byte) error

type AppResourceRoleProvisioningMethodLinkedRolesLinkedRoles added in v0.7.0

type AppResourceRoleProvisioningMethodLinkedRolesLinkedRoles struct {
	// The IDs of prerequisite roles.
	LinkedRoleIDs []string `json:"linkedRoleIds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LinkedRoleIDs respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Provisioning depends on prerequisite roles being provisioned first.

func (AppResourceRoleProvisioningMethodLinkedRolesLinkedRoles) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodLinkedRolesLinkedRoles) UnmarshalJSON added in v0.7.0

type AppResourceRoleProvisioningMethodManual added in v0.7.0

type AppResourceRoleProvisioningMethodManual struct {
	// Provisioning is handled manually by assigned users/groups.
	Manual AppResourceRoleProvisioningMethodManualManual `json:"manual" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Manual      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceRoleProvisioningMethodManual) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodManual) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleProvisioningMethodManual) UnmarshalJSON(data []byte) error

type AppResourceRoleProvisioningMethodManualManual added in v0.7.0

type AppResourceRoleProvisioningMethodManualManual struct {
	// Users and groups that should be assigned/notified for manual provisioning.
	Assignees []AppResourceRoleProvisioningMethodManualManualAssignee `json:"assignees"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Assignees   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Provisioning is handled manually by assigned users/groups.

func (AppResourceRoleProvisioningMethodManualManual) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodManualManual) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleProvisioningMethodManualManual) UnmarshalJSON(data []byte) error

type AppResourceRoleProvisioningMethodManualManualAssignee added in v0.7.0

type AppResourceRoleProvisioningMethodManualManualAssignee struct {
	// The ID of the user or group.
	AssigneeID string `json:"assigneeId"`
	// The type of assignee.
	//
	// Any of "MANUAL_PROVISIONING_ASSIGNEE_TYPE_UNSPECIFIED",
	// "MANUAL_PROVISIONING_ASSIGNEE_TYPE_USER",
	// "MANUAL_PROVISIONING_ASSIGNEE_TYPE_GROUP".
	AssigneeType string `json:"assigneeType"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AssigneeID   respjson.Field
		AssigneeType respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceRoleProvisioningMethodManualManualAssignee) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodManualManualAssignee) UnmarshalJSON added in v0.7.0

type AppResourceRoleProvisioningMethodUnion added in v0.7.0

type AppResourceRoleProvisioningMethodUnion struct {
	// This field is from variant [AppResourceRoleProvisioningMethodBuiltinWorkflow].
	BuiltinWorkflow any `json:"builtinWorkflow"`
	// This field is from variant [AppResourceRoleProvisioningMethodCustomWorkflow].
	CustomWorkflow AppResourceRoleProvisioningMethodCustomWorkflowCustomWorkflow `json:"customWorkflow"`
	// This field is from variant [AppResourceRoleProvisioningMethodLinkedRoles].
	LinkedRoles AppResourceRoleProvisioningMethodLinkedRolesLinkedRoles `json:"linkedRoles"`
	// This field is from variant [AppResourceRoleProvisioningMethodManual].
	Manual AppResourceRoleProvisioningMethodManualManual `json:"manual"`
	JSON   struct {
		BuiltinWorkflow respjson.Field
		CustomWorkflow  respjson.Field
		LinkedRoles     respjson.Field
		Manual          respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AppResourceRoleProvisioningMethodUnion contains all possible properties and values from AppResourceRoleProvisioningMethodBuiltinWorkflow, AppResourceRoleProvisioningMethodCustomWorkflow, AppResourceRoleProvisioningMethodLinkedRoles, AppResourceRoleProvisioningMethodManual.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (AppResourceRoleProvisioningMethodUnion) AsBuiltinWorkflow added in v0.7.0

func (AppResourceRoleProvisioningMethodUnion) AsCustomWorkflow added in v0.7.0

func (AppResourceRoleProvisioningMethodUnion) AsLinkedRoles added in v0.7.0

func (AppResourceRoleProvisioningMethodUnion) AsManual added in v0.7.0

func (AppResourceRoleProvisioningMethodUnion) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodUnion) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleProvisioningMethodUnion) UnmarshalJSON(data []byte) error

type AppResourceRoleService added in v0.7.0

type AppResourceRoleService struct {
	Options []option.RequestOption
}

AppResourceRoleService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAppResourceRoleService method instead.

func NewAppResourceRoleService added in v0.7.0

func NewAppResourceRoleService(opts ...option.RequestOption) (r AppResourceRoleService)

NewAppResourceRoleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AppResourceRoleService) Delete added in v0.7.0

Delete an app resource role.

func (*AppResourceRoleService) Get added in v0.7.0

Get a specific app resource role by ID.

func (*AppResourceRoleService) List added in v0.7.0

List all app resource roles for a team, optionally filtered by resource.

func (*AppResourceRoleService) ListAutoPaging added in v0.19.0

List all app resource roles for a team, optionally filtered by resource.

func (*AppResourceRoleService) New added in v0.7.0

Create a new app resource role for a resource.

func (*AppResourceRoleService) Update added in v0.7.0

Update an existing app resource role.

type AppResourceRoleUpdateParams added in v0.7.0

type AppResourceRoleUpdateParams struct {
	// The default access policy for the role (optional).
	AccessPolicyID param.Opt[string] `json:"accessPolicyId,omitzero"`
	// Data from the external system as a JSON string (optional).
	ExternalData param.Opt[string] `json:"externalData,omitzero"`
	// The external ID of the role in the external system (optional).
	ExternalID param.Opt[string] `json:"externalId,omitzero"`
	// A description of the role.
	Description param.Opt[string] `json:"description,omitzero"`
	// The name of the role.
	Name param.Opt[string] `json:"name,omitzero"`
	// Whether requests are enabled for the role.
	RequestsEnabled param.Opt[bool] `json:"requestsEnabled,omitzero"`
	// Provisioning configuration. Exactly one method should be set.
	ProvisioningMethod AppResourceRoleUpdateParamsProvisioningMethodUnion `json:"provisioningMethod,omitzero"`
	// contains filtered or unexported fields
}

func (AppResourceRoleUpdateParams) MarshalJSON added in v0.7.0

func (r AppResourceRoleUpdateParams) MarshalJSON() (data []byte, err error)

func (*AppResourceRoleUpdateParams) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleUpdateParams) UnmarshalJSON(data []byte) error

type AppResourceRoleUpdateParamsProvisioningMethodBuiltinWorkflow added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodBuiltinWorkflow struct {
	// Provisioning is handled by the service's builtin workflow integration.
	BuiltinWorkflow any `json:"builtinWorkflow,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property BuiltinWorkflow is required.

func (AppResourceRoleUpdateParamsProvisioningMethodBuiltinWorkflow) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodBuiltinWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow struct {
	// Provisioning is handled by custom workflows for provision + deprovision.
	CustomWorkflow AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflowCustomWorkflow `json:"customWorkflow,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property CustomWorkflow is required.

func (AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflowCustomWorkflow added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflowCustomWorkflow struct {
	// The workflow ID to deprovision access.
	DeprovisionWorkflowID param.Opt[string] `json:"deprovisionWorkflowId,omitzero"`
	// The workflow ID to provision access.
	ProvisionWorkflowID param.Opt[string] `json:"provisionWorkflowId,omitzero"`
	// contains filtered or unexported fields
}

Provisioning is handled by custom workflows for provision + deprovision.

func (AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflowCustomWorkflow) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflowCustomWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles struct {
	// Provisioning depends on prerequisite roles being provisioned first.
	LinkedRoles AppResourceRoleUpdateParamsProvisioningMethodLinkedRolesLinkedRoles `json:"linkedRoles,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property LinkedRoles is required.

func (AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodLinkedRolesLinkedRoles added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodLinkedRolesLinkedRoles struct {
	// The IDs of prerequisite roles.
	LinkedRoleIDs []string `json:"linkedRoleIds,omitzero"`
	// contains filtered or unexported fields
}

Provisioning depends on prerequisite roles being provisioned first.

func (AppResourceRoleUpdateParamsProvisioningMethodLinkedRolesLinkedRoles) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodLinkedRolesLinkedRoles) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodManual added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodManual struct {
	// Provisioning is handled manually by assigned users/groups.
	Manual AppResourceRoleUpdateParamsProvisioningMethodManualManual `json:"manual,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property Manual is required.

func (AppResourceRoleUpdateParamsProvisioningMethodManual) MarshalJSON added in v0.7.0

func (r AppResourceRoleUpdateParamsProvisioningMethodManual) MarshalJSON() (data []byte, err error)

func (*AppResourceRoleUpdateParamsProvisioningMethodManual) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodManualManual added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodManualManual struct {
	// Users and groups that should be assigned/notified for manual provisioning.
	Assignees []AppResourceRoleUpdateParamsProvisioningMethodManualManualAssignee `json:"assignees,omitzero"`
	// contains filtered or unexported fields
}

Provisioning is handled manually by assigned users/groups.

func (AppResourceRoleUpdateParamsProvisioningMethodManualManual) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodManualManual) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodManualManualAssignee added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodManualManualAssignee struct {
	// The ID of the user or group.
	AssigneeID param.Opt[string] `json:"assigneeId,omitzero"`
	// The type of assignee.
	//
	// Any of "MANUAL_PROVISIONING_ASSIGNEE_TYPE_UNSPECIFIED",
	// "MANUAL_PROVISIONING_ASSIGNEE_TYPE_USER",
	// "MANUAL_PROVISIONING_ASSIGNEE_TYPE_GROUP".
	AssigneeType string `json:"assigneeType,omitzero"`
	// contains filtered or unexported fields
}

func (AppResourceRoleUpdateParamsProvisioningMethodManualManualAssignee) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodManualManualAssignee) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodUnion added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodUnion struct {
	OfBuiltinWorkflow *AppResourceRoleUpdateParamsProvisioningMethodBuiltinWorkflow `json:",omitzero,inline"`
	OfCustomWorkflow  *AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow  `json:",omitzero,inline"`
	OfLinkedRoles     *AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles     `json:",omitzero,inline"`
	OfManual          *AppResourceRoleUpdateParamsProvisioningMethodManual          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (AppResourceRoleUpdateParamsProvisioningMethodUnion) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodUnion) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateResponseEnvelope added in v0.7.0

type AppResourceRoleUpdateResponseEnvelope struct {
	// The updated role.
	Data AppResourceRole `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceRoleUpdateResponseEnvelope) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleUpdateResponseEnvelope) UnmarshalJSON added in v0.7.0

func (r *AppResourceRoleUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type AppResourceService

type AppResourceService struct {
	Options []option.RequestOption
}

AppResourceService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAppResourceService method instead.

func NewAppResourceService

func NewAppResourceService(opts ...option.RequestOption) (r AppResourceService)

NewAppResourceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AppResourceService) Delete

Delete an app resource.

func (*AppResourceService) Get

func (r *AppResourceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *AppResource, err error)

Get a specific app resource by ID.

func (*AppResourceService) List

List all app resources for a team, optionally filtered by app instance.

func (*AppResourceService) ListAutoPaging added in v0.19.0

List all app resources for a team, optionally filtered by app instance.

func (*AppResourceService) New

Create a new app resource for an app instance.

func (*AppResourceService) Update

Update an existing app resource.

type AppResourceUpdateParams

type AppResourceUpdateParams struct {
	// The external ID of the resource (optional).
	ExternalID param.Opt[string] `json:"externalId,omitzero"`
	// A description of the resource.
	Description param.Opt[string] `json:"description,omitzero"`
	// The name of the resource.
	Name param.Opt[string] `json:"name,omitzero"`
	// The type of the resource.
	ResourceType param.Opt[string] `json:"resourceType,omitzero"`
	// contains filtered or unexported fields
}

func (AppResourceUpdateParams) MarshalJSON

func (r AppResourceUpdateParams) MarshalJSON() (data []byte, err error)

func (*AppResourceUpdateParams) UnmarshalJSON

func (r *AppResourceUpdateParams) UnmarshalJSON(data []byte) error

type AppResourceUpdateResponseEnvelope

type AppResourceUpdateResponseEnvelope struct {
	// The updated resource.
	Data AppResource `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppResourceUpdateResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*AppResourceUpdateResponseEnvelope) UnmarshalJSON

func (r *AppResourceUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type ApprovalDelegation added in v0.22.0

type ApprovalDelegation struct {
	// The ID of the approval delegation.
	ID string `json:"id"`
	// The timestamp when the delegation was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// The delegates who can approve on behalf of the delegator.
	Delegates []ApprovalDelegationDelegate `json:"delegates"`
	// The ID of the user who is delegating their approvals.
	DelegatorUserID string `json:"delegatorUserId"`
	// A description of the delegation rule.
	Description string `json:"description"`
	// The priority of the delegation rule (lower values are higher priority).
	Priority int64 `json:"priority"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		CreatedAt       respjson.Field
		Delegates       respjson.Field
		DelegatorUserID respjson.Field
		Description     respjson.Field
		Priority        respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An approval delegation rule that allows a user to delegate their approval responsibilities.

func (ApprovalDelegation) RawJSON added in v0.22.0

func (r ApprovalDelegation) RawJSON() string

Returns the unmodified JSON received from the API

func (*ApprovalDelegation) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegation) UnmarshalJSON(data []byte) error

type ApprovalDelegationDelegate added in v0.22.0

type ApprovalDelegationDelegate struct {
	// The ID of the delegate (user ID or group ID, depending on type).
	ID string `json:"id"`
	// The type of delegate (user or group).
	//
	// Any of "APPROVAL_DELEGATE_TYPE_UNSPECIFIED", "APPROVAL_DELEGATE_TYPE_USER",
	// "APPROVAL_DELEGATE_TYPE_GROUP".
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A delegate who can approve on behalf of a delegator.

func (ApprovalDelegationDelegate) RawJSON added in v0.22.0

func (r ApprovalDelegationDelegate) RawJSON() string

Returns the unmodified JSON received from the API

func (*ApprovalDelegationDelegate) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegationDelegate) UnmarshalJSON(data []byte) error

type ApprovalDelegationDeleteResponse added in v0.22.0

type ApprovalDelegationDeleteResponse = any

type ApprovalDelegationGetResponseEnvelope added in v0.22.0

type ApprovalDelegationGetResponseEnvelope struct {
	// An approval delegation rule that allows a user to delegate their approval
	// responsibilities.
	Data ApprovalDelegation `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ApprovalDelegationGetResponseEnvelope) RawJSON added in v0.22.0

Returns the unmodified JSON received from the API

func (*ApprovalDelegationGetResponseEnvelope) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegationGetResponseEnvelope) UnmarshalJSON(data []byte) error

type ApprovalDelegationListParams added in v0.22.0

type ApprovalDelegationListParams struct {
	// Optional user ID to list delegations for a specific user.
	DelegatorUserID param.Opt[string] `query:"delegatorUserId,omitzero" json:"-"`
	// Maximum number of results to return.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ApprovalDelegationListParams) URLQuery added in v0.22.0

func (r ApprovalDelegationListParams) URLQuery() (v url.Values, err error)

URLQuery serializes ApprovalDelegationListParams's query parameters as `url.Values`.

type ApprovalDelegationNewParams added in v0.22.0

type ApprovalDelegationNewParams struct {
	// The delegates who can approve on behalf of the delegator.
	Delegates []ApprovalDelegationNewParamsDelegate `json:"delegates,omitzero" api:"required"`
	// The ID of the user who is delegating their approvals. When omitted, defaults to
	// the authenticated user.
	DelegatorUserID param.Opt[string] `json:"delegatorUserId,omitzero"`
	// A description of the delegation rule.
	Description param.Opt[string] `json:"description,omitzero"`
	// The priority of the delegation rule (lower values are higher priority).
	Priority param.Opt[int64] `json:"priority,omitzero"`
	// contains filtered or unexported fields
}

func (ApprovalDelegationNewParams) MarshalJSON added in v0.22.0

func (r ApprovalDelegationNewParams) MarshalJSON() (data []byte, err error)

func (*ApprovalDelegationNewParams) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegationNewParams) UnmarshalJSON(data []byte) error

type ApprovalDelegationNewParamsDelegate added in v0.22.0

type ApprovalDelegationNewParamsDelegate struct {
	// The ID of the delegate (user ID or group ID, depending on type).
	ID param.Opt[string] `json:"id,omitzero"`
	// The type of delegate (user or group).
	//
	// Any of "APPROVAL_DELEGATE_TYPE_UNSPECIFIED", "APPROVAL_DELEGATE_TYPE_USER",
	// "APPROVAL_DELEGATE_TYPE_GROUP".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

A delegate who can approve on behalf of a delegator.

func (ApprovalDelegationNewParamsDelegate) MarshalJSON added in v0.22.0

func (r ApprovalDelegationNewParamsDelegate) MarshalJSON() (data []byte, err error)

func (*ApprovalDelegationNewParamsDelegate) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegationNewParamsDelegate) UnmarshalJSON(data []byte) error

type ApprovalDelegationNewResponseEnvelope added in v0.22.0

type ApprovalDelegationNewResponseEnvelope struct {
	// An approval delegation rule that allows a user to delegate their approval
	// responsibilities.
	Data ApprovalDelegation `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ApprovalDelegationNewResponseEnvelope) RawJSON added in v0.22.0

Returns the unmodified JSON received from the API

func (*ApprovalDelegationNewResponseEnvelope) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegationNewResponseEnvelope) UnmarshalJSON(data []byte) error

type ApprovalDelegationService added in v0.22.0

type ApprovalDelegationService struct {
	Options []option.RequestOption
}

ApprovalDelegationService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewApprovalDelegationService method instead.

func NewApprovalDelegationService added in v0.22.0

func NewApprovalDelegationService(opts ...option.RequestOption) (r ApprovalDelegationService)

NewApprovalDelegationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ApprovalDelegationService) Delete added in v0.22.0

Delete an approval delegation rule.

func (*ApprovalDelegationService) Get added in v0.22.0

Get an approval delegation rule by its ID.

func (*ApprovalDelegationService) List added in v0.22.0

List approval delegation rules. Optionally filter by delegator_user_id.

func (*ApprovalDelegationService) ListAutoPaging added in v0.22.0

List approval delegation rules. Optionally filter by delegator_user_id.

func (*ApprovalDelegationService) New added in v0.22.0

Create a new approval delegation rule. Optionally specify a delegator_user_id to create on behalf of another user.

func (*ApprovalDelegationService) Update added in v0.22.0

Update an existing approval delegation rule.

type ApprovalDelegationUpdateParams added in v0.22.0

type ApprovalDelegationUpdateParams struct {
	// A description of the delegation rule.
	Description param.Opt[string] `json:"description,omitzero"`
	// The priority of the delegation rule (lower values are higher priority).
	Priority param.Opt[int64] `json:"priority,omitzero"`
	// The delegates who can approve on behalf of the delegator.
	Delegates []ApprovalDelegationUpdateParamsDelegate `json:"delegates,omitzero"`
	// contains filtered or unexported fields
}

func (ApprovalDelegationUpdateParams) MarshalJSON added in v0.22.0

func (r ApprovalDelegationUpdateParams) MarshalJSON() (data []byte, err error)

func (*ApprovalDelegationUpdateParams) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegationUpdateParams) UnmarshalJSON(data []byte) error

type ApprovalDelegationUpdateParamsDelegate added in v0.22.0

type ApprovalDelegationUpdateParamsDelegate struct {
	// The ID of the delegate (user ID or group ID, depending on type).
	ID param.Opt[string] `json:"id,omitzero"`
	// The type of delegate (user or group).
	//
	// Any of "APPROVAL_DELEGATE_TYPE_UNSPECIFIED", "APPROVAL_DELEGATE_TYPE_USER",
	// "APPROVAL_DELEGATE_TYPE_GROUP".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

A delegate who can approve on behalf of a delegator.

func (ApprovalDelegationUpdateParamsDelegate) MarshalJSON added in v0.22.0

func (r ApprovalDelegationUpdateParamsDelegate) MarshalJSON() (data []byte, err error)

func (*ApprovalDelegationUpdateParamsDelegate) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegationUpdateParamsDelegate) UnmarshalJSON(data []byte) error

type ApprovalDelegationUpdateResponseEnvelope added in v0.22.0

type ApprovalDelegationUpdateResponseEnvelope struct {
	// An approval delegation rule that allows a user to delegate their approval
	// responsibilities.
	Data ApprovalDelegation `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ApprovalDelegationUpdateResponseEnvelope) RawJSON added in v0.22.0

Returns the unmodified JSON received from the API

func (*ApprovalDelegationUpdateResponseEnvelope) UnmarshalJSON added in v0.22.0

func (r *ApprovalDelegationUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	Options             []option.RequestOption
	AccessPolicies      AccessPolicyService
	Guidances           GuidanceService
	Workflows           WorkflowService
	WorkflowRuns        WorkflowRunService
	AccessRequests      AccessRequestService
	AppInstances        AppInstanceService
	AppResources        AppResourceService
	AppResourceRoles    AppResourceRoleService
	Users               UserService
	Groups              GroupService
	Teams               TeamService
	TeamUsers           TeamUserService
	ApprovalDelegations ApprovalDelegationService
	Tags                TagService
	CustomServices      CustomServiceService
}

Client creates a struct with services and top level methods that help with interacting with the serval API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (SERVAL_CLIENT_ID, SERVAL_CLIENT_SECRET, SERVAL_BEARER_TOKEN, SERVAL_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CustomService added in v0.12.0

type CustomService struct {
	// The ID of the custom service.
	ID string `json:"id"`
	// The domain for branding/logo lookup (e.g., "hr.company.com").
	Domain string `json:"domain"`
	// The name of the custom service (e.g., "Internal HR System").
	Name string `json:"name"`
	// The ID of the team that the custom service belongs to.
	TeamID string `json:"teamId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Domain      respjson.Field
		Name        respjson.Field
		TeamID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomService) RawJSON added in v0.12.0

func (r CustomService) RawJSON() string

Returns the unmodified JSON received from the API

func (*CustomService) UnmarshalJSON added in v0.12.0

func (r *CustomService) UnmarshalJSON(data []byte) error

type CustomServiceDeleteResponse added in v0.12.0

type CustomServiceDeleteResponse = any

type CustomServiceGetResponseEnvelope added in v0.12.0

type CustomServiceGetResponseEnvelope struct {
	// The custom service.
	Data CustomService `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomServiceGetResponseEnvelope) RawJSON added in v0.12.0

Returns the unmodified JSON received from the API

func (*CustomServiceGetResponseEnvelope) UnmarshalJSON added in v0.12.0

func (r *CustomServiceGetResponseEnvelope) UnmarshalJSON(data []byte) error

type CustomServiceListParams added in v0.12.0

type CustomServiceListParams struct {
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// The ID of the team.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CustomServiceListParams) URLQuery added in v0.12.0

func (r CustomServiceListParams) URLQuery() (v url.Values, err error)

URLQuery serializes CustomServiceListParams's query parameters as `url.Values`.

type CustomServiceNewParams added in v0.12.0

type CustomServiceNewParams struct {
	// The name of the custom service (e.g., "Internal HR System").
	Name string `json:"name" api:"required"`
	// The ID of the team.
	TeamID string `json:"teamId" api:"required"`
	// The domain for branding/logo lookup (e.g., "hr.company.com").
	Domain param.Opt[string] `json:"domain,omitzero"`
	// contains filtered or unexported fields
}

func (CustomServiceNewParams) MarshalJSON added in v0.12.0

func (r CustomServiceNewParams) MarshalJSON() (data []byte, err error)

func (*CustomServiceNewParams) UnmarshalJSON added in v0.12.0

func (r *CustomServiceNewParams) UnmarshalJSON(data []byte) error

type CustomServiceNewResponseEnvelope added in v0.12.0

type CustomServiceNewResponseEnvelope struct {
	// The created custom service.
	Data CustomService `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomServiceNewResponseEnvelope) RawJSON added in v0.12.0

Returns the unmodified JSON received from the API

func (*CustomServiceNewResponseEnvelope) UnmarshalJSON added in v0.12.0

func (r *CustomServiceNewResponseEnvelope) UnmarshalJSON(data []byte) error

type CustomServiceService added in v0.12.0

type CustomServiceService struct {
	Options []option.RequestOption
}

CustomServiceService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomServiceService method instead.

func NewCustomServiceService added in v0.12.0

func NewCustomServiceService(opts ...option.RequestOption) (r CustomServiceService)

NewCustomServiceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomServiceService) Delete added in v0.12.0

Delete a custom service. This will not delete any app instances that use this custom service.

func (*CustomServiceService) Get added in v0.12.0

func (r *CustomServiceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *CustomService, err error)

Get a specific custom service by ID.

func (*CustomServiceService) List added in v0.12.0

List all custom services for a team.

func (*CustomServiceService) ListAutoPaging added in v0.19.0

List all custom services for a team.

func (*CustomServiceService) New added in v0.12.0

Create a new custom service for a team. Custom services represent external APIs or systems that are not built-in integrations.

func (*CustomServiceService) Update added in v0.12.0

Update an existing custom service.

type CustomServiceUpdateParams added in v0.12.0

type CustomServiceUpdateParams struct {
	// The domain for branding/logo lookup.
	Domain param.Opt[string] `json:"domain,omitzero"`
	// The name of the custom service.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (CustomServiceUpdateParams) MarshalJSON added in v0.12.0

func (r CustomServiceUpdateParams) MarshalJSON() (data []byte, err error)

func (*CustomServiceUpdateParams) UnmarshalJSON added in v0.12.0

func (r *CustomServiceUpdateParams) UnmarshalJSON(data []byte) error

type CustomServiceUpdateResponseEnvelope added in v0.12.0

type CustomServiceUpdateResponseEnvelope struct {
	// The updated custom service.
	Data CustomService `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomServiceUpdateResponseEnvelope) RawJSON added in v0.12.0

Returns the unmodified JSON received from the API

func (*CustomServiceUpdateResponseEnvelope) UnmarshalJSON added in v0.12.0

func (r *CustomServiceUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type Error

type Error = apierror.Error

type Group

type Group struct {
	ID string `json:"id"`
	// A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
	DeletedAt      time.Time `json:"deletedAt" api:"nullable" format:"date-time"`
	Name           string    `json:"name"`
	OrganizationID string    `json:"organizationId"`
	UserIDs        []string  `json:"userIds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		CreatedAt      respjson.Field
		DeletedAt      respjson.Field
		Name           respjson.Field
		OrganizationID respjson.Field
		UserIDs        respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Group) RawJSON

func (r Group) RawJSON() string

Returns the unmodified JSON received from the API

func (*Group) UnmarshalJSON

func (r *Group) UnmarshalJSON(data []byte) error

type GroupDeleteResponse

type GroupDeleteResponse = any

type GroupGetResponseEnvelope

type GroupGetResponseEnvelope struct {
	Data Group `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (GroupGetResponseEnvelope) RawJSON

func (r GroupGetResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*GroupGetResponseEnvelope) UnmarshalJSON

func (r *GroupGetResponseEnvelope) UnmarshalJSON(data []byte) error

type GroupListParams

type GroupListParams struct {
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (GroupListParams) URLQuery

func (r GroupListParams) URLQuery() (v url.Values, err error)

URLQuery serializes GroupListParams's query parameters as `url.Values`.

type GroupNewParams

type GroupNewParams struct {
	Name    string   `json:"name" api:"required"`
	UserIDs []string `json:"userIds,omitzero"`
	// contains filtered or unexported fields
}

func (GroupNewParams) MarshalJSON

func (r GroupNewParams) MarshalJSON() (data []byte, err error)

func (*GroupNewParams) UnmarshalJSON

func (r *GroupNewParams) UnmarshalJSON(data []byte) error

type GroupNewResponseEnvelope

type GroupNewResponseEnvelope struct {
	Data Group `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (GroupNewResponseEnvelope) RawJSON

func (r GroupNewResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*GroupNewResponseEnvelope) UnmarshalJSON

func (r *GroupNewResponseEnvelope) UnmarshalJSON(data []byte) error

type GroupService

type GroupService struct {
	Options []option.RequestOption
}

GroupService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGroupService method instead.

func NewGroupService

func NewGroupService(opts ...option.RequestOption) (r GroupService)

NewGroupService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GroupService) Delete

func (r *GroupService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *GroupDeleteResponse, err error)

Delete a group.

func (*GroupService) Get

func (r *GroupService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Group, err error)

Get a specific group by ID.

func (*GroupService) List

func (r *GroupService) List(ctx context.Context, query GroupListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Group], err error)

List all groups.

func (*GroupService) ListAutoPaging added in v0.19.0

List all groups.

func (*GroupService) New

func (r *GroupService) New(ctx context.Context, body GroupNewParams, opts ...option.RequestOption) (res *Group, err error)

Create a new group.

func (*GroupService) Update

func (r *GroupService) Update(ctx context.Context, id string, body GroupUpdateParams, opts ...option.RequestOption) (res *Group, err error)

Update an existing group.

type GroupUpdateParams

type GroupUpdateParams struct {
	Name    param.Opt[string] `json:"name,omitzero"`
	UserIDs []string          `json:"userIds,omitzero"`
	// contains filtered or unexported fields
}

func (GroupUpdateParams) MarshalJSON

func (r GroupUpdateParams) MarshalJSON() (data []byte, err error)

func (*GroupUpdateParams) UnmarshalJSON

func (r *GroupUpdateParams) UnmarshalJSON(data []byte) error

type GroupUpdateResponseEnvelope

type GroupUpdateResponseEnvelope struct {
	Data Group `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (GroupUpdateResponseEnvelope) RawJSON

func (r GroupUpdateResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*GroupUpdateResponseEnvelope) UnmarshalJSON

func (r *GroupUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type Guidance

type Guidance struct {
	// The ID of the guidance.
	ID string `json:"id"`
	// The content of the guidance.
	Content string `json:"content"`
	// A description of the guidance.
	Description string `json:"description"`
	// Whether there are unpublished changes to the guidance (computed by server).
	HasUnpublishedChanges bool `json:"hasUnpublishedChanges"`
	// Whether the guidance is published. Set to true to publish the guidance.
	IsPublished bool `json:"isPublished"`
	// The name of the guidance.
	Name string `json:"name"`
	// Whether this guidance should always be used (skipping LLM selection).
	ShouldAlwaysUse bool `json:"shouldAlwaysUse"`
	// The ID of the team that the guidance belongs to.
	TeamID string `json:"teamId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		Content               respjson.Field
		Description           respjson.Field
		HasUnpublishedChanges respjson.Field
		IsPublished           respjson.Field
		Name                  respjson.Field
		ShouldAlwaysUse       respjson.Field
		TeamID                respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Guidance) RawJSON

func (r Guidance) RawJSON() string

Returns the unmodified JSON received from the API

func (*Guidance) UnmarshalJSON

func (r *Guidance) UnmarshalJSON(data []byte) error

type GuidanceDeleteResponse

type GuidanceDeleteResponse = any

type GuidanceGetResponseEnvelope

type GuidanceGetResponseEnvelope struct {
	// The guidance.
	Data Guidance `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (GuidanceGetResponseEnvelope) RawJSON

func (r GuidanceGetResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*GuidanceGetResponseEnvelope) UnmarshalJSON

func (r *GuidanceGetResponseEnvelope) UnmarshalJSON(data []byte) error

type GuidanceListParams

type GuidanceListParams struct {
	// Maximum number of results to return. Default is 1000, maximum is 2000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// The ID of the team.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (GuidanceListParams) URLQuery

func (r GuidanceListParams) URLQuery() (v url.Values, err error)

URLQuery serializes GuidanceListParams's query parameters as `url.Values`.

type GuidanceNewParams

type GuidanceNewParams struct {
	// The content of the guidance.
	Content string `json:"content" api:"required"`
	// The name of the guidance.
	Name string `json:"name" api:"required"`
	// The ID of the team.
	TeamID string `json:"teamId" api:"required"`
	// Whether to publish the guidance after creation (optional).
	IsPublished param.Opt[bool] `json:"isPublished,omitzero"`
	// Whether this guidance should always be used (optional, defaults to false).
	ShouldAlwaysUse param.Opt[bool] `json:"shouldAlwaysUse,omitzero"`
	// A description of the guidance.
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (GuidanceNewParams) MarshalJSON

func (r GuidanceNewParams) MarshalJSON() (data []byte, err error)

func (*GuidanceNewParams) UnmarshalJSON

func (r *GuidanceNewParams) UnmarshalJSON(data []byte) error

type GuidanceNewResponseEnvelope

type GuidanceNewResponseEnvelope struct {
	// The created guidance.
	Data Guidance `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (GuidanceNewResponseEnvelope) RawJSON

func (r GuidanceNewResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*GuidanceNewResponseEnvelope) UnmarshalJSON

func (r *GuidanceNewResponseEnvelope) UnmarshalJSON(data []byte) error

type GuidanceService

type GuidanceService struct {
	Options []option.RequestOption
}

GuidanceService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGuidanceService method instead.

func NewGuidanceService

func NewGuidanceService(opts ...option.RequestOption) (r GuidanceService)

NewGuidanceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GuidanceService) Delete

func (r *GuidanceService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *GuidanceDeleteResponse, err error)

Delete a guidance.

func (*GuidanceService) Get

func (r *GuidanceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Guidance, err error)

Get a specific guidance by ID.

func (*GuidanceService) List

List all guidances for a team.

func (*GuidanceService) ListAutoPaging added in v0.19.0

List all guidances for a team.

func (*GuidanceService) New

func (r *GuidanceService) New(ctx context.Context, body GuidanceNewParams, opts ...option.RequestOption) (res *Guidance, err error)

Create a new guidance for a team.

func (*GuidanceService) Update

func (r *GuidanceService) Update(ctx context.Context, id string, body GuidanceUpdateParams, opts ...option.RequestOption) (res *Guidance, err error)

Update an existing guidance.

type GuidanceUpdateParams

type GuidanceUpdateParams struct {
	// Whether the guidance is published. Set to true to publish the guidance.
	IsPublished param.Opt[bool] `json:"isPublished,omitzero"`
	// Whether this guidance should always be used (optional).
	ShouldAlwaysUse param.Opt[bool] `json:"shouldAlwaysUse,omitzero"`
	// The content of the guidance.
	Content param.Opt[string] `json:"content,omitzero"`
	// A description of the guidance.
	Description param.Opt[string] `json:"description,omitzero"`
	// The name of the guidance.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (GuidanceUpdateParams) MarshalJSON

func (r GuidanceUpdateParams) MarshalJSON() (data []byte, err error)

func (*GuidanceUpdateParams) UnmarshalJSON

func (r *GuidanceUpdateParams) UnmarshalJSON(data []byte) error

type GuidanceUpdateResponseEnvelope

type GuidanceUpdateResponseEnvelope struct {
	// The updated guidance.
	Data Guidance `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (GuidanceUpdateResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*GuidanceUpdateResponseEnvelope) UnmarshalJSON

func (r *GuidanceUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type Tag added in v0.6.0

type Tag struct {
	// The ID of the tag.
	ID string `json:"id"`
	// The color of the tag (CSS color string).
	Color string `json:"color" api:"nullable"`
	// The icon slug for the tag.
	IconSlug string `json:"iconSlug" api:"nullable"`
	// The name of the tag.
	Name string `json:"name"`
	// The ID of the team that owns this tag.
	TeamID string `json:"teamId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Color       respjson.Field
		IconSlug    respjson.Field
		Name        respjson.Field
		TeamID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tag that can be associated with workflows.

func (Tag) RawJSON added in v0.6.0

func (r Tag) RawJSON() string

Returns the unmodified JSON received from the API

func (*Tag) UnmarshalJSON added in v0.6.0

func (r *Tag) UnmarshalJSON(data []byte) error

type TagDeleteResponse added in v0.22.0

type TagDeleteResponse = any

type TagGetResponseEnvelope added in v0.6.0

type TagGetResponseEnvelope struct {
	// The tag.
	Data Tag `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TagGetResponseEnvelope) RawJSON added in v0.6.0

func (r TagGetResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*TagGetResponseEnvelope) UnmarshalJSON added in v0.6.0

func (r *TagGetResponseEnvelope) UnmarshalJSON(data []byte) error

type TagListParams added in v0.6.0

type TagListParams struct {
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// The ID of the team.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TagListParams) URLQuery added in v0.6.0

func (r TagListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TagListParams's query parameters as `url.Values`.

type TagNewParams added in v0.22.0

type TagNewParams struct {
	// The name of the tag.
	Name string `json:"name" api:"required"`
	// The ID of the team to create the tag for.
	TeamID string `json:"teamId" api:"required"`
	// The color of the tag (CSS color string).
	Color param.Opt[string] `json:"color,omitzero"`
	// The icon slug for the tag.
	IconSlug param.Opt[string] `json:"iconSlug,omitzero"`
	// contains filtered or unexported fields
}

func (TagNewParams) MarshalJSON added in v0.22.0

func (r TagNewParams) MarshalJSON() (data []byte, err error)

func (*TagNewParams) UnmarshalJSON added in v0.22.0

func (r *TagNewParams) UnmarshalJSON(data []byte) error

type TagNewResponseEnvelope added in v0.22.0

type TagNewResponseEnvelope struct {
	// The created tag.
	Data Tag `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TagNewResponseEnvelope) RawJSON added in v0.22.0

func (r TagNewResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*TagNewResponseEnvelope) UnmarshalJSON added in v0.22.0

func (r *TagNewResponseEnvelope) UnmarshalJSON(data []byte) error

type TagService added in v0.6.0

type TagService struct {
	Options []option.RequestOption
}

TagService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTagService method instead.

func NewTagService added in v0.6.0

func NewTagService(opts ...option.RequestOption) (r TagService)

NewTagService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TagService) Delete added in v0.22.0

func (r *TagService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *TagDeleteResponse, err error)

Delete a tag.

func (*TagService) Get added in v0.6.0

func (r *TagService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Tag, err error)

Get a specific tag by ID.

func (*TagService) List added in v0.6.0

func (r *TagService) List(ctx context.Context, query TagListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Tag], err error)

List all tags for a team.

func (*TagService) ListAutoPaging added in v0.22.0

List all tags for a team.

func (*TagService) New added in v0.22.0

func (r *TagService) New(ctx context.Context, body TagNewParams, opts ...option.RequestOption) (res *Tag, err error)

Create a new tag.

func (*TagService) Update added in v0.22.0

func (r *TagService) Update(ctx context.Context, id string, body TagUpdateParams, opts ...option.RequestOption) (res *Tag, err error)

Update an existing tag.

type TagUpdateParams added in v0.22.0

type TagUpdateParams struct {
	// The color of the tag (CSS color string).
	Color param.Opt[string] `json:"color,omitzero"`
	// The icon slug for the tag.
	IconSlug param.Opt[string] `json:"iconSlug,omitzero"`
	// The name of the tag.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (TagUpdateParams) MarshalJSON added in v0.22.0

func (r TagUpdateParams) MarshalJSON() (data []byte, err error)

func (*TagUpdateParams) UnmarshalJSON added in v0.22.0

func (r *TagUpdateParams) UnmarshalJSON(data []byte) error

type TagUpdateResponseEnvelope added in v0.22.0

type TagUpdateResponseEnvelope struct {
	// The updated tag.
	Data Tag `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TagUpdateResponseEnvelope) RawJSON added in v0.22.0

func (r TagUpdateResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*TagUpdateResponseEnvelope) UnmarshalJSON added in v0.22.0

func (r *TagUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type Team

type Team struct {
	ID string `json:"id"`
	// A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
	CreatedAt      time.Time `json:"createdAt" format:"date-time"`
	Description    string    `json:"description" api:"nullable"`
	Name           string    `json:"name"`
	OrganizationID string    `json:"organizationId"`
	Prefix         string    `json:"prefix"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		CreatedAt      respjson.Field
		Description    respjson.Field
		Name           respjson.Field
		OrganizationID respjson.Field
		Prefix         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Team) RawJSON

func (r Team) RawJSON() string

Returns the unmodified JSON received from the API

func (*Team) UnmarshalJSON

func (r *Team) UnmarshalJSON(data []byte) error

type TeamDeleteResponse

type TeamDeleteResponse = any

type TeamGetResponseEnvelope

type TeamGetResponseEnvelope struct {
	Data Team `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TeamGetResponseEnvelope) RawJSON

func (r TeamGetResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*TeamGetResponseEnvelope) UnmarshalJSON

func (r *TeamGetResponseEnvelope) UnmarshalJSON(data []byte) error

type TeamListParams

type TeamListParams struct {
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TeamListParams) URLQuery

func (r TeamListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TeamListParams's query parameters as `url.Values`.

type TeamNewParams

type TeamNewParams struct {
	Name        string            `json:"name" api:"required"`
	Description param.Opt[string] `json:"description,omitzero"`
	Prefix      param.Opt[string] `json:"prefix,omitzero"`
	// contains filtered or unexported fields
}

func (TeamNewParams) MarshalJSON

func (r TeamNewParams) MarshalJSON() (data []byte, err error)

func (*TeamNewParams) UnmarshalJSON

func (r *TeamNewParams) UnmarshalJSON(data []byte) error

type TeamNewResponseEnvelope

type TeamNewResponseEnvelope struct {
	Data Team `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TeamNewResponseEnvelope) RawJSON

func (r TeamNewResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*TeamNewResponseEnvelope) UnmarshalJSON

func (r *TeamNewResponseEnvelope) UnmarshalJSON(data []byte) error

type TeamService

type TeamService struct {
	Options []option.RequestOption
}

TeamService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTeamService method instead.

func NewTeamService

func NewTeamService(opts ...option.RequestOption) (r TeamService)

NewTeamService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TeamService) Delete

func (r *TeamService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *TeamDeleteResponse, err error)

Delete a team.

func (*TeamService) Get

func (r *TeamService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Team, err error)

Get a specific team by ID.

func (*TeamService) List

func (r *TeamService) List(ctx context.Context, query TeamListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Team], err error)

List all teams.

func (*TeamService) ListAutoPaging added in v0.19.0

List all teams.

func (*TeamService) New

func (r *TeamService) New(ctx context.Context, body TeamNewParams, opts ...option.RequestOption) (res *Team, err error)

Create a new team.

func (*TeamService) Update

func (r *TeamService) Update(ctx context.Context, id string, body TeamUpdateParams, opts ...option.RequestOption) (res *Team, err error)

Update an existing team.

type TeamUpdateParams

type TeamUpdateParams struct {
	Description param.Opt[string] `json:"description,omitzero"`
	Name        param.Opt[string] `json:"name,omitzero"`
	Prefix      param.Opt[string] `json:"prefix,omitzero"`
	// contains filtered or unexported fields
}

func (TeamUpdateParams) MarshalJSON

func (r TeamUpdateParams) MarshalJSON() (data []byte, err error)

func (*TeamUpdateParams) UnmarshalJSON

func (r *TeamUpdateParams) UnmarshalJSON(data []byte) error

type TeamUpdateResponseEnvelope

type TeamUpdateResponseEnvelope struct {
	Data Team `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TeamUpdateResponseEnvelope) RawJSON

func (r TeamUpdateResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*TeamUpdateResponseEnvelope) UnmarshalJSON

func (r *TeamUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type TeamUser added in v0.17.0

type TeamUser struct {
	// Composite identifier in the format {team_id}:{user_id}.
	ID string `json:"id"`
	// A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "TEAM_USER_ROLE_UNSPECIFIED", "TEAM_USER_ROLE_AGENT",
	// "TEAM_USER_ROLE_MANAGER", "TEAM_USER_ROLE_BUILDER", "TEAM_USER_ROLE_VIEWER",
	// "TEAM_USER_ROLE_CONTRIBUTOR".
	Role   TeamUserRole `json:"role"`
	TeamID string       `json:"teamId"`
	UserID string       `json:"userId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Role        respjson.Field
		TeamID      respjson.Field
		UserID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TeamUser) RawJSON added in v0.17.0

func (r TeamUser) RawJSON() string

Returns the unmodified JSON received from the API

func (*TeamUser) UnmarshalJSON added in v0.17.0

func (r *TeamUser) UnmarshalJSON(data []byte) error

type TeamUserDeleteParams added in v0.17.0

type TeamUserDeleteParams struct {
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	UserID param.Opt[string] `query:"userId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TeamUserDeleteParams) URLQuery added in v0.22.0

func (r TeamUserDeleteParams) URLQuery() (v url.Values, err error)

URLQuery serializes TeamUserDeleteParams's query parameters as `url.Values`.

type TeamUserDeleteResponse added in v0.17.0

type TeamUserDeleteResponse = any

type TeamUserGetParams added in v0.17.0

type TeamUserGetParams struct {
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	UserID param.Opt[string] `query:"userId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TeamUserGetParams) URLQuery added in v0.22.0

func (r TeamUserGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes TeamUserGetParams's query parameters as `url.Values`.

type TeamUserGetResponseEnvelope added in v0.17.0

type TeamUserGetResponseEnvelope struct {
	Data TeamUser `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TeamUserGetResponseEnvelope) RawJSON added in v0.17.0

func (r TeamUserGetResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*TeamUserGetResponseEnvelope) UnmarshalJSON added in v0.17.0

func (r *TeamUserGetResponseEnvelope) UnmarshalJSON(data []byte) error

type TeamUserListParams added in v0.17.0

type TeamUserListParams struct {
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// Filter by team ID. Required when using /v2/teams/{team_id}/users path.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// Filter by user ID. If not provided, returns all users in the team.
	UserID param.Opt[string] `query:"userId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TeamUserListParams) URLQuery added in v0.17.0

func (r TeamUserListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TeamUserListParams's query parameters as `url.Values`.

type TeamUserNewParams added in v0.17.0

type TeamUserNewParams struct {
	// Any of "TEAM_USER_ROLE_UNSPECIFIED", "TEAM_USER_ROLE_AGENT",
	// "TEAM_USER_ROLE_MANAGER", "TEAM_USER_ROLE_BUILDER", "TEAM_USER_ROLE_VIEWER",
	// "TEAM_USER_ROLE_CONTRIBUTOR".
	Role   TeamUserNewParamsRole `json:"role,omitzero" api:"required"`
	TeamID string                `json:"teamId" api:"required"`
	UserID string                `json:"userId" api:"required"`
	// contains filtered or unexported fields
}

func (TeamUserNewParams) MarshalJSON added in v0.17.0

func (r TeamUserNewParams) MarshalJSON() (data []byte, err error)

func (*TeamUserNewParams) UnmarshalJSON added in v0.17.0

func (r *TeamUserNewParams) UnmarshalJSON(data []byte) error

type TeamUserNewParamsRole added in v0.17.0

type TeamUserNewParamsRole string
const (
	TeamUserNewParamsRoleTeamUserRoleUnspecified TeamUserNewParamsRole = "TEAM_USER_ROLE_UNSPECIFIED"
	TeamUserNewParamsRoleTeamUserRoleAgent       TeamUserNewParamsRole = "TEAM_USER_ROLE_AGENT"
	TeamUserNewParamsRoleTeamUserRoleManager     TeamUserNewParamsRole = "TEAM_USER_ROLE_MANAGER"
	TeamUserNewParamsRoleTeamUserRoleBuilder     TeamUserNewParamsRole = "TEAM_USER_ROLE_BUILDER"
	TeamUserNewParamsRoleTeamUserRoleViewer      TeamUserNewParamsRole = "TEAM_USER_ROLE_VIEWER"
	TeamUserNewParamsRoleTeamUserRoleContributor TeamUserNewParamsRole = "TEAM_USER_ROLE_CONTRIBUTOR"
)

type TeamUserNewResponseEnvelope added in v0.17.0

type TeamUserNewResponseEnvelope struct {
	Data TeamUser `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TeamUserNewResponseEnvelope) RawJSON added in v0.17.0

func (r TeamUserNewResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*TeamUserNewResponseEnvelope) UnmarshalJSON added in v0.17.0

func (r *TeamUserNewResponseEnvelope) UnmarshalJSON(data []byte) error

type TeamUserRole added in v0.17.0

type TeamUserRole string
const (
	TeamUserRoleTeamUserRoleUnspecified TeamUserRole = "TEAM_USER_ROLE_UNSPECIFIED"
	TeamUserRoleTeamUserRoleAgent       TeamUserRole = "TEAM_USER_ROLE_AGENT"
	TeamUserRoleTeamUserRoleManager     TeamUserRole = "TEAM_USER_ROLE_MANAGER"
	TeamUserRoleTeamUserRoleBuilder     TeamUserRole = "TEAM_USER_ROLE_BUILDER"
	TeamUserRoleTeamUserRoleViewer      TeamUserRole = "TEAM_USER_ROLE_VIEWER"
	TeamUserRoleTeamUserRoleContributor TeamUserRole = "TEAM_USER_ROLE_CONTRIBUTOR"
)

type TeamUserService added in v0.17.0

type TeamUserService struct {
	Options []option.RequestOption
}

TeamUserService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTeamUserService method instead.

func NewTeamUserService added in v0.17.0

func NewTeamUserService(opts ...option.RequestOption) (r TeamUserService)

NewTeamUserService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TeamUserService) Delete added in v0.17.0

Remove a user from a team.

func (*TeamUserService) Get added in v0.17.0

func (r *TeamUserService) Get(ctx context.Context, id string, query TeamUserGetParams, opts ...option.RequestOption) (res *TeamUser, err error)

Get a specific team user by team ID and user ID, or by composite ID.

func (*TeamUserService) List added in v0.17.0

List team users. Filter by team_id and/or user_id.

func (*TeamUserService) ListAutoPaging added in v0.19.0

List team users. Filter by team_id and/or user_id.

func (*TeamUserService) New added in v0.17.0

func (r *TeamUserService) New(ctx context.Context, body TeamUserNewParams, opts ...option.RequestOption) (res *TeamUser, err error)

Add a user to a team with a specified role.

func (*TeamUserService) Update added in v0.17.0

func (r *TeamUserService) Update(ctx context.Context, id string, body TeamUserUpdateParams, opts ...option.RequestOption) (res *TeamUser, err error)

Update a team user's role.

type TeamUserUpdateParams added in v0.17.0

type TeamUserUpdateParams struct {
	// Any of "TEAM_USER_ROLE_UNSPECIFIED", "TEAM_USER_ROLE_AGENT",
	// "TEAM_USER_ROLE_MANAGER", "TEAM_USER_ROLE_BUILDER", "TEAM_USER_ROLE_VIEWER",
	// "TEAM_USER_ROLE_CONTRIBUTOR".
	Role   TeamUserUpdateParamsRole `json:"role,omitzero" api:"required"`
	TeamID param.Opt[string]        `json:"teamId,omitzero"`
	UserID param.Opt[string]        `json:"userId,omitzero"`
	// contains filtered or unexported fields
}

func (TeamUserUpdateParams) MarshalJSON added in v0.17.0

func (r TeamUserUpdateParams) MarshalJSON() (data []byte, err error)

func (*TeamUserUpdateParams) UnmarshalJSON added in v0.17.0

func (r *TeamUserUpdateParams) UnmarshalJSON(data []byte) error

type TeamUserUpdateParamsRole added in v0.17.0

type TeamUserUpdateParamsRole string
const (
	TeamUserUpdateParamsRoleTeamUserRoleUnspecified TeamUserUpdateParamsRole = "TEAM_USER_ROLE_UNSPECIFIED"
	TeamUserUpdateParamsRoleTeamUserRoleAgent       TeamUserUpdateParamsRole = "TEAM_USER_ROLE_AGENT"
	TeamUserUpdateParamsRoleTeamUserRoleManager     TeamUserUpdateParamsRole = "TEAM_USER_ROLE_MANAGER"
	TeamUserUpdateParamsRoleTeamUserRoleBuilder     TeamUserUpdateParamsRole = "TEAM_USER_ROLE_BUILDER"
	TeamUserUpdateParamsRoleTeamUserRoleViewer      TeamUserUpdateParamsRole = "TEAM_USER_ROLE_VIEWER"
	TeamUserUpdateParamsRoleTeamUserRoleContributor TeamUserUpdateParamsRole = "TEAM_USER_ROLE_CONTRIBUTOR"
)

type TeamUserUpdateResponseEnvelope added in v0.17.0

type TeamUserUpdateResponseEnvelope struct {
	Data TeamUser `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TeamUserUpdateResponseEnvelope) RawJSON added in v0.17.0

Returns the unmodified JSON received from the API

func (*TeamUserUpdateResponseEnvelope) UnmarshalJSON added in v0.17.0

func (r *TeamUserUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type User

type User struct {
	ID string `json:"id"`
	// Specifies the authentication method for a user. If unset, the org default
	// applies. Set to MAGIC_LINK to allow the user to bypass SSO (e.g. guest or
	// break-glass accounts).
	//
	// Any of "USER_AUTH_METHOD_UNSPECIFIED", "USER_AUTH_METHOD_MAGIC_LINK".
	AuthMethod UserAuthMethod `json:"authMethod" api:"nullable"`
	AvatarURL  string         `json:"avatarUrl" api:"nullable"`
	// A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
	DeactivatedAt time.Time `json:"deactivatedAt" api:"nullable" format:"date-time"`
	Email         string    `json:"email"`
	FirstName     string    `json:"firstName"`
	LastName      string    `json:"lastName"`
	Name          string    `json:"name"`
	// Any of "USER_ROLE_UNSPECIFIED", "USER_ROLE_ORG_MEMBER", "USER_ROLE_ORG_ADMIN",
	// "USER_ROLE_ORG_GUEST".
	Role UserRole `json:"role"`
	// IANA timezone, e.g., "America/New_York"
	Timezone string `json:"timezone" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		AuthMethod    respjson.Field
		AvatarURL     respjson.Field
		CreatedAt     respjson.Field
		DeactivatedAt respjson.Field
		Email         respjson.Field
		FirstName     respjson.Field
		LastName      respjson.Field
		Name          respjson.Field
		Role          respjson.Field
		Timezone      respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (User) RawJSON

func (r User) RawJSON() string

Returns the unmodified JSON received from the API

func (*User) UnmarshalJSON

func (r *User) UnmarshalJSON(data []byte) error

type UserAuthMethod added in v0.22.0

type UserAuthMethod string

Specifies the authentication method for a user. If unset, the org default applies. Set to MAGIC_LINK to allow the user to bypass SSO (e.g. guest or break-glass accounts).

const (
	UserAuthMethodUserAuthMethodUnspecified UserAuthMethod = "USER_AUTH_METHOD_UNSPECIFIED"
	UserAuthMethodUserAuthMethodMagicLink   UserAuthMethod = "USER_AUTH_METHOD_MAGIC_LINK"
)

type UserDeleteResponse

type UserDeleteResponse = any

type UserGetResponseEnvelope

type UserGetResponseEnvelope struct {
	Data User `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UserGetResponseEnvelope) RawJSON

func (r UserGetResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*UserGetResponseEnvelope) UnmarshalJSON

func (r *UserGetResponseEnvelope) UnmarshalJSON(data []byte) error

type UserListParams

type UserListParams struct {
	// Whether to include deactivated users in the response.
	IncludeDeactivated param.Opt[bool] `query:"includeDeactivated,omitzero" json:"-"`
	// Maximum number of results to return. Default is 10000, maximum is 10000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (UserListParams) URLQuery

func (r UserListParams) URLQuery() (v url.Values, err error)

URLQuery serializes UserListParams's query parameters as `url.Values`.

type UserNewParams

type UserNewParams struct {
	Email     string            `json:"email" api:"required"`
	FirstName param.Opt[string] `json:"firstName,omitzero"`
	LastName  param.Opt[string] `json:"lastName,omitzero"`
	// Specifies the authentication method for a user. If unset, the org default
	// applies. Set to MAGIC_LINK to allow the user to bypass SSO (e.g. guest or
	// break-glass accounts).
	//
	// Any of "USER_AUTH_METHOD_UNSPECIFIED", "USER_AUTH_METHOD_MAGIC_LINK".
	AuthMethod UserNewParamsAuthMethod `json:"authMethod,omitzero"`
	// Any of "USER_ROLE_UNSPECIFIED", "USER_ROLE_ORG_MEMBER", "USER_ROLE_ORG_ADMIN",
	// "USER_ROLE_ORG_GUEST".
	Role UserNewParamsRole `json:"role,omitzero"`
	// contains filtered or unexported fields
}

func (UserNewParams) MarshalJSON

func (r UserNewParams) MarshalJSON() (data []byte, err error)

func (*UserNewParams) UnmarshalJSON

func (r *UserNewParams) UnmarshalJSON(data []byte) error

type UserNewParamsAuthMethod added in v0.22.0

type UserNewParamsAuthMethod string

Specifies the authentication method for a user. If unset, the org default applies. Set to MAGIC_LINK to allow the user to bypass SSO (e.g. guest or break-glass accounts).

const (
	UserNewParamsAuthMethodUserAuthMethodUnspecified UserNewParamsAuthMethod = "USER_AUTH_METHOD_UNSPECIFIED"
	UserNewParamsAuthMethodUserAuthMethodMagicLink   UserNewParamsAuthMethod = "USER_AUTH_METHOD_MAGIC_LINK"
)

type UserNewParamsRole

type UserNewParamsRole string
const (
	UserNewParamsRoleUserRoleUnspecified UserNewParamsRole = "USER_ROLE_UNSPECIFIED"
	UserNewParamsRoleUserRoleOrgMember   UserNewParamsRole = "USER_ROLE_ORG_MEMBER"
	UserNewParamsRoleUserRoleOrgAdmin    UserNewParamsRole = "USER_ROLE_ORG_ADMIN"
	UserNewParamsRoleUserRoleOrgGuest    UserNewParamsRole = "USER_ROLE_ORG_GUEST"
)

type UserNewResponseEnvelope

type UserNewResponseEnvelope struct {
	Data User `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UserNewResponseEnvelope) RawJSON

func (r UserNewResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*UserNewResponseEnvelope) UnmarshalJSON

func (r *UserNewResponseEnvelope) UnmarshalJSON(data []byte) error

type UserRole

type UserRole string
const (
	UserRoleUserRoleUnspecified UserRole = "USER_ROLE_UNSPECIFIED"
	UserRoleUserRoleOrgMember   UserRole = "USER_ROLE_ORG_MEMBER"
	UserRoleUserRoleOrgAdmin    UserRole = "USER_ROLE_ORG_ADMIN"
	UserRoleUserRoleOrgGuest    UserRole = "USER_ROLE_ORG_GUEST"
)

type UserService

type UserService struct {
	Options []option.RequestOption
}

UserService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUserService method instead.

func NewUserService

func NewUserService(opts ...option.RequestOption) (r UserService)

NewUserService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*UserService) Delete

func (r *UserService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *UserDeleteResponse, err error)

Delete a user.

func (*UserService) Get

func (r *UserService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *User, err error)

Get a specific user by ID.

func (*UserService) List

func (r *UserService) List(ctx context.Context, query UserListParams, opts ...option.RequestOption) (res *pagination.CursorPage[User], err error)

List all users.

func (*UserService) ListAutoPaging added in v0.19.0

List all users.

func (*UserService) New

func (r *UserService) New(ctx context.Context, body UserNewParams, opts ...option.RequestOption) (res *User, err error)

Create a new user.

func (*UserService) Update

func (r *UserService) Update(ctx context.Context, id string, body UserUpdateParams, opts ...option.RequestOption) (res *User, err error)

Update an existing user.

type UserUpdateParams

type UserUpdateParams struct {
	AvatarURL param.Opt[string] `json:"avatarUrl,omitzero"`
	Email     param.Opt[string] `json:"email,omitzero"`
	FirstName param.Opt[string] `json:"firstName,omitzero"`
	LastName  param.Opt[string] `json:"lastName,omitzero"`
	// Specifies the authentication method for a user. If unset, the org default
	// applies. Set to MAGIC_LINK to allow the user to bypass SSO (e.g. guest or
	// break-glass accounts).
	//
	// Any of "USER_AUTH_METHOD_UNSPECIFIED", "USER_AUTH_METHOD_MAGIC_LINK".
	AuthMethod UserUpdateParamsAuthMethod `json:"authMethod,omitzero"`
	// Any of "USER_ROLE_UNSPECIFIED", "USER_ROLE_ORG_MEMBER", "USER_ROLE_ORG_ADMIN",
	// "USER_ROLE_ORG_GUEST".
	Role UserUpdateParamsRole `json:"role,omitzero"`
	// contains filtered or unexported fields
}

func (UserUpdateParams) MarshalJSON

func (r UserUpdateParams) MarshalJSON() (data []byte, err error)

func (*UserUpdateParams) UnmarshalJSON

func (r *UserUpdateParams) UnmarshalJSON(data []byte) error

type UserUpdateParamsAuthMethod added in v0.22.0

type UserUpdateParamsAuthMethod string

Specifies the authentication method for a user. If unset, the org default applies. Set to MAGIC_LINK to allow the user to bypass SSO (e.g. guest or break-glass accounts).

const (
	UserUpdateParamsAuthMethodUserAuthMethodUnspecified UserUpdateParamsAuthMethod = "USER_AUTH_METHOD_UNSPECIFIED"
	UserUpdateParamsAuthMethodUserAuthMethodMagicLink   UserUpdateParamsAuthMethod = "USER_AUTH_METHOD_MAGIC_LINK"
)

type UserUpdateParamsRole

type UserUpdateParamsRole string
const (
	UserUpdateParamsRoleUserRoleUnspecified UserUpdateParamsRole = "USER_ROLE_UNSPECIFIED"
	UserUpdateParamsRoleUserRoleOrgMember   UserUpdateParamsRole = "USER_ROLE_ORG_MEMBER"
	UserUpdateParamsRoleUserRoleOrgAdmin    UserUpdateParamsRole = "USER_ROLE_ORG_ADMIN"
	UserUpdateParamsRoleUserRoleOrgGuest    UserUpdateParamsRole = "USER_ROLE_ORG_GUEST"
)

type UserUpdateResponseEnvelope

type UserUpdateResponseEnvelope struct {
	Data User `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UserUpdateResponseEnvelope) RawJSON

func (r UserUpdateResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*UserUpdateResponseEnvelope) UnmarshalJSON

func (r *UserUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

type Workflow

type Workflow struct {
	// The ID of the workflow.
	ID string `json:"id"`
	// The content/code of the workflow.
	Content string `json:"content"`
	// A description of the workflow.
	Description string `json:"description"`
	// The execution scope of the workflow.
	//
	// Any of "WORKFLOW_EXECUTION_SCOPE_UNSPECIFIED", "TEAM_PRIVATE", "TEAM_PUBLIC".
	ExecutionScope WorkflowExecutionScope `json:"executionScope"`
	// Whether there are unpublished changes to the workflow (computed by server).
	HasUnpublishedChanges bool `json:"hasUnpublishedChanges"`
	// Whether the workflow is published. Set to true to publish the workflow.
	IsPublished bool `json:"isPublished"`
	// The name of the workflow.
	Name string `json:"name"`
	// Whether the workflow requires form confirmation.
	RequireFormConfirmation bool `json:"requireFormConfirmation"`
	// IDs of tags associated with this workflow.
	TagIDs []string `json:"tagIds"`
	// The ID of the team that the workflow belongs to.
	TeamID string `json:"teamId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                      respjson.Field
		Content                 respjson.Field
		Description             respjson.Field
		ExecutionScope          respjson.Field
		HasUnpublishedChanges   respjson.Field
		IsPublished             respjson.Field
		Name                    respjson.Field
		RequireFormConfirmation respjson.Field
		TagIDs                  respjson.Field
		TeamID                  respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Workflow) RawJSON

func (r Workflow) RawJSON() string

Returns the unmodified JSON received from the API

func (*Workflow) UnmarshalJSON

func (r *Workflow) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedure

type WorkflowApprovalProcedure struct {
	// The ID of the workflow approval procedure.
	ID string `json:"id"`
	// The steps in the approval procedure.
	Steps []WorkflowApprovalProcedureStep `json:"steps"`
	// The ID of the workflow this approval procedure belongs to.
	WorkflowID string `json:"workflowId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Steps       respjson.Field
		WorkflowID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowApprovalProcedure) RawJSON

func (r WorkflowApprovalProcedure) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedure) UnmarshalJSON

func (r *WorkflowApprovalProcedure) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureDeleteParams

type WorkflowApprovalProcedureDeleteParams struct {
	// The ID of the workflow.
	WorkflowID string `path:"workflow_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type WorkflowApprovalProcedureDeleteResponse

type WorkflowApprovalProcedureDeleteResponse = any

type WorkflowApprovalProcedureGetParams

type WorkflowApprovalProcedureGetParams struct {
	// The ID of the workflow.
	WorkflowID string `path:"workflow_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type WorkflowApprovalProcedureGetResponseEnvelope

type WorkflowApprovalProcedureGetResponseEnvelope struct {
	// The approval procedure.
	Data WorkflowApprovalProcedure `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowApprovalProcedureGetResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureGetResponseEnvelope) UnmarshalJSON

func (r *WorkflowApprovalProcedureGetResponseEnvelope) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureListByTeamParams added in v0.17.0

type WorkflowApprovalProcedureListByTeamParams struct {
	// The ID of the team.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// Maximum number of results to return. Default is 1000, maximum is 1000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WorkflowApprovalProcedureListByTeamParams) URLQuery added in v0.17.0

URLQuery serializes WorkflowApprovalProcedureListByTeamParams's query parameters as `url.Values`.

type WorkflowApprovalProcedureListByTeamResponse added in v0.17.0

type WorkflowApprovalProcedureListByTeamResponse struct {
	// The list of workflow approval procedures for the team.
	Data []WorkflowApprovalProcedure `json:"data"`
	// Token for retrieving the next page of results. Empty if no more results.
	NextPageToken string `json:"nextPageToken,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data          respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowApprovalProcedureListByTeamResponse) RawJSON added in v0.17.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureListByTeamResponse) UnmarshalJSON added in v0.17.0

func (r *WorkflowApprovalProcedureListByTeamResponse) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureListResponseEnvelope

type WorkflowApprovalProcedureListResponseEnvelope struct {
	// The list of approval procedures (typically 0 or 1).
	Data []WorkflowApprovalProcedure `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowApprovalProcedureListResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureListResponseEnvelope) UnmarshalJSON

func (r *WorkflowApprovalProcedureListResponseEnvelope) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureNewParams

type WorkflowApprovalProcedureNewParams struct {
	// The approval steps for the procedure.
	Steps []WorkflowApprovalProcedureNewParamsStep `json:"steps,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowApprovalProcedureNewParams) MarshalJSON

func (r WorkflowApprovalProcedureNewParams) MarshalJSON() (data []byte, err error)

func (*WorkflowApprovalProcedureNewParams) UnmarshalJSON

func (r *WorkflowApprovalProcedureNewParams) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureNewParamsStep

type WorkflowApprovalProcedureNewParamsStep struct {
	// Whether the step can be approved by the requester themselves. optional so server
	// can distinguish "not set" from "explicitly false" (DB defaults to TRUE; proto3
	// defaults bool to false)
	AllowSelfApproval param.Opt[bool] `json:"allowSelfApproval,omitzero"`
	// Configuration for a custom workflow that determines approvers or auto-approves.
	CustomWorkflow WorkflowApprovalProcedureNewParamsStepCustomWorkflow `json:"customWorkflow,omitzero"`
	// Exactly one of approvers or custom_workflow must be set. Mutual exclusivity
	// validated server-side.
	Approvers []WorkflowApprovalProcedureNewParamsStepApproverUnion `json:"approvers,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowApprovalProcedureNewParamsStep) MarshalJSON

func (r WorkflowApprovalProcedureNewParamsStep) MarshalJSON() (data []byte, err error)

func (*WorkflowApprovalProcedureNewParamsStep) UnmarshalJSON

func (r *WorkflowApprovalProcedureNewParamsStep) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureNewParamsStepApproverAppOwner added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverAppOwner struct {
	// App owners as approvers. Only valid for access policy approval procedures.
	AppOwner any `json:"appOwner,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

App owners as approvers. Only valid for access policy approval procedures.

The property AppOwner is required.

func (WorkflowApprovalProcedureNewParamsStepApproverAppOwner) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureNewParamsStepApproverAppOwner) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverGroup added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverGroup struct {
	// A Serval group as approvers.
	Group WorkflowApprovalProcedureNewParamsStepApproverGroupGroup `json:"group,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

A Serval group as approvers.

The property Group is required.

func (WorkflowApprovalProcedureNewParamsStepApproverGroup) MarshalJSON added in v0.20.0

func (r WorkflowApprovalProcedureNewParamsStepApproverGroup) MarshalJSON() (data []byte, err error)

func (*WorkflowApprovalProcedureNewParamsStepApproverGroup) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverGroupGroup added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverGroupGroup struct {
	// The ID of the Serval group.
	GroupID param.Opt[string] `json:"groupId,omitzero"`
	// contains filtered or unexported fields
}

A Serval group as approvers.

func (WorkflowApprovalProcedureNewParamsStepApproverGroupGroup) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureNewParamsStepApproverGroupGroup) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverManager added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverManager struct {
	// The requester's manager as an approver.
	Manager any `json:"manager,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

The requester's manager as an approver.

The property Manager is required.

func (WorkflowApprovalProcedureNewParamsStepApproverManager) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureNewParamsStepApproverManager) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverUnion added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverUnion struct {
	OfAppOwner *WorkflowApprovalProcedureNewParamsStepApproverAppOwner `json:",omitzero,inline"`
	OfGroup    *WorkflowApprovalProcedureNewParamsStepApproverGroup    `json:",omitzero,inline"`
	OfManager  *WorkflowApprovalProcedureNewParamsStepApproverManager  `json:",omitzero,inline"`
	OfUser     *WorkflowApprovalProcedureNewParamsStepApproverUser     `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (WorkflowApprovalProcedureNewParamsStepApproverUnion) GetAppOwner added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureNewParamsStepApproverUnion) GetGroup added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureNewParamsStepApproverUnion) GetManager added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureNewParamsStepApproverUnion) GetNotify added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureNewParamsStepApproverUnion) GetUser added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureNewParamsStepApproverUnion) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureNewParamsStepApproverUnion) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverUser added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverUser struct {
	// A specific user as an approver.
	User WorkflowApprovalProcedureNewParamsStepApproverUserUser `json:"user,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

A specific user as an approver.

The property User is required.

func (WorkflowApprovalProcedureNewParamsStepApproverUser) MarshalJSON added in v0.20.0

func (r WorkflowApprovalProcedureNewParamsStepApproverUser) MarshalJSON() (data []byte, err error)

func (*WorkflowApprovalProcedureNewParamsStepApproverUser) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverUserUser added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepApproverUserUser struct {
	// The ID of the user.
	UserID param.Opt[string] `json:"userId,omitzero"`
	// contains filtered or unexported fields
}

A specific user as an approver.

func (WorkflowApprovalProcedureNewParamsStepApproverUserUser) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureNewParamsStepApproverUserUser) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepCustomWorkflow added in v0.20.0

type WorkflowApprovalProcedureNewParamsStepCustomWorkflow struct {
	// The ID of the workflow to execute.
	WorkflowID param.Opt[string] `json:"workflowId,omitzero"`
	// contains filtered or unexported fields
}

Configuration for a custom workflow that determines approvers or auto-approves.

func (WorkflowApprovalProcedureNewParamsStepCustomWorkflow) MarshalJSON added in v0.20.0

func (r WorkflowApprovalProcedureNewParamsStepCustomWorkflow) MarshalJSON() (data []byte, err error)

func (*WorkflowApprovalProcedureNewParamsStepCustomWorkflow) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureNewResponseEnvelope

type WorkflowApprovalProcedureNewResponseEnvelope struct {
	// The created approval procedure.
	Data WorkflowApprovalProcedure `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowApprovalProcedureNewResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureNewResponseEnvelope) UnmarshalJSON

func (r *WorkflowApprovalProcedureNewResponseEnvelope) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureService

type WorkflowApprovalProcedureService struct {
	Options []option.RequestOption
}

WorkflowApprovalProcedureService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkflowApprovalProcedureService method instead.

func NewWorkflowApprovalProcedureService

func NewWorkflowApprovalProcedureService(opts ...option.RequestOption) (r WorkflowApprovalProcedureService)

NewWorkflowApprovalProcedureService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WorkflowApprovalProcedureService) Delete

Delete an approval procedure for a workflow.

func (*WorkflowApprovalProcedureService) Get

Get a specific approval procedure by ID for a workflow.

func (*WorkflowApprovalProcedureService) List

List all approval procedures for a workflow.

func (*WorkflowApprovalProcedureService) ListByTeam added in v0.17.0

List all workflow approval procedures for a team.

func (*WorkflowApprovalProcedureService) New

Create a new approval procedure for a workflow.

func (*WorkflowApprovalProcedureService) Update

Update an existing approval procedure for a workflow.

type WorkflowApprovalProcedureStep

type WorkflowApprovalProcedureStep struct {
	// The ID of the approval step.
	ID string `json:"id"`
	// Whether the step can be approved by the requester themselves. optional so server
	// can distinguish "not set" from "explicitly false" (DB defaults to TRUE; proto3
	// defaults bool to false)
	AllowSelfApproval bool `json:"allowSelfApproval" api:"nullable"`
	// Exactly one of approvers or custom_workflow must be set. Mutual exclusivity
	// validated server-side.
	Approvers []WorkflowApprovalProcedureStepApproverUnion `json:"approvers"`
	// Configuration for a custom workflow that determines approvers or auto-approves.
	CustomWorkflow WorkflowApprovalProcedureStepCustomWorkflow `json:"customWorkflow" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		AllowSelfApproval respjson.Field
		Approvers         respjson.Field
		CustomWorkflow    respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowApprovalProcedureStep) RawJSON

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStep) UnmarshalJSON

func (r *WorkflowApprovalProcedureStep) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureStepApproverAppOwner added in v0.20.0

type WorkflowApprovalProcedureStepApproverAppOwner struct {
	// App owners as approvers. Only valid for access policy approval procedures.
	AppOwner any `json:"appOwner" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify bool `json:"notify"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AppOwner    respjson.Field
		Notify      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

App owners as approvers. Only valid for access policy approval procedures.

func (WorkflowApprovalProcedureStepApproverAppOwner) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStepApproverAppOwner) UnmarshalJSON added in v0.20.0

func (r *WorkflowApprovalProcedureStepApproverAppOwner) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureStepApproverGroup added in v0.20.0

type WorkflowApprovalProcedureStepApproverGroup struct {
	// A Serval group as approvers.
	Group WorkflowApprovalProcedureStepApproverGroupGroup `json:"group" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify bool `json:"notify"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Group       respjson.Field
		Notify      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Serval group as approvers.

func (WorkflowApprovalProcedureStepApproverGroup) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStepApproverGroup) UnmarshalJSON added in v0.20.0

func (r *WorkflowApprovalProcedureStepApproverGroup) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureStepApproverGroupGroup added in v0.20.0

type WorkflowApprovalProcedureStepApproverGroupGroup struct {
	// The ID of the Serval group.
	GroupID string `json:"groupId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GroupID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Serval group as approvers.

func (WorkflowApprovalProcedureStepApproverGroupGroup) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStepApproverGroupGroup) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureStepApproverManager added in v0.20.0

type WorkflowApprovalProcedureStepApproverManager struct {
	// The requester's manager as an approver.
	Manager any `json:"manager" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify bool `json:"notify"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Manager     respjson.Field
		Notify      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The requester's manager as an approver.

func (WorkflowApprovalProcedureStepApproverManager) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStepApproverManager) UnmarshalJSON added in v0.20.0

func (r *WorkflowApprovalProcedureStepApproverManager) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureStepApproverUnion added in v0.20.0

type WorkflowApprovalProcedureStepApproverUnion struct {
	// This field is from variant [WorkflowApprovalProcedureStepApproverAppOwner].
	AppOwner any  `json:"appOwner"`
	Notify   bool `json:"notify"`
	// This field is from variant [WorkflowApprovalProcedureStepApproverGroup].
	Group WorkflowApprovalProcedureStepApproverGroupGroup `json:"group"`
	// This field is from variant [WorkflowApprovalProcedureStepApproverManager].
	Manager any `json:"manager"`
	// This field is from variant [WorkflowApprovalProcedureStepApproverUser].
	User WorkflowApprovalProcedureStepApproverUserUser `json:"user"`
	JSON struct {
		AppOwner respjson.Field
		Notify   respjson.Field
		Group    respjson.Field
		Manager  respjson.Field
		User     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

WorkflowApprovalProcedureStepApproverUnion contains all possible properties and values from WorkflowApprovalProcedureStepApproverAppOwner, WorkflowApprovalProcedureStepApproverGroup, WorkflowApprovalProcedureStepApproverManager, WorkflowApprovalProcedureStepApproverUser.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (WorkflowApprovalProcedureStepApproverUnion) AsAppOwner added in v0.20.0

func (WorkflowApprovalProcedureStepApproverUnion) AsGroup added in v0.20.0

func (WorkflowApprovalProcedureStepApproverUnion) AsManager added in v0.20.0

func (WorkflowApprovalProcedureStepApproverUnion) AsUser added in v0.20.0

func (WorkflowApprovalProcedureStepApproverUnion) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStepApproverUnion) UnmarshalJSON added in v0.20.0

func (r *WorkflowApprovalProcedureStepApproverUnion) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureStepApproverUser added in v0.20.0

type WorkflowApprovalProcedureStepApproverUser struct {
	// A specific user as an approver.
	User WorkflowApprovalProcedureStepApproverUserUser `json:"user" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify bool `json:"notify"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		User        respjson.Field
		Notify      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A specific user as an approver.

func (WorkflowApprovalProcedureStepApproverUser) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStepApproverUser) UnmarshalJSON added in v0.20.0

func (r *WorkflowApprovalProcedureStepApproverUser) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureStepApproverUserUser added in v0.20.0

type WorkflowApprovalProcedureStepApproverUserUser struct {
	// The ID of the user.
	UserID string `json:"userId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		UserID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A specific user as an approver.

func (WorkflowApprovalProcedureStepApproverUserUser) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStepApproverUserUser) UnmarshalJSON added in v0.20.0

func (r *WorkflowApprovalProcedureStepApproverUserUser) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureStepCustomWorkflow added in v0.20.0

type WorkflowApprovalProcedureStepCustomWorkflow struct {
	// The ID of the workflow to execute.
	WorkflowID string `json:"workflowId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		WorkflowID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a custom workflow that determines approvers or auto-approves.

func (WorkflowApprovalProcedureStepCustomWorkflow) RawJSON added in v0.20.0

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureStepCustomWorkflow) UnmarshalJSON added in v0.20.0

func (r *WorkflowApprovalProcedureStepCustomWorkflow) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureUpdateParams

type WorkflowApprovalProcedureUpdateParams struct {
	// The ID of the workflow.
	WorkflowID string `path:"workflow_id" api:"required" json:"-"`
	// The approval steps for the procedure.
	Steps []WorkflowApprovalProcedureUpdateParamsStep `json:"steps,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowApprovalProcedureUpdateParams) MarshalJSON

func (r WorkflowApprovalProcedureUpdateParams) MarshalJSON() (data []byte, err error)

func (*WorkflowApprovalProcedureUpdateParams) UnmarshalJSON

func (r *WorkflowApprovalProcedureUpdateParams) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureUpdateParamsStep

type WorkflowApprovalProcedureUpdateParamsStep struct {
	// Whether the step can be approved by the requester themselves. optional so server
	// can distinguish "not set" from "explicitly false" (DB defaults to TRUE; proto3
	// defaults bool to false)
	AllowSelfApproval param.Opt[bool] `json:"allowSelfApproval,omitzero"`
	// Configuration for a custom workflow that determines approvers or auto-approves.
	CustomWorkflow WorkflowApprovalProcedureUpdateParamsStepCustomWorkflow `json:"customWorkflow,omitzero"`
	// Exactly one of approvers or custom_workflow must be set. Mutual exclusivity
	// validated server-side.
	Approvers []WorkflowApprovalProcedureUpdateParamsStepApproverUnion `json:"approvers,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowApprovalProcedureUpdateParamsStep) MarshalJSON

func (r WorkflowApprovalProcedureUpdateParamsStep) MarshalJSON() (data []byte, err error)

func (*WorkflowApprovalProcedureUpdateParamsStep) UnmarshalJSON

func (r *WorkflowApprovalProcedureUpdateParamsStep) UnmarshalJSON(data []byte) error

type WorkflowApprovalProcedureUpdateParamsStepApproverAppOwner added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverAppOwner struct {
	// App owners as approvers. Only valid for access policy approval procedures.
	AppOwner any `json:"appOwner,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

App owners as approvers. Only valid for access policy approval procedures.

The property AppOwner is required.

func (WorkflowApprovalProcedureUpdateParamsStepApproverAppOwner) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureUpdateParamsStepApproverAppOwner) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverGroup added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverGroup struct {
	// A Serval group as approvers.
	Group WorkflowApprovalProcedureUpdateParamsStepApproverGroupGroup `json:"group,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

A Serval group as approvers.

The property Group is required.

func (WorkflowApprovalProcedureUpdateParamsStepApproverGroup) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureUpdateParamsStepApproverGroup) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverGroupGroup added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverGroupGroup struct {
	// The ID of the Serval group.
	GroupID param.Opt[string] `json:"groupId,omitzero"`
	// contains filtered or unexported fields
}

A Serval group as approvers.

func (WorkflowApprovalProcedureUpdateParamsStepApproverGroupGroup) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureUpdateParamsStepApproverGroupGroup) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverManager added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverManager struct {
	// The requester's manager as an approver.
	Manager any `json:"manager,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

The requester's manager as an approver.

The property Manager is required.

func (WorkflowApprovalProcedureUpdateParamsStepApproverManager) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureUpdateParamsStepApproverManager) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverUnion added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverUnion struct {
	OfAppOwner *WorkflowApprovalProcedureUpdateParamsStepApproverAppOwner `json:",omitzero,inline"`
	OfGroup    *WorkflowApprovalProcedureUpdateParamsStepApproverGroup    `json:",omitzero,inline"`
	OfManager  *WorkflowApprovalProcedureUpdateParamsStepApproverManager  `json:",omitzero,inline"`
	OfUser     *WorkflowApprovalProcedureUpdateParamsStepApproverUser     `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (WorkflowApprovalProcedureUpdateParamsStepApproverUnion) GetAppOwner added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureUpdateParamsStepApproverUnion) GetGroup added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureUpdateParamsStepApproverUnion) GetManager added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureUpdateParamsStepApproverUnion) GetNotify added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureUpdateParamsStepApproverUnion) GetUser added in v0.20.0

Returns a pointer to the underlying variant's property, if present.

func (WorkflowApprovalProcedureUpdateParamsStepApproverUnion) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureUpdateParamsStepApproverUnion) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverUser added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverUser struct {
	// A specific user as an approver.
	User WorkflowApprovalProcedureUpdateParamsStepApproverUserUser `json:"user,omitzero" api:"required"`
	// Whether to notify this approver when the step is pending.
	Notify param.Opt[bool] `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

A specific user as an approver.

The property User is required.

func (WorkflowApprovalProcedureUpdateParamsStepApproverUser) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureUpdateParamsStepApproverUser) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverUserUser added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepApproverUserUser struct {
	// The ID of the user.
	UserID param.Opt[string] `json:"userId,omitzero"`
	// contains filtered or unexported fields
}

A specific user as an approver.

func (WorkflowApprovalProcedureUpdateParamsStepApproverUserUser) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureUpdateParamsStepApproverUserUser) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepCustomWorkflow added in v0.20.0

type WorkflowApprovalProcedureUpdateParamsStepCustomWorkflow struct {
	// The ID of the workflow to execute.
	WorkflowID param.Opt[string] `json:"workflowId,omitzero"`
	// contains filtered or unexported fields
}

Configuration for a custom workflow that determines approvers or auto-approves.

func (WorkflowApprovalProcedureUpdateParamsStepCustomWorkflow) MarshalJSON added in v0.20.0

func (*WorkflowApprovalProcedureUpdateParamsStepCustomWorkflow) UnmarshalJSON added in v0.20.0

type WorkflowApprovalProcedureUpdateResponseEnvelope

type WorkflowApprovalProcedureUpdateResponseEnvelope struct {
	// The updated approval procedure.
	Data WorkflowApprovalProcedure `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowApprovalProcedureUpdateResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*WorkflowApprovalProcedureUpdateResponseEnvelope) UnmarshalJSON

type WorkflowDeleteResponse

type WorkflowDeleteResponse = any

type WorkflowExecutionScope

type WorkflowExecutionScope string

The execution scope of the workflow.

const (
	WorkflowExecutionScopeWorkflowExecutionScopeUnspecified WorkflowExecutionScope = "WORKFLOW_EXECUTION_SCOPE_UNSPECIFIED"
	WorkflowExecutionScopeTeamPrivate                       WorkflowExecutionScope = "TEAM_PRIVATE"
	WorkflowExecutionScopeTeamPublic                        WorkflowExecutionScope = "TEAM_PUBLIC"
)

type WorkflowGetResponseEnvelope

type WorkflowGetResponseEnvelope struct {
	// The workflow.
	Data Workflow `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowGetResponseEnvelope) RawJSON

func (r WorkflowGetResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowGetResponseEnvelope) UnmarshalJSON

func (r *WorkflowGetResponseEnvelope) UnmarshalJSON(data []byte) error

type WorkflowListParams

type WorkflowListParams struct {
	// Maximum number of results to return. Default is 1000, maximum is 2000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// The ID of the team.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WorkflowListParams) URLQuery

func (r WorkflowListParams) URLQuery() (v url.Values, err error)

URLQuery serializes WorkflowListParams's query parameters as `url.Values`.

type WorkflowNewParams

type WorkflowNewParams struct {
	// The content/code of the workflow.
	Content string `json:"content" api:"required"`
	// The name of the workflow.
	Name string `json:"name" api:"required"`
	// The ID of the team.
	TeamID string `json:"teamId" api:"required"`
	// Whether to publish the workflow after creation (optional).
	IsPublished param.Opt[bool] `json:"isPublished,omitzero"`
	// Whether the workflow requires form confirmation (optional).
	RequireFormConfirmation param.Opt[bool] `json:"requireFormConfirmation,omitzero"`
	// A description of the workflow.
	Description param.Opt[string] `json:"description,omitzero"`
	// The execution scope of the workflow.
	//
	// Any of "WORKFLOW_EXECUTION_SCOPE_UNSPECIFIED", "TEAM_PRIVATE", "TEAM_PUBLIC".
	ExecutionScope WorkflowNewParamsExecutionScope `json:"executionScope,omitzero"`
	// The IDs of the tags to associate with the workflow.
	TagIDs []string `json:"tagIds,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowNewParams) MarshalJSON

func (r WorkflowNewParams) MarshalJSON() (data []byte, err error)

func (*WorkflowNewParams) UnmarshalJSON

func (r *WorkflowNewParams) UnmarshalJSON(data []byte) error

type WorkflowNewParamsExecutionScope

type WorkflowNewParamsExecutionScope string

The execution scope of the workflow.

const (
	WorkflowNewParamsExecutionScopeWorkflowExecutionScopeUnspecified WorkflowNewParamsExecutionScope = "WORKFLOW_EXECUTION_SCOPE_UNSPECIFIED"
	WorkflowNewParamsExecutionScopeTeamPrivate                       WorkflowNewParamsExecutionScope = "TEAM_PRIVATE"
	WorkflowNewParamsExecutionScopeTeamPublic                        WorkflowNewParamsExecutionScope = "TEAM_PUBLIC"
)

type WorkflowNewResponseEnvelope

type WorkflowNewResponseEnvelope struct {
	// The created workflow.
	Data Workflow `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowNewResponseEnvelope) RawJSON

func (r WorkflowNewResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowNewResponseEnvelope) UnmarshalJSON

func (r *WorkflowNewResponseEnvelope) UnmarshalJSON(data []byte) error

type WorkflowRun added in v0.17.0

type WorkflowRun struct {
	// The unique ID of the workflow run.
	ID string `json:"id"`
	// The ID of the approval request associated with this workflow run, if any.
	ApprovalRequestID string `json:"approvalRequestId" api:"nullable"`
	// The timestamp when the workflow run completed (if applicable).
	CompletedAt string `json:"completedAt" api:"nullable"`
	// The timestamp when the workflow run was created.
	CreatedAt string `json:"createdAt"`
	// The ID of the user who initiated the workflow run.
	InitiatedByUserID string `json:"initiatedByUserId"`
	// The inputs provided to the workflow (JSON string).
	Inputs string `json:"inputs" api:"nullable"`
	// The ID of the linked ticket, if any.
	LinkedTicketID string `json:"linkedTicketId" api:"nullable"`
	// The output of the workflow run (JSON string, available when completed or
	// failed).
	Output string `json:"output" api:"nullable"`
	// The status of the workflow run.
	//
	// Any of "WORKFLOW_RUN_STATUS_UNSPECIFIED", "WORKFLOW_RUN_STATUS_PENDING",
	// "WORKFLOW_RUN_STATUS_RUNNING", "WORKFLOW_RUN_STATUS_COMPLETED",
	// "WORKFLOW_RUN_STATUS_FAILED", "WORKFLOW_RUN_STATUS_DENIED",
	// "WORKFLOW_RUN_STATUS_CANCELED".
	Status WorkflowRunStatus `json:"status"`
	// The ID of the target user for the workflow run (if different from initiator).
	TargetUserID string `json:"targetUserId" api:"nullable"`
	// The ID of the team that the workflow belongs to.
	TeamID string `json:"teamId"`
	// The ID of the workflow that was run.
	WorkflowID string `json:"workflowId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		ApprovalRequestID respjson.Field
		CompletedAt       respjson.Field
		CreatedAt         respjson.Field
		InitiatedByUserID respjson.Field
		Inputs            respjson.Field
		LinkedTicketID    respjson.Field
		Output            respjson.Field
		Status            respjson.Field
		TargetUserID      respjson.Field
		TeamID            respjson.Field
		WorkflowID        respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

WorkflowRun represents a single execution of a workflow.

func (WorkflowRun) RawJSON added in v0.17.0

func (r WorkflowRun) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowRun) UnmarshalJSON added in v0.17.0

func (r *WorkflowRun) UnmarshalJSON(data []byte) error

type WorkflowRunGetResponseEnvelope added in v0.17.0

type WorkflowRunGetResponseEnvelope struct {
	// The workflow run.
	Data WorkflowRun `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowRunGetResponseEnvelope) RawJSON added in v0.17.0

Returns the unmodified JSON received from the API

func (*WorkflowRunGetResponseEnvelope) UnmarshalJSON added in v0.17.0

func (r *WorkflowRunGetResponseEnvelope) UnmarshalJSON(data []byte) error

type WorkflowRunListParams added in v0.17.0

type WorkflowRunListParams struct {
	// Maximum number of results to return. Default is 1000, maximum is 5000.
	PageSize param.Opt[int64] `query:"pageSize,omitzero" json:"-"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `query:"pageToken,omitzero" json:"-"`
	// The ID of the team. Required.
	TeamID param.Opt[string] `query:"teamId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WorkflowRunListParams) URLQuery added in v0.17.0

func (r WorkflowRunListParams) URLQuery() (v url.Values, err error)

URLQuery serializes WorkflowRunListParams's query parameters as `url.Values`.

type WorkflowRunSearchParams added in v0.17.0

type WorkflowRunSearchParams struct {
	// Filter by runs created after this timestamp (RFC3339 format).
	CreatedAfter param.Opt[string] `json:"createdAfter,omitzero"`
	// Filter by runs created before this timestamp (RFC3339 format).
	CreatedBefore param.Opt[string] `json:"createdBefore,omitzero"`
	// Filter by the user who initiated the workflow run.
	InitiatedByUserID param.Opt[string] `json:"initiatedByUserId,omitzero"`
	// Filter by linked ticket ID.
	LinkedTicketID param.Opt[string] `json:"linkedTicketId,omitzero"`
	// Maximum number of results to return. Default is 1000, maximum is 5000.
	PageSize param.Opt[int64] `json:"pageSize,omitzero"`
	// Token for pagination. Leave empty for the first request.
	PageToken param.Opt[string] `json:"pageToken,omitzero"`
	// Filter by the target user for the workflow run.
	TargetUserID param.Opt[string] `json:"targetUserId,omitzero"`
	// Filter by workflow ID.
	WorkflowID param.Opt[string] `json:"workflowId,omitzero"`
	// The ID of the team. Required.
	TeamID param.Opt[string] `json:"teamId,omitzero"`
	// Filter by statuses (multiple allowed).
	//
	// Any of "WORKFLOW_RUN_STATUS_UNSPECIFIED", "WORKFLOW_RUN_STATUS_PENDING",
	// "WORKFLOW_RUN_STATUS_RUNNING", "WORKFLOW_RUN_STATUS_COMPLETED",
	// "WORKFLOW_RUN_STATUS_FAILED", "WORKFLOW_RUN_STATUS_DENIED",
	// "WORKFLOW_RUN_STATUS_CANCELED".
	Statuses []string `json:"statuses,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowRunSearchParams) MarshalJSON added in v0.17.0

func (r WorkflowRunSearchParams) MarshalJSON() (data []byte, err error)

func (*WorkflowRunSearchParams) UnmarshalJSON added in v0.17.0

func (r *WorkflowRunSearchParams) UnmarshalJSON(data []byte) error

type WorkflowRunSearchResponse added in v0.17.0

type WorkflowRunSearchResponse struct {
	// The list of workflow runs.
	Data []WorkflowRun `json:"data"`
	// Token for retrieving the next page of results. Empty if no more results.
	NextPageToken string `json:"nextPageToken" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data          respjson.Field
		NextPageToken respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowRunSearchResponse) RawJSON added in v0.17.0

func (r WorkflowRunSearchResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowRunSearchResponse) UnmarshalJSON added in v0.17.0

func (r *WorkflowRunSearchResponse) UnmarshalJSON(data []byte) error

type WorkflowRunService added in v0.17.0

type WorkflowRunService struct {
	Options []option.RequestOption
}

WorkflowRunService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkflowRunService method instead.

func NewWorkflowRunService added in v0.17.0

func NewWorkflowRunService(opts ...option.RequestOption) (r WorkflowRunService)

NewWorkflowRunService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WorkflowRunService) Get added in v0.17.0

func (r *WorkflowRunService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *WorkflowRun, err error)

Get a specific workflow run by ID.

func (*WorkflowRunService) List added in v0.17.0

List workflow runs for a team. Filter by workflow ID, status, or time range.

func (*WorkflowRunService) ListAutoPaging added in v0.19.0

List workflow runs for a team. Filter by workflow ID, status, or time range.

func (*WorkflowRunService) Search added in v0.17.0

Search workflow runs with filters. Supports filtering by workflow ID, status, user IDs, time range, and linked ticket.

type WorkflowRunStatus added in v0.17.0

type WorkflowRunStatus string

The status of the workflow run.

const (
	WorkflowRunStatusWorkflowRunStatusUnspecified WorkflowRunStatus = "WORKFLOW_RUN_STATUS_UNSPECIFIED"
	WorkflowRunStatusWorkflowRunStatusPending     WorkflowRunStatus = "WORKFLOW_RUN_STATUS_PENDING"
	WorkflowRunStatusWorkflowRunStatusRunning     WorkflowRunStatus = "WORKFLOW_RUN_STATUS_RUNNING"
	WorkflowRunStatusWorkflowRunStatusCompleted   WorkflowRunStatus = "WORKFLOW_RUN_STATUS_COMPLETED"
	WorkflowRunStatusWorkflowRunStatusFailed      WorkflowRunStatus = "WORKFLOW_RUN_STATUS_FAILED"
	WorkflowRunStatusWorkflowRunStatusDenied      WorkflowRunStatus = "WORKFLOW_RUN_STATUS_DENIED"
	WorkflowRunStatusWorkflowRunStatusCanceled    WorkflowRunStatus = "WORKFLOW_RUN_STATUS_CANCELED"
)

type WorkflowService

type WorkflowService struct {
	Options            []option.RequestOption
	ApprovalProcedures WorkflowApprovalProcedureService
}

WorkflowService contains methods and other services that help with interacting with the serval API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkflowService method instead.

func NewWorkflowService

func NewWorkflowService(opts ...option.RequestOption) (r WorkflowService)

NewWorkflowService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WorkflowService) Delete

func (r *WorkflowService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *WorkflowDeleteResponse, err error)

Delete a workflow.

func (*WorkflowService) Get

func (r *WorkflowService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Workflow, err error)

Get a specific workflow by ID.

func (*WorkflowService) List

List all workflows for a team.

func (*WorkflowService) ListAutoPaging added in v0.19.0

List all workflows for a team.

func (*WorkflowService) New

func (r *WorkflowService) New(ctx context.Context, body WorkflowNewParams, opts ...option.RequestOption) (res *Workflow, err error)

Create a new workflow for a team.

func (*WorkflowService) Update

func (r *WorkflowService) Update(ctx context.Context, id string, body WorkflowUpdateParams, opts ...option.RequestOption) (res *Workflow, err error)

Update an existing workflow.

type WorkflowUpdateParams

type WorkflowUpdateParams struct {
	// Whether the workflow is published. Set to true to publish the workflow.
	IsPublished param.Opt[bool] `json:"isPublished,omitzero"`
	// The content/code of the workflow.
	Content param.Opt[string] `json:"content,omitzero"`
	// A description of the workflow.
	Description param.Opt[string] `json:"description,omitzero"`
	// The name of the workflow.
	Name param.Opt[string] `json:"name,omitzero"`
	// Whether the workflow requires form confirmation.
	RequireFormConfirmation param.Opt[bool] `json:"requireFormConfirmation,omitzero"`
	// The execution scope of the workflow.
	//
	// Any of "WORKFLOW_EXECUTION_SCOPE_UNSPECIFIED", "TEAM_PRIVATE", "TEAM_PUBLIC".
	ExecutionScope WorkflowUpdateParamsExecutionScope `json:"executionScope,omitzero"`
	// The IDs of the tags to associate with the workflow.
	TagIDs []string `json:"tagIds,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowUpdateParams) MarshalJSON

func (r WorkflowUpdateParams) MarshalJSON() (data []byte, err error)

func (*WorkflowUpdateParams) UnmarshalJSON

func (r *WorkflowUpdateParams) UnmarshalJSON(data []byte) error

type WorkflowUpdateParamsExecutionScope

type WorkflowUpdateParamsExecutionScope string

The execution scope of the workflow.

const (
	WorkflowUpdateParamsExecutionScopeWorkflowExecutionScopeUnspecified WorkflowUpdateParamsExecutionScope = "WORKFLOW_EXECUTION_SCOPE_UNSPECIFIED"
	WorkflowUpdateParamsExecutionScopeTeamPrivate                       WorkflowUpdateParamsExecutionScope = "TEAM_PRIVATE"
	WorkflowUpdateParamsExecutionScopeTeamPublic                        WorkflowUpdateParamsExecutionScope = "TEAM_PUBLIC"
)

type WorkflowUpdateResponseEnvelope

type WorkflowUpdateResponseEnvelope struct {
	// The updated workflow.
	Data Workflow `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowUpdateResponseEnvelope) RawJSON

Returns the unmodified JSON received from the API

func (*WorkflowUpdateResponseEnvelope) UnmarshalJSON

func (r *WorkflowUpdateResponseEnvelope) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL