serval

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 16 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.8.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"
)

func main() {
	client := serval.NewClient()
	accessPolicy, err := client.AccessPolicies.New(context.TODO(), serval.AccessPolicyNewParams{
		Name: serval.String("Example Access Policy"),
	})
	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:

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.:

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
accessPolicies, err := client.AccessPolicies.List(
	context.TODO(),
	serval.AccessPolicyListParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", accessPolicies)

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_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"`
	// The maximum number of minutes that access can be granted for.
	MaxAccessMinutes int64 `json:"maxAccessMinutes"`
	// The name of the access policy.
	Name string `json:"name"`
	// The recommended duration in minutes for access requests (optional).
	RecommendedAccessMinutes int64 `json:"recommendedAccessMinutes,nullable"`
	// Whether a business justification is required when requesting access.
	RequireBusinessJustification bool `json:"requireBusinessJustification"`
	// 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
		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 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
		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,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,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 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.
	AllowSelfApproval param.Opt[bool] `json:"allowSelfApproval,omitzero"`
	// A workflow ID to execute to determine the approvers for this step (or to
	// auto-approve the step).
	CustomWorkflowID param.Opt[string] `json:"customWorkflowId,omitzero"`
	// The IDs of the Serval groups that can approve the step.
	ServalGroupIDs []string `json:"servalGroupIds,omitzero"`
	// The IDs of the specific users that can approve the step.
	SpecificUserIDs []string `json:"specificUserIds,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 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) 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.
	AllowSelfApproval bool `json:"allowSelfApproval"`
	// A workflow ID to execute to determine the approvers for this step (or to
	// auto-approve the step).
	CustomWorkflowID string `json:"customWorkflowId"`
	// The IDs of the Serval groups that can approve the step.
	ServalGroupIDs []string `json:"servalGroupIds"`
	// The IDs of the specific users that can approve the step.
	SpecificUserIDs []string `json:"specificUserIds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		AllowSelfApproval respjson.Field
		CustomWorkflowID  respjson.Field
		ServalGroupIDs    respjson.Field
		SpecificUserIDs   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 AccessPolicyApprovalProcedureUpdateParams

type AccessPolicyApprovalProcedureUpdateParams struct {
	// The ID of the access policy.
	AccessPolicyID string `path:"access_policy_id,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.
	AllowSelfApproval param.Opt[bool] `json:"allowSelfApproval,omitzero"`
	// A workflow ID to execute to determine the approvers for this step (or to
	// auto-approve the step).
	CustomWorkflowID param.Opt[string] `json:"customWorkflowId,omitzero"`
	// The IDs of the Serval groups that can approve the step.
	ServalGroupIDs []string `json:"servalGroupIds,omitzero"`
	// The IDs of the specific users that can approve the step.
	SpecificUserIDs []string `json:"specificUserIds,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 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 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:"-"`
	// 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 AccessPolicyListResponse added in v0.6.0

type AccessPolicyListResponse struct {
	// The list of access policies.
	Data []AccessPolicy `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 (AccessPolicyListResponse) RawJSON added in v0.6.0

func (r AccessPolicyListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccessPolicyListResponse) UnmarshalJSON added in v0.6.0

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

type AccessPolicyNewParams

type AccessPolicyNewParams struct {
	// 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"`
	// The name of the access policy.
	Name param.Opt[string] `json:"name,omitzero"`
	// The ID of the team.
	TeamID param.Opt[string] `json:"teamId,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) 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 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,nullable"`
	// The instance ID of the app instance.
	InstanceID string `json:"instanceId"`
	// 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
		InstanceID            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 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:"-"`
	// 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 AppInstanceListResponse added in v0.6.0

type AppInstanceListResponse struct {
	// The list of app instances.
	Data []AppInstance `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 (AppInstanceListResponse) RawJSON added in v0.6.0

func (r AppInstanceListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppInstanceListResponse) UnmarshalJSON added in v0.6.0

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

type AppInstanceNewParams

type AppInstanceNewParams 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"`
	// **Option: custom_service_id** — The ID of a custom service to create the app
	// instance for.
	CustomServiceID param.Opt[string] `json:"customServiceId,omitzero"`
	// The instance ID of the app instance.
	InstanceID param.Opt[string] `json:"instanceId,omitzero"`
	// The name of the app instance.
	Name param.Opt[string] `json:"name,omitzero"`
	// **Option: service** — The service identifier (for built-in services like
	// "github", "okta", "aws").
	Service param.Opt[string] `json:"service,omitzero"`
	// The ID of the team.
	TeamID param.Opt[string] `json:"teamId,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) 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 instance ID of the app instance.
	InstanceID param.Opt[string] `json:"instanceId,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"`
	// The external ID of the resource.
	ExternalID string `json:"externalId,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 5000, 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:"-"`
	// 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 AppResourceListResponse added in v0.6.0

type AppResourceListResponse struct {
	// The list of resources.
	Data []AppResource `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 (AppResourceListResponse) RawJSON added in v0.6.0

func (r AppResourceListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppResourceListResponse) UnmarshalJSON added in v0.6.0

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

type AppResourceNewParams

type AppResourceNewParams struct {
	// The external ID of the resource (optional).
	ExternalID param.Opt[string] `json:"externalId,omitzero"`
	// The ID of the app instance.
	AppInstanceID param.Opt[string] `json:"appInstanceId,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 (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,nullable"`
	// A description of the role.
	Description string `json:"description"`
	// Data from the external system as a JSON string (optional).
	ExternalData string `json:"externalData,nullable"`
	// The external ID of the role in the external system (optional).
	ExternalID string `json:"externalId,nullable"`
	// The name of the role.
	Name string `json:"name"`
	// Provisioning configuration. **Exactly one method should be set.**
	ProvisioningMethod AppResourceRoleProvisioningMethod `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 5000, 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:"-"`
	// 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 AppResourceRoleListResponse added in v0.7.0

type AppResourceRoleListResponse struct {
	// The list of roles.
	Data []AppResourceRole `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 (AppResourceRoleListResponse) RawJSON added in v0.7.0

func (r AppResourceRoleListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppResourceRoleListResponse) UnmarshalJSON added in v0.7.0

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

type AppResourceRoleNewParams added in v0.7.0

type AppResourceRoleNewParams 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"`
	// The ID of the resource.
	ResourceID param.Opt[string] `json:"resourceId,omitzero"`
	// Provisioning configuration. Exactly one method should be set.
	ProvisioningMethod AppResourceRoleNewParamsProvisioningMethod `json:"provisioningMethod,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 AppResourceRoleNewParamsProvisioningMethod added in v0.8.0

type AppResourceRoleNewParamsProvisioningMethod struct {
	// **Option: builtin_workflow**
	BuiltinWorkflow any `json:"builtinWorkflow,omitzero"`
	// **Option: custom_workflow**
	CustomWorkflow AppResourceRoleNewParamsProvisioningMethodCustomWorkflow `json:"customWorkflow,omitzero"`
	// **Option: linked_roles**
	LinkedRoles AppResourceRoleNewParamsProvisioningMethodLinkedRoles `json:"linkedRoles,omitzero"`
	// **Option: manual**
	Manual AppResourceRoleNewParamsProvisioningMethodManual `json:"manual,omitzero"`
	// contains filtered or unexported fields
}

Provisioning configuration. Exactly one method should be set.

func (AppResourceRoleNewParamsProvisioningMethod) MarshalJSON added in v0.8.0

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

func (*AppResourceRoleNewParamsProvisioningMethod) UnmarshalJSON added in v0.8.0

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

type AppResourceRoleNewParamsProvisioningMethodCustomWorkflow added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodCustomWorkflow 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
}

**Option: custom_workflow**

func (AppResourceRoleNewParamsProvisioningMethodCustomWorkflow) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodCustomWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodLinkedRoles added in v0.7.0

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

**Option: linked_roles**

func (AppResourceRoleNewParamsProvisioningMethodLinkedRoles) MarshalJSON added in v0.7.0

func (*AppResourceRoleNewParamsProvisioningMethodLinkedRoles) UnmarshalJSON added in v0.7.0

type AppResourceRoleNewParamsProvisioningMethodManual added in v0.7.0

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

**Option: manual**

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 AppResourceRoleNewParamsProvisioningMethodManualAssignee added in v0.8.0

type AppResourceRoleNewParamsProvisioningMethodManualAssignee 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 (AppResourceRoleNewParamsProvisioningMethodManualAssignee) MarshalJSON added in v0.8.0

func (*AppResourceRoleNewParamsProvisioningMethodManualAssignee) UnmarshalJSON added in v0.8.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 AppResourceRoleProvisioningMethod added in v0.8.0

type AppResourceRoleProvisioningMethod struct {
	// **Option: builtin_workflow**
	BuiltinWorkflow any `json:"builtinWorkflow"`
	// **Option: custom_workflow**
	CustomWorkflow AppResourceRoleProvisioningMethodCustomWorkflow `json:"customWorkflow"`
	// **Option: linked_roles**
	LinkedRoles AppResourceRoleProvisioningMethodLinkedRoles `json:"linkedRoles"`
	// **Option: manual**
	Manual AppResourceRoleProvisioningMethodManual `json:"manual"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BuiltinWorkflow respjson.Field
		CustomWorkflow  respjson.Field
		LinkedRoles     respjson.Field
		Manual          respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Provisioning configuration. **Exactly one method should be set.**

func (AppResourceRoleProvisioningMethod) RawJSON added in v0.8.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethod) UnmarshalJSON added in v0.8.0

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

type AppResourceRoleProvisioningMethodCustomWorkflow added in v0.7.0

type AppResourceRoleProvisioningMethodCustomWorkflow 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:"-"`
}

**Option: custom_workflow**

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 AppResourceRoleProvisioningMethodLinkedRoles added in v0.7.0

type AppResourceRoleProvisioningMethodLinkedRoles 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:"-"`
}

**Option: linked_roles**

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 AppResourceRoleProvisioningMethodManual added in v0.7.0

type AppResourceRoleProvisioningMethodManual struct {
	// Users and groups that should be assigned/notified for manual provisioning.
	Assignees []AppResourceRoleProvisioningMethodManualAssignee `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:"-"`
}

**Option: manual**

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 AppResourceRoleProvisioningMethodManualAssignee added in v0.8.0

type AppResourceRoleProvisioningMethodManualAssignee 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 (AppResourceRoleProvisioningMethodManualAssignee) RawJSON added in v0.8.0

Returns the unmodified JSON received from the API

func (*AppResourceRoleProvisioningMethodManualAssignee) UnmarshalJSON added in v0.8.0

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) 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 AppResourceRoleUpdateParamsProvisioningMethod `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 AppResourceRoleUpdateParamsProvisioningMethod added in v0.8.0

type AppResourceRoleUpdateParamsProvisioningMethod struct {
	// **Option: builtin_workflow**
	BuiltinWorkflow any `json:"builtinWorkflow,omitzero"`
	// **Option: custom_workflow**
	CustomWorkflow AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow `json:"customWorkflow,omitzero"`
	// **Option: linked_roles**
	LinkedRoles AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles `json:"linkedRoles,omitzero"`
	// **Option: manual**
	Manual AppResourceRoleUpdateParamsProvisioningMethodManual `json:"manual,omitzero"`
	// contains filtered or unexported fields
}

Provisioning configuration. Exactly one method should be set.

func (AppResourceRoleUpdateParamsProvisioningMethod) MarshalJSON added in v0.8.0

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

func (*AppResourceRoleUpdateParamsProvisioningMethod) UnmarshalJSON added in v0.8.0

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

type AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow 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
}

**Option: custom_workflow**

func (AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodCustomWorkflow) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles added in v0.7.0

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

**Option: linked_roles**

func (AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles) MarshalJSON added in v0.7.0

func (*AppResourceRoleUpdateParamsProvisioningMethodLinkedRoles) UnmarshalJSON added in v0.7.0

type AppResourceRoleUpdateParamsProvisioningMethodManual added in v0.7.0

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

**Option: manual**

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 AppResourceRoleUpdateParamsProvisioningMethodManualAssignee added in v0.8.0

type AppResourceRoleUpdateParamsProvisioningMethodManualAssignee 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 (AppResourceRoleUpdateParamsProvisioningMethodManualAssignee) MarshalJSON added in v0.8.0

func (*AppResourceRoleUpdateParamsProvisioningMethodManualAssignee) UnmarshalJSON added in v0.8.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) 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 Client

type Client struct {
	Options          []option.RequestOption
	AccessPolicies   AccessPolicyService
	Guidances        GuidanceService
	Workflows        WorkflowService
	AppInstances     AppInstanceService
	AppResources     AppResourceService
	AppResourceRoles AppResourceRoleService
	Users            UserService
	Groups           GroupService
	Teams            TeamService
	Tags             TagService
}

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_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 Error

type Error = apierror.Error

type Group

type Group struct {
	ID string `json:"id"`
	// A timestamp in RFC 3339 format (e.g., "2017-01-15T01:30:15.01Z").
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// A timestamp in RFC 3339 format (e.g., "2017-01-15T01:30:15.01Z").
	DeletedAt      time.Time `json:"deletedAt,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 5000, 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:"-"`
	// 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 GroupListResponse

type GroupListResponse struct {
	// The list of groups.
	Data []Group `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 (GroupListResponse) RawJSON

func (r GroupListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*GroupListResponse) UnmarshalJSON

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

type GroupNewParams

type GroupNewParams struct {
	Name    param.Opt[string] `json:"name,omitzero"`
	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 *GroupListResponse, err error)

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.
	HasUnpublishedChanges bool `json:"hasUnpublishedChanges"`
	// Whether the guidance has been published at least once.
	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 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:"-"`
	// 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 GuidanceListResponse added in v0.6.0

type GuidanceListResponse struct {
	// The list of guidances.
	Data []Guidance `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 (GuidanceListResponse) RawJSON added in v0.6.0

func (r GuidanceListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*GuidanceListResponse) UnmarshalJSON added in v0.6.0

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

type GuidanceNewParams

type GuidanceNewParams struct {
	// The content of the guidance (optional).
	Content param.Opt[string] `json:"content,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"`
	// The name of the guidance.
	Name param.Opt[string] `json:"name,omitzero"`
	// The ID of the team.
	TeamID param.Opt[string] `json:"teamId,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) 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 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,nullable"`
	// The icon slug for the tag.
	IconSlug string `json:"iconSlug,nullable"`
	// The name of the tag.
	Name string `json:"name"`
	// 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
		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 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 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:"-"`
	// 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 TagListResponse added in v0.6.0

type TagListResponse struct {
	// The list of tags.
	Data []Tag `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 (TagListResponse) RawJSON added in v0.6.0

func (r TagListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TagListResponse) UnmarshalJSON added in v0.6.0

func (r *TagListResponse) 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) 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 *TagListResponse, err error)

List all tags for a team.

type Team

type Team struct {
	ID string `json:"id"`
	// A timestamp in RFC 3339 format (e.g., "2017-01-15T01:30:15.01Z").
	CreatedAt      time.Time `json:"createdAt" format:"date-time"`
	Description    string    `json:"description"`
	Name           string    `json:"name"`
	OrganizationID string    `json:"organizationId"`
	Prefix         string    `json:"prefix"`
	UserIDs        []string  `json:"userIds"`
	// 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
		UserIDs        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 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 (TeamListParams) URLQuery

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

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

type TeamListResponse

type TeamListResponse struct {
	// The list of teams.
	Data []Team `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 (TeamListResponse) RawJSON

func (r TeamListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TeamListResponse) UnmarshalJSON

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

type TeamNewParams

type TeamNewParams struct {
	Description param.Opt[string] `json:"description,omitzero"`
	Prefix      param.Opt[string] `json:"prefix,omitzero"`
	Name        param.Opt[string] `json:"name,omitzero"`
	UserIDs     []string          `json:"userIds,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 *TeamListResponse, err error)

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"`
	UserIDs     []string          `json:"userIds,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 User

type User struct {
	ID        string `json:"id"`
	AvatarURL string `json:"avatarUrl"`
	// A timestamp in RFC 3339 format (e.g., "2017-01-15T01:30:15.01Z").
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// A timestamp in RFC 3339 format (e.g., "2017-01-15T01:30:15.01Z").
	DeactivatedAt time.Time `json:"deactivatedAt,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".
	Role UserRole `json:"role"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            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
		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 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 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 (UserListParams) URLQuery

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

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

type UserListResponse

type UserListResponse struct {
	// The list of users.
	Data []User `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 (UserListResponse) RawJSON

func (r UserListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*UserListResponse) UnmarshalJSON

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

type UserNewParams

type UserNewParams struct {
	Email     param.Opt[string] `json:"email,omitzero"`
	FirstName param.Opt[string] `json:"firstName,omitzero"`
	LastName  param.Opt[string] `json:"lastName,omitzero"`
	// Any of "USER_ROLE_UNSPECIFIED", "USER_ROLE_ORG_MEMBER", "USER_ROLE_ORG_ADMIN".
	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 UserNewParamsRole

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

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"
)

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 *UserListResponse, err error)

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"`
	// Any of "USER_ROLE_UNSPECIFIED", "USER_ROLE_ORG_MEMBER", "USER_ROLE_ORG_ADMIN".
	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 UserUpdateParamsRole

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

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.
	HasUnpublishedChanges bool `json:"hasUnpublishedChanges"`
	// Whether the workflow has been published at least once.
	IsPublished bool `json:"isPublished"`
	// Whether the workflow is temporary.
	IsTemporary bool `json:"isTemporary"`
	// The name of the workflow.
	Name string `json:"name"`
	// The parameters schema of the workflow (JSON).
	Parameters string `json:"parameters"`
	// 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"`
	// The type of the workflow.
	//
	// Any of "WORKFLOW_TYPE_UNSPECIFIED", "EXECUTABLE", "GUIDANCE".
	Type WorkflowType `json:"type"`
	// 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
		IsTemporary             respjson.Field
		Name                    respjson.Field
		Parameters              respjson.Field
		RequireFormConfirmation respjson.Field
		TagIDs                  respjson.Field
		TeamID                  respjson.Field
		Type                    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"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Steps       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,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,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 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.
	AllowSelfApproval param.Opt[bool] `json:"allowSelfApproval,omitzero"`
	// A workflow ID to execute to determine the approvers for this step (or to
	// auto-approve the step).
	CustomWorkflowID param.Opt[string] `json:"customWorkflowId,omitzero"`
	// The IDs of the Serval groups that can approve the step.
	ServalGroupIDs []string `json:"servalGroupIds,omitzero"`
	// The IDs of the specific users that can approve the step.
	SpecificUserIDs []string `json:"specificUserIds,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 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) 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.
	AllowSelfApproval bool `json:"allowSelfApproval"`
	// A workflow ID to execute to determine the approvers for this step (or to
	// auto-approve the step).
	CustomWorkflowID string `json:"customWorkflowId"`
	// The IDs of the Serval groups that can approve the step.
	ServalGroupIDs []string `json:"servalGroupIds"`
	// The IDs of the specific users that can approve the step.
	SpecificUserIDs []string `json:"specificUserIds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		AllowSelfApproval respjson.Field
		CustomWorkflowID  respjson.Field
		ServalGroupIDs    respjson.Field
		SpecificUserIDs   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 WorkflowApprovalProcedureUpdateParams

type WorkflowApprovalProcedureUpdateParams struct {
	// The ID of the workflow.
	WorkflowID string `path:"workflow_id,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.
	AllowSelfApproval param.Opt[bool] `json:"allowSelfApproval,omitzero"`
	// A workflow ID to execute to determine the approvers for this step (or to
	// auto-approve the step).
	CustomWorkflowID param.Opt[string] `json:"customWorkflowId,omitzero"`
	// The IDs of the Serval groups that can approve the step.
	ServalGroupIDs []string `json:"servalGroupIds,omitzero"`
	// The IDs of the specific users that can approve the step.
	SpecificUserIDs []string `json:"specificUserIds,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 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 {
	// Whether to include temporary workflows (optional, defaults to false).
	IncludeTemporary param.Opt[bool] `query:"includeTemporary,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:"-"`
	// 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 WorkflowListResponse added in v0.6.0

type WorkflowListResponse struct {
	// The list of workflows.
	Data []Workflow `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 (WorkflowListResponse) RawJSON added in v0.6.0

func (r WorkflowListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowListResponse) UnmarshalJSON added in v0.6.0

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

type WorkflowNewParams

type WorkflowNewParams struct {
	// The content/code of the workflow (optional).
	Content param.Opt[string] `json:"content,omitzero"`
	// Whether the workflow is temporary (optional).
	IsTemporary param.Opt[bool] `json:"isTemporary,omitzero"`
	// The parameters schema of the workflow (JSON, optional).
	Parameters param.Opt[string] `json:"parameters,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 name of the workflow.
	Name param.Opt[string] `json:"name,omitzero"`
	// The ID of the team.
	TeamID param.Opt[string] `json:"teamId,omitzero"`
	// The execution scope of the workflow.
	//
	// Any of "WORKFLOW_EXECUTION_SCOPE_UNSPECIFIED", "TEAM_PRIVATE", "TEAM_PUBLIC".
	ExecutionScope WorkflowNewParamsExecutionScope `json:"executionScope,omitzero"`
	// The type of the workflow.
	//
	// Any of "WORKFLOW_TYPE_UNSPECIFIED", "EXECUTABLE", "GUIDANCE".
	Type WorkflowNewParamsType `json:"type,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 WorkflowNewParamsType

type WorkflowNewParamsType string

The type of the workflow.

const (
	WorkflowNewParamsTypeWorkflowTypeUnspecified WorkflowNewParamsType = "WORKFLOW_TYPE_UNSPECIFIED"
	WorkflowNewParamsTypeExecutable              WorkflowNewParamsType = "EXECUTABLE"
	WorkflowNewParamsTypeGuidance                WorkflowNewParamsType = "GUIDANCE"
)

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 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) 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 WorkflowType

type WorkflowType string

The type of the workflow.

const (
	WorkflowTypeWorkflowTypeUnspecified WorkflowType = "WORKFLOW_TYPE_UNSPECIFIED"
	WorkflowTypeExecutable              WorkflowType = "EXECUTABLE"
	WorkflowTypeGuidance                WorkflowType = "GUIDANCE"
)

type WorkflowUpdateParams

type WorkflowUpdateParams struct {
	// 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"`
	// Whether the workflow is temporary.
	IsTemporary param.Opt[bool] `json:"isTemporary,omitzero"`
	// The name of the workflow.
	Name param.Opt[string] `json:"name,omitzero"`
	// The parameters schema of the workflow (JSON).
	Parameters param.Opt[string] `json:"parameters,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 type of the workflow.
	//
	// Any of "WORKFLOW_TYPE_UNSPECIFIED", "EXECUTABLE", "GUIDANCE".
	Type WorkflowUpdateParamsType `json:"type,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 WorkflowUpdateParamsType

type WorkflowUpdateParamsType string

The type of the workflow.

const (
	WorkflowUpdateParamsTypeWorkflowTypeUnspecified WorkflowUpdateParamsType = "WORKFLOW_TYPE_UNSPECIFIED"
	WorkflowUpdateParamsTypeExecutable              WorkflowUpdateParamsType = "EXECUTABLE"
	WorkflowUpdateParamsTypeGuidance                WorkflowUpdateParamsType = "GUIDANCE"
)

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