warphr

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 2

README

Warp Go API Library

Go Reference

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

It is generated with Stainless.

MCP Server

Use the Warp MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.

Add to Cursor Install in VS Code

Note: You may need to set environment variables in your MCP client.

Installation

import (
	"github.com/TeamWarp/warp-go-sdk" // imported as warphr
)

Or to pin the version:

go get -u 'github.com/TeamWarp/warp-go-sdk@v0.3.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/TeamWarp/warp-go-sdk"
	"github.com/TeamWarp/warp-go-sdk/option"
)

func main() {
	client := warphr.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("WARP_API_KEY")
	)
	page, err := client.TimeOff.Policies.List(context.TODO(), warphr.TimeOffPolicyListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)
}

Request fields

The warphr 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, warphr.String(string), warphr.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 := warphr.ExampleParams{
	ID:   "id_xxx",             // required property
	Name: warphr.String("..."), // optional property

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

	Origin: warphr.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[warphr.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 := warphr.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

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

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

See the full list of request options.

Pagination

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

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

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

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

page, err := client.TimeOff.Policies.List(context.TODO(), warphr.TimeOffPolicyListParams{})
for page != nil {
	for _, policy := range page.Data {
		fmt.Printf("%+v\n", policy)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *warphr.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.TimeOff.Policies.List(context.TODO(), warphr.TimeOffPolicyListParams{})
if err != nil {
	var apierr *warphr.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 "/v1/time_off/policies": 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.TimeOff.Policies.List(
	ctx,
	warphr.TimeOffPolicyListParams{},
	// 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 warphr.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 := warphr.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.TimeOff.Policies.List(
	context.TODO(),
	warphr.TimeOffPolicyListParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

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

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

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

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

Undocumented endpoints

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

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

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

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

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: warphr.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 := warphr.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 (WARP_API_KEY, WARP_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 Client

type Client struct {

	// Endpoints for worker time off management. See time off requests, which workers
	// are assigned to which policies, or worker remaining balances.
	TimeOff TimeOffService
	// Endpoints for worker management. "Workers" include anyone employed by your
	// company, whether US or international, full-time employees or contractors.
	Workers WorkerService
	// Endpoints for department management. Create, list, and update departments within
	// your company.
	Departments DepartmentService
	// Endpoints for workplace management. Create, list, and update workplaces within
	// your company.
	Workplaces WorkplaceService
	// contains filtered or unexported fields
}

Client creates a struct with services and top level methods that help with interacting with the warp 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 (WARP_API_KEY, WARP_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 DepartmentListParams

type DepartmentListParams struct {
	// The unique public id of the department
	AfterID param.Opt[string] `query:"afterId,omitzero" json:"-"`
	// The unique public id of the department
	BeforeID param.Opt[string] `query:"beforeId,omitzero" json:"-"`
	// a number less than or equal to 100
	Limit param.Opt[string] `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (DepartmentListParams) URLQuery

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

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

type DepartmentListResponse

type DepartmentListResponse struct {
	// The unique public id of the department
	ID string `json:"id" api:"required"`
	// a string to be decoded into a Date
	CreatedAt string `json:"createdAt" api:"required"`
	Name      string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DepartmentListResponse) RawJSON

func (r DepartmentListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*DepartmentListResponse) UnmarshalJSON

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

type DepartmentNewParams

type DepartmentNewParams struct {
	// a non empty string
	Name string `json:"name" api:"required"`
	// contains filtered or unexported fields
}

func (DepartmentNewParams) MarshalJSON

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

func (*DepartmentNewParams) UnmarshalJSON

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

type DepartmentNewResponse

type DepartmentNewResponse struct {
	// The unique public id of the department
	ID string `json:"id" api:"required"`
	// a string to be decoded into a Date
	CreatedAt string `json:"createdAt" api:"required"`
	Name      string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DepartmentNewResponse) RawJSON

func (r DepartmentNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*DepartmentNewResponse) UnmarshalJSON

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

type DepartmentService

type DepartmentService struct {
	// contains filtered or unexported fields
}

Endpoints for department management. Create, list, and update departments within your company.

DepartmentService contains methods and other services that help with interacting with the warp 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 NewDepartmentService method instead.

func NewDepartmentService

func NewDepartmentService(opts ...option.RequestOption) (r DepartmentService)

NewDepartmentService 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 (*DepartmentService) List

List all departments for your company.

func (*DepartmentService) ListAutoPaging

List all departments for your company.

func (*DepartmentService) New

Create a new department.

func (*DepartmentService) Update

Update an existing department.

type DepartmentUpdateParams

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

func (DepartmentUpdateParams) MarshalJSON

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

func (*DepartmentUpdateParams) UnmarshalJSON

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

type DepartmentUpdateResponse

type DepartmentUpdateResponse struct {
	// The unique public id of the department
	ID string `json:"id" api:"required"`
	// a string to be decoded into a Date
	CreatedAt string `json:"createdAt" api:"required"`
	Name      string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DepartmentUpdateResponse) RawJSON

func (r DepartmentUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*DepartmentUpdateResponse) UnmarshalJSON

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

type Error

type Error = apierror.Error

type TimeOffListAssignmentsParams

type TimeOffListAssignmentsParams struct {
	AfterID  param.Opt[string] `query:"afterId,omitzero" json:"-"`
	BeforeID param.Opt[string] `query:"beforeId,omitzero" json:"-"`
	// a number less than or equal to 100
	Limit     param.Opt[string] `query:"limit,omitzero" json:"-"`
	PolicyIDs []string          `query:"policyIds,omitzero" json:"-"`
	WorkerIDs []string          `query:"workerIds,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TimeOffListAssignmentsParams) URLQuery

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

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

type TimeOffListAssignmentsResponse

type TimeOffListAssignmentsResponse struct {
	ID string `json:"id" api:"required"`
	// a string to be decoded into a Date
	AssignedAt string `json:"assignedAt" api:"required"`
	// a string starting with "top\_"
	PolicyID string `json:"policyId" api:"required"`
	// The id of the worker.
	WorkerID string `json:"workerId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AssignedAt  respjson.Field
		PolicyID    respjson.Field
		WorkerID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TimeOffListAssignmentsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*TimeOffListAssignmentsResponse) UnmarshalJSON

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

type TimeOffListBalancesParams

type TimeOffListBalancesParams struct {
	AfterID  param.Opt[string] `query:"afterId,omitzero" json:"-"`
	BeforeID param.Opt[string] `query:"beforeId,omitzero" json:"-"`
	// a string to be decoded into a Date
	EndDate param.Opt[string] `query:"endDate,omitzero" json:"-"`
	// a number less than or equal to 100
	Limit param.Opt[string] `query:"limit,omitzero" json:"-"`
	// a string to be decoded into a Date
	StartDate param.Opt[string] `query:"startDate,omitzero" json:"-"`
	PolicyIDs []string          `query:"policyIds,omitzero" json:"-"`
	WorkerIDs []string          `query:"workerIds,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TimeOffListBalancesParams) URLQuery

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

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

type TimeOffListBalancesResponse

type TimeOffListBalancesResponse struct {
	ID              string  `json:"id" api:"required"`
	AccruedLocked   float64 `json:"accruedLocked" api:"required"`
	AccruedUnlocked float64 `json:"accruedUnlocked" api:"required"`
	Available       float64 `json:"available" api:"required"`
	Holds           float64 `json:"holds" api:"required"`
	LegacyWorkerID  string  `json:"legacyWorkerId" api:"required"`
	// a string starting with "top\_"
	PolicyID string  `json:"policyId" api:"required"`
	Used     float64 `json:"used" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		AccruedLocked   respjson.Field
		AccruedUnlocked respjson.Field
		Available       respjson.Field
		Holds           respjson.Field
		LegacyWorkerID  respjson.Field
		PolicyID        respjson.Field
		Used            respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TimeOffListBalancesResponse) RawJSON

func (r TimeOffListBalancesResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TimeOffListBalancesResponse) UnmarshalJSON

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

type TimeOffListRequestsParams

type TimeOffListRequestsParams struct {
	AfterID  param.Opt[string] `query:"afterId,omitzero" json:"-"`
	BeforeID param.Opt[string] `query:"beforeId,omitzero" json:"-"`
	// a string to be decoded into a Date
	EndsBefore param.Opt[string] `query:"endsBefore,omitzero" json:"-"`
	// a string to be decoded into a Date
	EndsOnOrAfter param.Opt[string] `query:"endsOnOrAfter,omitzero" json:"-"`
	// a number less than or equal to 100
	Limit param.Opt[string] `query:"limit,omitzero" json:"-"`
	// a string to be decoded into a Date
	StartsBefore param.Opt[string] `query:"startsBefore,omitzero" json:"-"`
	// a string to be decoded into a Date
	StartsOnOrAfter param.Opt[string] `query:"startsOnOrAfter,omitzero" json:"-"`
	PolicyIDs       []string          `query:"policyIds,omitzero" json:"-"`
	// Any of "pending", "approved", "denied".
	Statuses  []string `query:"statuses,omitzero" json:"-"`
	WorkerIDs []string `query:"workerIds,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TimeOffListRequestsParams) URLQuery

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

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

type TimeOffListRequestsResponse

type TimeOffListRequestsResponse struct {
	ID string `json:"id" api:"required"`
	// a string to be decoded into a Date
	CreatedAt string `json:"createdAt" api:"required"`
	// a string to be decoded into a Date
	EndAt            string  `json:"endAt" api:"required"`
	Reason           string  `json:"reason" api:"required"`
	RequestedMinutes float64 `json:"requestedMinutes" api:"required"`
	// a string to be decoded into a Date
	StartAt string `json:"startAt" api:"required"`
	// Any of "pending", "approved", "denied".
	Status TimeOffListRequestsResponseStatus `json:"status" api:"required"`
	// a string starting with "top\_"
	TimeOffPolicyID string `json:"timeOffPolicyId" api:"required"`
	// The time zone that the worker is requesting time off in.
	TimeZone string `json:"timeZone" api:"required"`
	// The id of the worker.
	WorkerID string `json:"workerId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		CreatedAt        respjson.Field
		EndAt            respjson.Field
		Reason           respjson.Field
		RequestedMinutes respjson.Field
		StartAt          respjson.Field
		Status           respjson.Field
		TimeOffPolicyID  respjson.Field
		TimeZone         respjson.Field
		WorkerID         respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TimeOffListRequestsResponse) RawJSON

func (r TimeOffListRequestsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TimeOffListRequestsResponse) UnmarshalJSON

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

type TimeOffListRequestsResponseStatus

type TimeOffListRequestsResponseStatus string
const (
	TimeOffListRequestsResponseStatusPending  TimeOffListRequestsResponseStatus = "pending"
	TimeOffListRequestsResponseStatusApproved TimeOffListRequestsResponseStatus = "approved"
	TimeOffListRequestsResponseStatusDenied   TimeOffListRequestsResponseStatus = "denied"
)

type TimeOffPolicyGetResponse

type TimeOffPolicyGetResponse struct {
	// a string starting with "top\_"
	ID                  string  `json:"id" api:"required"`
	Description         string  `json:"description" api:"required"`
	HoursWorkedPerChunk float64 `json:"hoursWorkedPerChunk" api:"required"`
	IsUnlimited         bool    `json:"isUnlimited" api:"required"`
	MinutesPerChunk     float64 `json:"minutesPerChunk" api:"required"`
	MinutesPerPeriod    float64 `json:"minutesPerPeriod" api:"required"`
	Name                string  `json:"name" api:"required"`
	Paid                bool    `json:"paid" api:"required"`
	// Any of "per_hour_worked", "monthly", "yearly", "unlimited".
	Schedule TimeOffPolicyGetResponseSchedule `json:"schedule" api:"required"`
	// a string starting with "tot\_"
	TimeOffTypeID   string `json:"timeOffTypeId" api:"required"`
	TimeOffTypeName string `json:"timeOffTypeName" api:"required"`
	// Any of "hour", "day".
	Unit TimeOffPolicyGetResponseUnit `json:"unit" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                  respjson.Field
		Description         respjson.Field
		HoursWorkedPerChunk respjson.Field
		IsUnlimited         respjson.Field
		MinutesPerChunk     respjson.Field
		MinutesPerPeriod    respjson.Field
		Name                respjson.Field
		Paid                respjson.Field
		Schedule            respjson.Field
		TimeOffTypeID       respjson.Field
		TimeOffTypeName     respjson.Field
		Unit                respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TimeOffPolicyGetResponse) RawJSON

func (r TimeOffPolicyGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TimeOffPolicyGetResponse) UnmarshalJSON

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

type TimeOffPolicyGetResponseSchedule

type TimeOffPolicyGetResponseSchedule string
const (
	TimeOffPolicyGetResponseSchedulePerHourWorked TimeOffPolicyGetResponseSchedule = "per_hour_worked"
	TimeOffPolicyGetResponseScheduleMonthly       TimeOffPolicyGetResponseSchedule = "monthly"
	TimeOffPolicyGetResponseScheduleYearly        TimeOffPolicyGetResponseSchedule = "yearly"
	TimeOffPolicyGetResponseScheduleUnlimited     TimeOffPolicyGetResponseSchedule = "unlimited"
)

type TimeOffPolicyGetResponseUnit

type TimeOffPolicyGetResponseUnit string
const (
	TimeOffPolicyGetResponseUnitHour TimeOffPolicyGetResponseUnit = "hour"
	TimeOffPolicyGetResponseUnitDay  TimeOffPolicyGetResponseUnit = "day"
)

type TimeOffPolicyListParams

type TimeOffPolicyListParams struct {
	// a string starting with "top\_"
	AfterID param.Opt[string] `query:"afterId,omitzero" json:"-"`
	// a string starting with "top\_"
	BeforeID param.Opt[string] `query:"beforeId,omitzero" json:"-"`
	// a number less than or equal to 100
	Limit param.Opt[string] `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TimeOffPolicyListParams) URLQuery

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

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

type TimeOffPolicyListResponse

type TimeOffPolicyListResponse struct {
	// a string starting with "top\_"
	ID                  string  `json:"id" api:"required"`
	Description         string  `json:"description" api:"required"`
	HoursWorkedPerChunk float64 `json:"hoursWorkedPerChunk" api:"required"`
	IsUnlimited         bool    `json:"isUnlimited" api:"required"`
	MinutesPerChunk     float64 `json:"minutesPerChunk" api:"required"`
	MinutesPerPeriod    float64 `json:"minutesPerPeriod" api:"required"`
	Name                string  `json:"name" api:"required"`
	Paid                bool    `json:"paid" api:"required"`
	// Any of "per_hour_worked", "monthly", "yearly", "unlimited".
	Schedule TimeOffPolicyListResponseSchedule `json:"schedule" api:"required"`
	// a string starting with "tot\_"
	TimeOffTypeID   string `json:"timeOffTypeId" api:"required"`
	TimeOffTypeName string `json:"timeOffTypeName" api:"required"`
	// Any of "hour", "day".
	Unit TimeOffPolicyListResponseUnit `json:"unit" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                  respjson.Field
		Description         respjson.Field
		HoursWorkedPerChunk respjson.Field
		IsUnlimited         respjson.Field
		MinutesPerChunk     respjson.Field
		MinutesPerPeriod    respjson.Field
		Name                respjson.Field
		Paid                respjson.Field
		Schedule            respjson.Field
		TimeOffTypeID       respjson.Field
		TimeOffTypeName     respjson.Field
		Unit                respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TimeOffPolicyListResponse) RawJSON

func (r TimeOffPolicyListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TimeOffPolicyListResponse) UnmarshalJSON

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

type TimeOffPolicyListResponseSchedule

type TimeOffPolicyListResponseSchedule string
const (
	TimeOffPolicyListResponseSchedulePerHourWorked TimeOffPolicyListResponseSchedule = "per_hour_worked"
	TimeOffPolicyListResponseScheduleMonthly       TimeOffPolicyListResponseSchedule = "monthly"
	TimeOffPolicyListResponseScheduleYearly        TimeOffPolicyListResponseSchedule = "yearly"
	TimeOffPolicyListResponseScheduleUnlimited     TimeOffPolicyListResponseSchedule = "unlimited"
)

type TimeOffPolicyListResponseUnit

type TimeOffPolicyListResponseUnit string
const (
	TimeOffPolicyListResponseUnitHour TimeOffPolicyListResponseUnit = "hour"
	TimeOffPolicyListResponseUnitDay  TimeOffPolicyListResponseUnit = "day"
)

type TimeOffPolicyService

type TimeOffPolicyService struct {
	// contains filtered or unexported fields
}

Endpoints for worker time off management. See time off requests, which workers are assigned to which policies, or worker remaining balances.

TimeOffPolicyService contains methods and other services that help with interacting with the warp 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 NewTimeOffPolicyService method instead.

func NewTimeOffPolicyService

func NewTimeOffPolicyService(opts ...option.RequestOption) (r TimeOffPolicyService)

NewTimeOffPolicyService 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 (*TimeOffPolicyService) Get

Get a specific time off policy by id

func (*TimeOffPolicyService) List

Get the time off policies for your company

func (*TimeOffPolicyService) ListAutoPaging

Get the time off policies for your company

type TimeOffService

type TimeOffService struct {

	// Endpoints for worker time off management. See time off requests, which workers
	// are assigned to which policies, or worker remaining balances.
	Policies TimeOffPolicyService
	// contains filtered or unexported fields
}

Endpoints for worker time off management. See time off requests, which workers are assigned to which policies, or worker remaining balances.

TimeOffService contains methods and other services that help with interacting with the warp 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 NewTimeOffService method instead.

func NewTimeOffService

func NewTimeOffService(opts ...option.RequestOption) (r TimeOffService)

NewTimeOffService 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 (*TimeOffService) ListAssignments

Time off assignments are mappings between workers and time off policies. Useful for finding out which policies a worker is assigned to, or which workers are assigned to a given policy.

func (*TimeOffService) ListAssignmentsAutoPaging

Time off assignments are mappings between workers and time off policies. Useful for finding out which policies a worker is assigned to, or which workers are assigned to a given policy.

func (*TimeOffService) ListBalances

Get worker remaining time-off balances.

func (*TimeOffService) ListBalancesAutoPaging

Get worker remaining time-off balances.

func (*TimeOffService) ListRequests

Get the time off requests that workers in your company have made.

func (*TimeOffService) ListRequestsAutoPaging

Get the time off requests that workers in your company have made.

type WorkerGetResponse

type WorkerGetResponse struct {
	// The id of the worker.
	ID           string `json:"id" api:"required"`
	BusinessName string `json:"businessName" api:"required"`
	// The department the worker belongs to, or null if unassigned.
	Department WorkerGetResponseDepartment `json:"department" api:"required"`
	// The "ui" name of a worker. If it's a business contractor business name is used.
	// Otherwise we default to preferred name, then first-last.
	DisplayName string `json:"displayName" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	Email string `json:"email" api:"required"`
	// A date string in the form YYYY-MM-DD
	EndDate       string `json:"endDate" api:"required"`
	FirstName     string `json:"firstName" api:"required"`
	IsBusiness    bool   `json:"isBusiness" api:"required"`
	LastName      string `json:"lastName" api:"required"`
	Position      string `json:"position" api:"required"`
	PreferredName string `json:"preferredName" api:"required"`
	// A date string in the form YYYY-MM-DD
	StartDate string `json:"startDate" api:"required"`
	// Any of "draft", "invited", "onboarding", "active", "offboarding", "inactive".
	Status WorkerGetResponseStatus `json:"status" api:"required"`
	// The IANA timezone of the worker (e.g., America/New_York).
	TimeZone string `json:"timeZone" api:"required"`
	// Any of "employee", "contractor".
	Type WorkerGetResponseType `json:"type" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	WorkEmail string `json:"workEmail" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		BusinessName  respjson.Field
		Department    respjson.Field
		DisplayName   respjson.Field
		Email         respjson.Field
		EndDate       respjson.Field
		FirstName     respjson.Field
		IsBusiness    respjson.Field
		LastName      respjson.Field
		Position      respjson.Field
		PreferredName respjson.Field
		StartDate     respjson.Field
		Status        respjson.Field
		TimeZone      respjson.Field
		Type          respjson.Field
		WorkEmail     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkerGetResponse) RawJSON

func (r WorkerGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkerGetResponse) UnmarshalJSON

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

type WorkerGetResponseDepartment

type WorkerGetResponseDepartment struct {
	// The unique public id of the department
	ID   string `json:"id" api:"required"`
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The department the worker belongs to, or null if unassigned.

func (WorkerGetResponseDepartment) RawJSON

func (r WorkerGetResponseDepartment) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkerGetResponseDepartment) UnmarshalJSON

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

type WorkerGetResponseStatus

type WorkerGetResponseStatus string
const (
	WorkerGetResponseStatusDraft       WorkerGetResponseStatus = "draft"
	WorkerGetResponseStatusInvited     WorkerGetResponseStatus = "invited"
	WorkerGetResponseStatusOnboarding  WorkerGetResponseStatus = "onboarding"
	WorkerGetResponseStatusActive      WorkerGetResponseStatus = "active"
	WorkerGetResponseStatusOffboarding WorkerGetResponseStatus = "offboarding"
	WorkerGetResponseStatusInactive    WorkerGetResponseStatus = "inactive"
)

type WorkerGetResponseType

type WorkerGetResponseType string
const (
	WorkerGetResponseTypeEmployee   WorkerGetResponseType = "employee"
	WorkerGetResponseTypeContractor WorkerGetResponseType = "contractor"
)

type WorkerInviteResponse

type WorkerInviteResponse struct {
	// The id of the worker.
	ID           string `json:"id" api:"required"`
	BusinessName string `json:"businessName" api:"required"`
	// The department the worker belongs to, or null if unassigned.
	Department WorkerInviteResponseDepartment `json:"department" api:"required"`
	// The "ui" name of a worker. If it's a business contractor business name is used.
	// Otherwise we default to preferred name, then first-last.
	DisplayName string `json:"displayName" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	Email string `json:"email" api:"required"`
	// A date string in the form YYYY-MM-DD
	EndDate       string `json:"endDate" api:"required"`
	FirstName     string `json:"firstName" api:"required"`
	IsBusiness    bool   `json:"isBusiness" api:"required"`
	LastName      string `json:"lastName" api:"required"`
	Position      string `json:"position" api:"required"`
	PreferredName string `json:"preferredName" api:"required"`
	// A date string in the form YYYY-MM-DD
	StartDate string `json:"startDate" api:"required"`
	// Any of "draft", "invited", "onboarding", "active", "offboarding", "inactive".
	Status WorkerInviteResponseStatus `json:"status" api:"required"`
	// The IANA timezone of the worker (e.g., America/New_York).
	TimeZone string `json:"timeZone" api:"required"`
	// Any of "employee", "contractor".
	Type WorkerInviteResponseType `json:"type" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	WorkEmail string `json:"workEmail" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		BusinessName  respjson.Field
		Department    respjson.Field
		DisplayName   respjson.Field
		Email         respjson.Field
		EndDate       respjson.Field
		FirstName     respjson.Field
		IsBusiness    respjson.Field
		LastName      respjson.Field
		Position      respjson.Field
		PreferredName respjson.Field
		StartDate     respjson.Field
		Status        respjson.Field
		TimeZone      respjson.Field
		Type          respjson.Field
		WorkEmail     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkerInviteResponse) RawJSON

func (r WorkerInviteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkerInviteResponse) UnmarshalJSON

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

type WorkerInviteResponseDepartment

type WorkerInviteResponseDepartment struct {
	// The unique public id of the department
	ID   string `json:"id" api:"required"`
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The department the worker belongs to, or null if unassigned.

func (WorkerInviteResponseDepartment) RawJSON

Returns the unmodified JSON received from the API

func (*WorkerInviteResponseDepartment) UnmarshalJSON

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

type WorkerInviteResponseStatus

type WorkerInviteResponseStatus string
const (
	WorkerInviteResponseStatusDraft       WorkerInviteResponseStatus = "draft"
	WorkerInviteResponseStatusInvited     WorkerInviteResponseStatus = "invited"
	WorkerInviteResponseStatusOnboarding  WorkerInviteResponseStatus = "onboarding"
	WorkerInviteResponseStatusActive      WorkerInviteResponseStatus = "active"
	WorkerInviteResponseStatusOffboarding WorkerInviteResponseStatus = "offboarding"
	WorkerInviteResponseStatusInactive    WorkerInviteResponseStatus = "inactive"
)

type WorkerInviteResponseType

type WorkerInviteResponseType string
const (
	WorkerInviteResponseTypeEmployee   WorkerInviteResponseType = "employee"
	WorkerInviteResponseTypeContractor WorkerInviteResponseType = "contractor"
)

type WorkerListParams

type WorkerListParams struct {
	// The id of the worker.
	AfterID param.Opt[string] `query:"afterId,omitzero" json:"-"`
	// The id of the worker.
	BeforeID param.Opt[string] `query:"beforeId,omitzero" json:"-"`
	// a number less than or equal to 100
	Limit     param.Opt[string] `query:"limit,omitzero" json:"-"`
	WorkEmail param.Opt[string] `query:"workEmail,omitzero" json:"-"`
	// Any of "draft", "invited", "onboarding", "active", "offboarding", "inactive".
	Statuses []string `query:"statuses,omitzero" json:"-"`
	// Any of "employee", "contractor".
	Types []string `query:"types,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WorkerListParams) URLQuery

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

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

type WorkerListResponse

type WorkerListResponse struct {
	// The id of the worker.
	ID           string `json:"id" api:"required"`
	BusinessName string `json:"businessName" api:"required"`
	// The department the worker belongs to, or null if unassigned.
	Department WorkerListResponseDepartment `json:"department" api:"required"`
	// The "ui" name of a worker. If it's a business contractor business name is used.
	// Otherwise we default to preferred name, then first-last.
	DisplayName string `json:"displayName" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	Email string `json:"email" api:"required"`
	// A date string in the form YYYY-MM-DD
	EndDate       string `json:"endDate" api:"required"`
	FirstName     string `json:"firstName" api:"required"`
	IsBusiness    bool   `json:"isBusiness" api:"required"`
	LastName      string `json:"lastName" api:"required"`
	Position      string `json:"position" api:"required"`
	PreferredName string `json:"preferredName" api:"required"`
	// A date string in the form YYYY-MM-DD
	StartDate string `json:"startDate" api:"required"`
	// Any of "draft", "invited", "onboarding", "active", "offboarding", "inactive".
	Status WorkerListResponseStatus `json:"status" api:"required"`
	// The IANA timezone of the worker (e.g., America/New_York).
	TimeZone string `json:"timeZone" api:"required"`
	// Any of "employee", "contractor".
	Type WorkerListResponseType `json:"type" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	WorkEmail string `json:"workEmail" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		BusinessName  respjson.Field
		Department    respjson.Field
		DisplayName   respjson.Field
		Email         respjson.Field
		EndDate       respjson.Field
		FirstName     respjson.Field
		IsBusiness    respjson.Field
		LastName      respjson.Field
		Position      respjson.Field
		PreferredName respjson.Field
		StartDate     respjson.Field
		Status        respjson.Field
		TimeZone      respjson.Field
		Type          respjson.Field
		WorkEmail     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkerListResponse) RawJSON

func (r WorkerListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkerListResponse) UnmarshalJSON

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

type WorkerListResponseDepartment

type WorkerListResponseDepartment struct {
	// The unique public id of the department
	ID   string `json:"id" api:"required"`
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The department the worker belongs to, or null if unassigned.

func (WorkerListResponseDepartment) RawJSON

Returns the unmodified JSON received from the API

func (*WorkerListResponseDepartment) UnmarshalJSON

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

type WorkerListResponseStatus

type WorkerListResponseStatus string
const (
	WorkerListResponseStatusDraft       WorkerListResponseStatus = "draft"
	WorkerListResponseStatusInvited     WorkerListResponseStatus = "invited"
	WorkerListResponseStatusOnboarding  WorkerListResponseStatus = "onboarding"
	WorkerListResponseStatusActive      WorkerListResponseStatus = "active"
	WorkerListResponseStatusOffboarding WorkerListResponseStatus = "offboarding"
	WorkerListResponseStatusInactive    WorkerListResponseStatus = "inactive"
)

type WorkerListResponseType

type WorkerListResponseType string
const (
	WorkerListResponseTypeEmployee   WorkerListResponseType = "employee"
	WorkerListResponseTypeContractor WorkerListResponseType = "contractor"
)

type WorkerNewContractorParams

type WorkerNewContractorParams struct {
	// The department to assign this contractor to.
	DepartmentID string `json:"departmentId" api:"required"`
	// Personal email address. The invite will be sent here.
	Email string `json:"email" api:"required"`
	// Whether the contractor is an individual person or a business entity.
	//
	// Any of "individual", "business".
	EntityType WorkerNewContractorParamsEntityType `json:"entityType,omitzero" api:"required"`
	// a non empty string
	FirstName string `json:"firstName" api:"required"`
	// a non empty string
	LastName string `json:"lastName" api:"required"`
	// The worker id of this contractor's direct manager.
	ManagerID string `json:"managerId" api:"required"`
	// The contractor's role or job title.
	Position string `json:"position" api:"required"`
	// A date string in the form YYYY-MM-DD
	StartDate string `json:"startDate" api:"required"`
	// Any of "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT",
	// "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ",
	// "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA",
	// "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU",
	// "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE",
	// "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB",
	// "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS",
	// "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL",
	// "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG",
	// "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI",
	// "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG",
	// "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV",
	// "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP",
	// "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN",
	// "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB",
	// "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR",
	// "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK",
	// "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US",
	// "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "XK", "YE",
	// "YT", "ZA", "ZM", "ZW".
	WorkCountry WorkerNewContractorParamsWorkCountry `json:"workCountry,omitzero" api:"required"`
	// A description of the work the contractor will perform.
	ScopeOfWork param.Opt[string] `json:"scopeOfWork,omitzero"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	WorkEmail param.Opt[string] `json:"workEmail,omitzero"`
	// Required when entityType is "business". The legal name of the contractor's
	// business.
	BusinessName param.Opt[string] `json:"businessName,omitzero"`
	// The pay rate for the contractor. Leave this blank if you'd like to pay this
	// contractor on-demand or via invoicing.
	Compensation WorkerNewContractorParamsCompensation `json:"compensation,omitzero"`
	// The contractor's pay schedule. Must be a pay schedule that the company has
	// configured.
	//
	// Any of "weekly", "biweekly", "monthly", "semimonthly", "quarterly", "annually".
	PaySchedule WorkerNewContractorParamsPaySchedule `json:"paySchedule,omitzero"`
	// contains filtered or unexported fields
}

func (WorkerNewContractorParams) MarshalJSON

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

func (*WorkerNewContractorParams) UnmarshalJSON

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

type WorkerNewContractorParamsCompensation

type WorkerNewContractorParamsCompensation struct {
	// a positive number
	Amount float64 `json:"amount" api:"required"`
	// Any of "USD", "AUD", "BGN", "BRL", "CAD", "CHF", "CZK", "DKK", "EUR", "GBP",
	// "HKD", "HUF", "IDR", "INR", "JPY", "MYR", "NOK", "NZD", "CNY", "PLN", "RON",
	// "TRY", "SEK", "SGD", "AED", "ARS", "BDT", "BWP", "CLP", "COP", "CRC", "EGP",
	// "FJD", "GEL", "GHS", "ILS", "KES", "KRW", "LKR", "MAD", "MXN", "NPR", "PHP",
	// "PKR", "THB", "UAH", "UGX", "UYU", "VND", "ZAR", "ZMW", "TND", "NGN", "RSD",
	// "TWD", "GTQ", "HNL", "DOP", "SAR", "XAF", "PEN".
	Currency string `json:"currency,omitzero" api:"required"`
	// The pay period for the compensation amount.
	//
	// Any of "hour", "year", "month", "week".
	Per string `json:"per,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The pay rate for the contractor. Leave this blank if you'd like to pay this contractor on-demand or via invoicing.

The properties Amount, Currency, Per are required.

func (WorkerNewContractorParamsCompensation) MarshalJSON

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

func (*WorkerNewContractorParamsCompensation) UnmarshalJSON

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

type WorkerNewContractorParamsEntityType

type WorkerNewContractorParamsEntityType string

Whether the contractor is an individual person or a business entity.

const (
	WorkerNewContractorParamsEntityTypeIndividual WorkerNewContractorParamsEntityType = "individual"
	WorkerNewContractorParamsEntityTypeBusiness   WorkerNewContractorParamsEntityType = "business"
)

type WorkerNewContractorParamsPaySchedule

type WorkerNewContractorParamsPaySchedule string

The contractor's pay schedule. Must be a pay schedule that the company has configured.

const (
	WorkerNewContractorParamsPayScheduleWeekly      WorkerNewContractorParamsPaySchedule = "weekly"
	WorkerNewContractorParamsPayScheduleBiweekly    WorkerNewContractorParamsPaySchedule = "biweekly"
	WorkerNewContractorParamsPayScheduleMonthly     WorkerNewContractorParamsPaySchedule = "monthly"
	WorkerNewContractorParamsPayScheduleSemimonthly WorkerNewContractorParamsPaySchedule = "semimonthly"
	WorkerNewContractorParamsPayScheduleQuarterly   WorkerNewContractorParamsPaySchedule = "quarterly"
	WorkerNewContractorParamsPayScheduleAnnually    WorkerNewContractorParamsPaySchedule = "annually"
)

type WorkerNewContractorParamsWorkCountry

type WorkerNewContractorParamsWorkCountry string
const (
	WorkerNewContractorParamsWorkCountryAd WorkerNewContractorParamsWorkCountry = "AD"
	WorkerNewContractorParamsWorkCountryAe WorkerNewContractorParamsWorkCountry = "AE"
	WorkerNewContractorParamsWorkCountryAf WorkerNewContractorParamsWorkCountry = "AF"
	WorkerNewContractorParamsWorkCountryAg WorkerNewContractorParamsWorkCountry = "AG"
	WorkerNewContractorParamsWorkCountryAI WorkerNewContractorParamsWorkCountry = "AI"
	WorkerNewContractorParamsWorkCountryAl WorkerNewContractorParamsWorkCountry = "AL"
	WorkerNewContractorParamsWorkCountryAm WorkerNewContractorParamsWorkCountry = "AM"
	WorkerNewContractorParamsWorkCountryAo WorkerNewContractorParamsWorkCountry = "AO"
	WorkerNewContractorParamsWorkCountryAq WorkerNewContractorParamsWorkCountry = "AQ"
	WorkerNewContractorParamsWorkCountryAr WorkerNewContractorParamsWorkCountry = "AR"
	WorkerNewContractorParamsWorkCountryAs WorkerNewContractorParamsWorkCountry = "AS"
	WorkerNewContractorParamsWorkCountryAt WorkerNewContractorParamsWorkCountry = "AT"
	WorkerNewContractorParamsWorkCountryAu WorkerNewContractorParamsWorkCountry = "AU"
	WorkerNewContractorParamsWorkCountryAw WorkerNewContractorParamsWorkCountry = "AW"
	WorkerNewContractorParamsWorkCountryAx WorkerNewContractorParamsWorkCountry = "AX"
	WorkerNewContractorParamsWorkCountryAz WorkerNewContractorParamsWorkCountry = "AZ"
	WorkerNewContractorParamsWorkCountryBa WorkerNewContractorParamsWorkCountry = "BA"
	WorkerNewContractorParamsWorkCountryBb WorkerNewContractorParamsWorkCountry = "BB"
	WorkerNewContractorParamsWorkCountryBd WorkerNewContractorParamsWorkCountry = "BD"
	WorkerNewContractorParamsWorkCountryBe WorkerNewContractorParamsWorkCountry = "BE"
	WorkerNewContractorParamsWorkCountryBf WorkerNewContractorParamsWorkCountry = "BF"
	WorkerNewContractorParamsWorkCountryBg WorkerNewContractorParamsWorkCountry = "BG"
	WorkerNewContractorParamsWorkCountryBh WorkerNewContractorParamsWorkCountry = "BH"
	WorkerNewContractorParamsWorkCountryBi WorkerNewContractorParamsWorkCountry = "BI"
	WorkerNewContractorParamsWorkCountryBj WorkerNewContractorParamsWorkCountry = "BJ"
	WorkerNewContractorParamsWorkCountryBl WorkerNewContractorParamsWorkCountry = "BL"
	WorkerNewContractorParamsWorkCountryBm WorkerNewContractorParamsWorkCountry = "BM"
	WorkerNewContractorParamsWorkCountryBn WorkerNewContractorParamsWorkCountry = "BN"
	WorkerNewContractorParamsWorkCountryBo WorkerNewContractorParamsWorkCountry = "BO"
	WorkerNewContractorParamsWorkCountryBq WorkerNewContractorParamsWorkCountry = "BQ"
	WorkerNewContractorParamsWorkCountryBr WorkerNewContractorParamsWorkCountry = "BR"
	WorkerNewContractorParamsWorkCountryBs WorkerNewContractorParamsWorkCountry = "BS"
	WorkerNewContractorParamsWorkCountryBt WorkerNewContractorParamsWorkCountry = "BT"
	WorkerNewContractorParamsWorkCountryBv WorkerNewContractorParamsWorkCountry = "BV"
	WorkerNewContractorParamsWorkCountryBw WorkerNewContractorParamsWorkCountry = "BW"
	WorkerNewContractorParamsWorkCountryBy WorkerNewContractorParamsWorkCountry = "BY"
	WorkerNewContractorParamsWorkCountryBz WorkerNewContractorParamsWorkCountry = "BZ"
	WorkerNewContractorParamsWorkCountryCa WorkerNewContractorParamsWorkCountry = "CA"
	WorkerNewContractorParamsWorkCountryCc WorkerNewContractorParamsWorkCountry = "CC"
	WorkerNewContractorParamsWorkCountryCd WorkerNewContractorParamsWorkCountry = "CD"
	WorkerNewContractorParamsWorkCountryCf WorkerNewContractorParamsWorkCountry = "CF"
	WorkerNewContractorParamsWorkCountryCg WorkerNewContractorParamsWorkCountry = "CG"
	WorkerNewContractorParamsWorkCountryCh WorkerNewContractorParamsWorkCountry = "CH"
	WorkerNewContractorParamsWorkCountryCi WorkerNewContractorParamsWorkCountry = "CI"
	WorkerNewContractorParamsWorkCountryCk WorkerNewContractorParamsWorkCountry = "CK"
	WorkerNewContractorParamsWorkCountryCl WorkerNewContractorParamsWorkCountry = "CL"
	WorkerNewContractorParamsWorkCountryCm WorkerNewContractorParamsWorkCountry = "CM"
	WorkerNewContractorParamsWorkCountryCn WorkerNewContractorParamsWorkCountry = "CN"
	WorkerNewContractorParamsWorkCountryCo WorkerNewContractorParamsWorkCountry = "CO"
	WorkerNewContractorParamsWorkCountryCr WorkerNewContractorParamsWorkCountry = "CR"
	WorkerNewContractorParamsWorkCountryCu WorkerNewContractorParamsWorkCountry = "CU"
	WorkerNewContractorParamsWorkCountryCv WorkerNewContractorParamsWorkCountry = "CV"
	WorkerNewContractorParamsWorkCountryCw WorkerNewContractorParamsWorkCountry = "CW"
	WorkerNewContractorParamsWorkCountryCx WorkerNewContractorParamsWorkCountry = "CX"
	WorkerNewContractorParamsWorkCountryCy WorkerNewContractorParamsWorkCountry = "CY"
	WorkerNewContractorParamsWorkCountryCz WorkerNewContractorParamsWorkCountry = "CZ"
	WorkerNewContractorParamsWorkCountryDe WorkerNewContractorParamsWorkCountry = "DE"
	WorkerNewContractorParamsWorkCountryDj WorkerNewContractorParamsWorkCountry = "DJ"
	WorkerNewContractorParamsWorkCountryDk WorkerNewContractorParamsWorkCountry = "DK"
	WorkerNewContractorParamsWorkCountryDm WorkerNewContractorParamsWorkCountry = "DM"
	WorkerNewContractorParamsWorkCountryDo WorkerNewContractorParamsWorkCountry = "DO"
	WorkerNewContractorParamsWorkCountryDz WorkerNewContractorParamsWorkCountry = "DZ"
	WorkerNewContractorParamsWorkCountryEc WorkerNewContractorParamsWorkCountry = "EC"
	WorkerNewContractorParamsWorkCountryEe WorkerNewContractorParamsWorkCountry = "EE"
	WorkerNewContractorParamsWorkCountryEg WorkerNewContractorParamsWorkCountry = "EG"
	WorkerNewContractorParamsWorkCountryEh WorkerNewContractorParamsWorkCountry = "EH"
	WorkerNewContractorParamsWorkCountryEr WorkerNewContractorParamsWorkCountry = "ER"
	WorkerNewContractorParamsWorkCountryEs WorkerNewContractorParamsWorkCountry = "ES"
	WorkerNewContractorParamsWorkCountryEt WorkerNewContractorParamsWorkCountry = "ET"
	WorkerNewContractorParamsWorkCountryFi WorkerNewContractorParamsWorkCountry = "FI"
	WorkerNewContractorParamsWorkCountryFj WorkerNewContractorParamsWorkCountry = "FJ"
	WorkerNewContractorParamsWorkCountryFk WorkerNewContractorParamsWorkCountry = "FK"
	WorkerNewContractorParamsWorkCountryFm WorkerNewContractorParamsWorkCountry = "FM"
	WorkerNewContractorParamsWorkCountryFo WorkerNewContractorParamsWorkCountry = "FO"
	WorkerNewContractorParamsWorkCountryFr WorkerNewContractorParamsWorkCountry = "FR"
	WorkerNewContractorParamsWorkCountryGa WorkerNewContractorParamsWorkCountry = "GA"
	WorkerNewContractorParamsWorkCountryGB WorkerNewContractorParamsWorkCountry = "GB"
	WorkerNewContractorParamsWorkCountryGd WorkerNewContractorParamsWorkCountry = "GD"
	WorkerNewContractorParamsWorkCountryGe WorkerNewContractorParamsWorkCountry = "GE"
	WorkerNewContractorParamsWorkCountryGf WorkerNewContractorParamsWorkCountry = "GF"
	WorkerNewContractorParamsWorkCountryGg WorkerNewContractorParamsWorkCountry = "GG"
	WorkerNewContractorParamsWorkCountryGh WorkerNewContractorParamsWorkCountry = "GH"
	WorkerNewContractorParamsWorkCountryGi WorkerNewContractorParamsWorkCountry = "GI"
	WorkerNewContractorParamsWorkCountryGl WorkerNewContractorParamsWorkCountry = "GL"
	WorkerNewContractorParamsWorkCountryGm WorkerNewContractorParamsWorkCountry = "GM"
	WorkerNewContractorParamsWorkCountryGn WorkerNewContractorParamsWorkCountry = "GN"
	WorkerNewContractorParamsWorkCountryGp WorkerNewContractorParamsWorkCountry = "GP"
	WorkerNewContractorParamsWorkCountryGq WorkerNewContractorParamsWorkCountry = "GQ"
	WorkerNewContractorParamsWorkCountryGr WorkerNewContractorParamsWorkCountry = "GR"
	WorkerNewContractorParamsWorkCountryGs WorkerNewContractorParamsWorkCountry = "GS"
	WorkerNewContractorParamsWorkCountryGt WorkerNewContractorParamsWorkCountry = "GT"
	WorkerNewContractorParamsWorkCountryGu WorkerNewContractorParamsWorkCountry = "GU"
	WorkerNewContractorParamsWorkCountryGw WorkerNewContractorParamsWorkCountry = "GW"
	WorkerNewContractorParamsWorkCountryGy WorkerNewContractorParamsWorkCountry = "GY"
	WorkerNewContractorParamsWorkCountryHk WorkerNewContractorParamsWorkCountry = "HK"
	WorkerNewContractorParamsWorkCountryHm WorkerNewContractorParamsWorkCountry = "HM"
	WorkerNewContractorParamsWorkCountryHn WorkerNewContractorParamsWorkCountry = "HN"
	WorkerNewContractorParamsWorkCountryHr WorkerNewContractorParamsWorkCountry = "HR"
	WorkerNewContractorParamsWorkCountryHt WorkerNewContractorParamsWorkCountry = "HT"
	WorkerNewContractorParamsWorkCountryHu WorkerNewContractorParamsWorkCountry = "HU"
	WorkerNewContractorParamsWorkCountryID WorkerNewContractorParamsWorkCountry = "ID"
	WorkerNewContractorParamsWorkCountryIe WorkerNewContractorParamsWorkCountry = "IE"
	WorkerNewContractorParamsWorkCountryIl WorkerNewContractorParamsWorkCountry = "IL"
	WorkerNewContractorParamsWorkCountryIm WorkerNewContractorParamsWorkCountry = "IM"
	WorkerNewContractorParamsWorkCountryIn WorkerNewContractorParamsWorkCountry = "IN"
	WorkerNewContractorParamsWorkCountryIo WorkerNewContractorParamsWorkCountry = "IO"
	WorkerNewContractorParamsWorkCountryIq WorkerNewContractorParamsWorkCountry = "IQ"
	WorkerNewContractorParamsWorkCountryIr WorkerNewContractorParamsWorkCountry = "IR"
	WorkerNewContractorParamsWorkCountryIs WorkerNewContractorParamsWorkCountry = "IS"
	WorkerNewContractorParamsWorkCountryIt WorkerNewContractorParamsWorkCountry = "IT"
	WorkerNewContractorParamsWorkCountryJe WorkerNewContractorParamsWorkCountry = "JE"
	WorkerNewContractorParamsWorkCountryJm WorkerNewContractorParamsWorkCountry = "JM"
	WorkerNewContractorParamsWorkCountryJo WorkerNewContractorParamsWorkCountry = "JO"
	WorkerNewContractorParamsWorkCountryJp WorkerNewContractorParamsWorkCountry = "JP"
	WorkerNewContractorParamsWorkCountryKe WorkerNewContractorParamsWorkCountry = "KE"
	WorkerNewContractorParamsWorkCountryKg WorkerNewContractorParamsWorkCountry = "KG"
	WorkerNewContractorParamsWorkCountryKh WorkerNewContractorParamsWorkCountry = "KH"
	WorkerNewContractorParamsWorkCountryKi WorkerNewContractorParamsWorkCountry = "KI"
	WorkerNewContractorParamsWorkCountryKm WorkerNewContractorParamsWorkCountry = "KM"
	WorkerNewContractorParamsWorkCountryKn WorkerNewContractorParamsWorkCountry = "KN"
	WorkerNewContractorParamsWorkCountryKp WorkerNewContractorParamsWorkCountry = "KP"
	WorkerNewContractorParamsWorkCountryKr WorkerNewContractorParamsWorkCountry = "KR"
	WorkerNewContractorParamsWorkCountryKw WorkerNewContractorParamsWorkCountry = "KW"
	WorkerNewContractorParamsWorkCountryKy WorkerNewContractorParamsWorkCountry = "KY"
	WorkerNewContractorParamsWorkCountryKz WorkerNewContractorParamsWorkCountry = "KZ"
	WorkerNewContractorParamsWorkCountryLa WorkerNewContractorParamsWorkCountry = "LA"
	WorkerNewContractorParamsWorkCountryLb WorkerNewContractorParamsWorkCountry = "LB"
	WorkerNewContractorParamsWorkCountryLc WorkerNewContractorParamsWorkCountry = "LC"
	WorkerNewContractorParamsWorkCountryLi WorkerNewContractorParamsWorkCountry = "LI"
	WorkerNewContractorParamsWorkCountryLk WorkerNewContractorParamsWorkCountry = "LK"
	WorkerNewContractorParamsWorkCountryLr WorkerNewContractorParamsWorkCountry = "LR"
	WorkerNewContractorParamsWorkCountryLs WorkerNewContractorParamsWorkCountry = "LS"
	WorkerNewContractorParamsWorkCountryLt WorkerNewContractorParamsWorkCountry = "LT"
	WorkerNewContractorParamsWorkCountryLu WorkerNewContractorParamsWorkCountry = "LU"
	WorkerNewContractorParamsWorkCountryLv WorkerNewContractorParamsWorkCountry = "LV"
	WorkerNewContractorParamsWorkCountryLy WorkerNewContractorParamsWorkCountry = "LY"
	WorkerNewContractorParamsWorkCountryMa WorkerNewContractorParamsWorkCountry = "MA"
	WorkerNewContractorParamsWorkCountryMc WorkerNewContractorParamsWorkCountry = "MC"
	WorkerNewContractorParamsWorkCountryMd WorkerNewContractorParamsWorkCountry = "MD"
	WorkerNewContractorParamsWorkCountryMe WorkerNewContractorParamsWorkCountry = "ME"
	WorkerNewContractorParamsWorkCountryMf WorkerNewContractorParamsWorkCountry = "MF"
	WorkerNewContractorParamsWorkCountryMg WorkerNewContractorParamsWorkCountry = "MG"
	WorkerNewContractorParamsWorkCountryMh WorkerNewContractorParamsWorkCountry = "MH"
	WorkerNewContractorParamsWorkCountryMk WorkerNewContractorParamsWorkCountry = "MK"
	WorkerNewContractorParamsWorkCountryMl WorkerNewContractorParamsWorkCountry = "ML"
	WorkerNewContractorParamsWorkCountryMm WorkerNewContractorParamsWorkCountry = "MM"
	WorkerNewContractorParamsWorkCountryMn WorkerNewContractorParamsWorkCountry = "MN"
	WorkerNewContractorParamsWorkCountryMo WorkerNewContractorParamsWorkCountry = "MO"
	WorkerNewContractorParamsWorkCountryMp WorkerNewContractorParamsWorkCountry = "MP"
	WorkerNewContractorParamsWorkCountryMq WorkerNewContractorParamsWorkCountry = "MQ"
	WorkerNewContractorParamsWorkCountryMr WorkerNewContractorParamsWorkCountry = "MR"
	WorkerNewContractorParamsWorkCountryMs WorkerNewContractorParamsWorkCountry = "MS"
	WorkerNewContractorParamsWorkCountryMt WorkerNewContractorParamsWorkCountry = "MT"
	WorkerNewContractorParamsWorkCountryMu WorkerNewContractorParamsWorkCountry = "MU"
	WorkerNewContractorParamsWorkCountryMv WorkerNewContractorParamsWorkCountry = "MV"
	WorkerNewContractorParamsWorkCountryMw WorkerNewContractorParamsWorkCountry = "MW"
	WorkerNewContractorParamsWorkCountryMx WorkerNewContractorParamsWorkCountry = "MX"
	WorkerNewContractorParamsWorkCountryMy WorkerNewContractorParamsWorkCountry = "MY"
	WorkerNewContractorParamsWorkCountryMz WorkerNewContractorParamsWorkCountry = "MZ"
	WorkerNewContractorParamsWorkCountryNa WorkerNewContractorParamsWorkCountry = "NA"
	WorkerNewContractorParamsWorkCountryNc WorkerNewContractorParamsWorkCountry = "NC"
	WorkerNewContractorParamsWorkCountryNe WorkerNewContractorParamsWorkCountry = "NE"
	WorkerNewContractorParamsWorkCountryNf WorkerNewContractorParamsWorkCountry = "NF"
	WorkerNewContractorParamsWorkCountryNg WorkerNewContractorParamsWorkCountry = "NG"
	WorkerNewContractorParamsWorkCountryNi WorkerNewContractorParamsWorkCountry = "NI"
	WorkerNewContractorParamsWorkCountryNl WorkerNewContractorParamsWorkCountry = "NL"
	WorkerNewContractorParamsWorkCountryNo WorkerNewContractorParamsWorkCountry = "NO"
	WorkerNewContractorParamsWorkCountryNp WorkerNewContractorParamsWorkCountry = "NP"
	WorkerNewContractorParamsWorkCountryNr WorkerNewContractorParamsWorkCountry = "NR"
	WorkerNewContractorParamsWorkCountryNu WorkerNewContractorParamsWorkCountry = "NU"
	WorkerNewContractorParamsWorkCountryNz WorkerNewContractorParamsWorkCountry = "NZ"
	WorkerNewContractorParamsWorkCountryOm WorkerNewContractorParamsWorkCountry = "OM"
	WorkerNewContractorParamsWorkCountryPa WorkerNewContractorParamsWorkCountry = "PA"
	WorkerNewContractorParamsWorkCountryPe WorkerNewContractorParamsWorkCountry = "PE"
	WorkerNewContractorParamsWorkCountryPf WorkerNewContractorParamsWorkCountry = "PF"
	WorkerNewContractorParamsWorkCountryPg WorkerNewContractorParamsWorkCountry = "PG"
	WorkerNewContractorParamsWorkCountryPh WorkerNewContractorParamsWorkCountry = "PH"
	WorkerNewContractorParamsWorkCountryPk WorkerNewContractorParamsWorkCountry = "PK"
	WorkerNewContractorParamsWorkCountryPl WorkerNewContractorParamsWorkCountry = "PL"
	WorkerNewContractorParamsWorkCountryPm WorkerNewContractorParamsWorkCountry = "PM"
	WorkerNewContractorParamsWorkCountryPn WorkerNewContractorParamsWorkCountry = "PN"
	WorkerNewContractorParamsWorkCountryPr WorkerNewContractorParamsWorkCountry = "PR"
	WorkerNewContractorParamsWorkCountryPs WorkerNewContractorParamsWorkCountry = "PS"
	WorkerNewContractorParamsWorkCountryPt WorkerNewContractorParamsWorkCountry = "PT"
	WorkerNewContractorParamsWorkCountryPw WorkerNewContractorParamsWorkCountry = "PW"
	WorkerNewContractorParamsWorkCountryPy WorkerNewContractorParamsWorkCountry = "PY"
	WorkerNewContractorParamsWorkCountryQa WorkerNewContractorParamsWorkCountry = "QA"
	WorkerNewContractorParamsWorkCountryRe WorkerNewContractorParamsWorkCountry = "RE"
	WorkerNewContractorParamsWorkCountryRo WorkerNewContractorParamsWorkCountry = "RO"
	WorkerNewContractorParamsWorkCountryRs WorkerNewContractorParamsWorkCountry = "RS"
	WorkerNewContractorParamsWorkCountryRu WorkerNewContractorParamsWorkCountry = "RU"
	WorkerNewContractorParamsWorkCountryRw WorkerNewContractorParamsWorkCountry = "RW"
	WorkerNewContractorParamsWorkCountrySa WorkerNewContractorParamsWorkCountry = "SA"
	WorkerNewContractorParamsWorkCountrySb WorkerNewContractorParamsWorkCountry = "SB"
	WorkerNewContractorParamsWorkCountrySc WorkerNewContractorParamsWorkCountry = "SC"
	WorkerNewContractorParamsWorkCountrySd WorkerNewContractorParamsWorkCountry = "SD"
	WorkerNewContractorParamsWorkCountrySe WorkerNewContractorParamsWorkCountry = "SE"
	WorkerNewContractorParamsWorkCountrySg WorkerNewContractorParamsWorkCountry = "SG"
	WorkerNewContractorParamsWorkCountrySh WorkerNewContractorParamsWorkCountry = "SH"
	WorkerNewContractorParamsWorkCountrySi WorkerNewContractorParamsWorkCountry = "SI"
	WorkerNewContractorParamsWorkCountrySj WorkerNewContractorParamsWorkCountry = "SJ"
	WorkerNewContractorParamsWorkCountrySk WorkerNewContractorParamsWorkCountry = "SK"
	WorkerNewContractorParamsWorkCountrySl WorkerNewContractorParamsWorkCountry = "SL"
	WorkerNewContractorParamsWorkCountrySm WorkerNewContractorParamsWorkCountry = "SM"
	WorkerNewContractorParamsWorkCountrySn WorkerNewContractorParamsWorkCountry = "SN"
	WorkerNewContractorParamsWorkCountrySo WorkerNewContractorParamsWorkCountry = "SO"
	WorkerNewContractorParamsWorkCountrySr WorkerNewContractorParamsWorkCountry = "SR"
	WorkerNewContractorParamsWorkCountrySS WorkerNewContractorParamsWorkCountry = "SS"
	WorkerNewContractorParamsWorkCountrySt WorkerNewContractorParamsWorkCountry = "ST"
	WorkerNewContractorParamsWorkCountrySv WorkerNewContractorParamsWorkCountry = "SV"
	WorkerNewContractorParamsWorkCountrySx WorkerNewContractorParamsWorkCountry = "SX"
	WorkerNewContractorParamsWorkCountrySy WorkerNewContractorParamsWorkCountry = "SY"
	WorkerNewContractorParamsWorkCountrySz WorkerNewContractorParamsWorkCountry = "SZ"
	WorkerNewContractorParamsWorkCountryTc WorkerNewContractorParamsWorkCountry = "TC"
	WorkerNewContractorParamsWorkCountryTd WorkerNewContractorParamsWorkCountry = "TD"
	WorkerNewContractorParamsWorkCountryTf WorkerNewContractorParamsWorkCountry = "TF"
	WorkerNewContractorParamsWorkCountryTg WorkerNewContractorParamsWorkCountry = "TG"
	WorkerNewContractorParamsWorkCountryTh WorkerNewContractorParamsWorkCountry = "TH"
	WorkerNewContractorParamsWorkCountryTj WorkerNewContractorParamsWorkCountry = "TJ"
	WorkerNewContractorParamsWorkCountryTk WorkerNewContractorParamsWorkCountry = "TK"
	WorkerNewContractorParamsWorkCountryTl WorkerNewContractorParamsWorkCountry = "TL"
	WorkerNewContractorParamsWorkCountryTm WorkerNewContractorParamsWorkCountry = "TM"
	WorkerNewContractorParamsWorkCountryTn WorkerNewContractorParamsWorkCountry = "TN"
	WorkerNewContractorParamsWorkCountryTo WorkerNewContractorParamsWorkCountry = "TO"
	WorkerNewContractorParamsWorkCountryTr WorkerNewContractorParamsWorkCountry = "TR"
	WorkerNewContractorParamsWorkCountryTt WorkerNewContractorParamsWorkCountry = "TT"
	WorkerNewContractorParamsWorkCountryTv WorkerNewContractorParamsWorkCountry = "TV"
	WorkerNewContractorParamsWorkCountryTw WorkerNewContractorParamsWorkCountry = "TW"
	WorkerNewContractorParamsWorkCountryTz WorkerNewContractorParamsWorkCountry = "TZ"
	WorkerNewContractorParamsWorkCountryUa WorkerNewContractorParamsWorkCountry = "UA"
	WorkerNewContractorParamsWorkCountryUg WorkerNewContractorParamsWorkCountry = "UG"
	WorkerNewContractorParamsWorkCountryUm WorkerNewContractorParamsWorkCountry = "UM"
	WorkerNewContractorParamsWorkCountryUs WorkerNewContractorParamsWorkCountry = "US"
	WorkerNewContractorParamsWorkCountryUy WorkerNewContractorParamsWorkCountry = "UY"
	WorkerNewContractorParamsWorkCountryUz WorkerNewContractorParamsWorkCountry = "UZ"
	WorkerNewContractorParamsWorkCountryVa WorkerNewContractorParamsWorkCountry = "VA"
	WorkerNewContractorParamsWorkCountryVc WorkerNewContractorParamsWorkCountry = "VC"
	WorkerNewContractorParamsWorkCountryVe WorkerNewContractorParamsWorkCountry = "VE"
	WorkerNewContractorParamsWorkCountryVg WorkerNewContractorParamsWorkCountry = "VG"
	WorkerNewContractorParamsWorkCountryVi WorkerNewContractorParamsWorkCountry = "VI"
	WorkerNewContractorParamsWorkCountryVn WorkerNewContractorParamsWorkCountry = "VN"
	WorkerNewContractorParamsWorkCountryVu WorkerNewContractorParamsWorkCountry = "VU"
	WorkerNewContractorParamsWorkCountryWf WorkerNewContractorParamsWorkCountry = "WF"
	WorkerNewContractorParamsWorkCountryWs WorkerNewContractorParamsWorkCountry = "WS"
	WorkerNewContractorParamsWorkCountryXk WorkerNewContractorParamsWorkCountry = "XK"
	WorkerNewContractorParamsWorkCountryYe WorkerNewContractorParamsWorkCountry = "YE"
	WorkerNewContractorParamsWorkCountryYt WorkerNewContractorParamsWorkCountry = "YT"
	WorkerNewContractorParamsWorkCountryZa WorkerNewContractorParamsWorkCountry = "ZA"
	WorkerNewContractorParamsWorkCountryZm WorkerNewContractorParamsWorkCountry = "ZM"
	WorkerNewContractorParamsWorkCountryZw WorkerNewContractorParamsWorkCountry = "ZW"
)

type WorkerNewContractorResponse

type WorkerNewContractorResponse struct {
	// The id of the worker.
	ID           string `json:"id" api:"required"`
	BusinessName string `json:"businessName" api:"required"`
	// The department the worker belongs to, or null if unassigned.
	Department WorkerNewContractorResponseDepartment `json:"department" api:"required"`
	// The "ui" name of a worker. If it's a business contractor business name is used.
	// Otherwise we default to preferred name, then first-last.
	DisplayName string `json:"displayName" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	Email string `json:"email" api:"required"`
	// A date string in the form YYYY-MM-DD
	EndDate       string `json:"endDate" api:"required"`
	FirstName     string `json:"firstName" api:"required"`
	IsBusiness    bool   `json:"isBusiness" api:"required"`
	LastName      string `json:"lastName" api:"required"`
	Position      string `json:"position" api:"required"`
	PreferredName string `json:"preferredName" api:"required"`
	// A date string in the form YYYY-MM-DD
	StartDate string `json:"startDate" api:"required"`
	// Any of "draft", "invited", "onboarding", "active", "offboarding", "inactive".
	Status WorkerNewContractorResponseStatus `json:"status" api:"required"`
	// The IANA timezone of the worker (e.g., America/New_York).
	TimeZone string `json:"timeZone" api:"required"`
	// Any of "employee", "contractor".
	Type WorkerNewContractorResponseType `json:"type" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	WorkEmail string `json:"workEmail" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		BusinessName  respjson.Field
		Department    respjson.Field
		DisplayName   respjson.Field
		Email         respjson.Field
		EndDate       respjson.Field
		FirstName     respjson.Field
		IsBusiness    respjson.Field
		LastName      respjson.Field
		Position      respjson.Field
		PreferredName respjson.Field
		StartDate     respjson.Field
		Status        respjson.Field
		TimeZone      respjson.Field
		Type          respjson.Field
		WorkEmail     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkerNewContractorResponse) RawJSON

func (r WorkerNewContractorResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkerNewContractorResponse) UnmarshalJSON

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

type WorkerNewContractorResponseDepartment

type WorkerNewContractorResponseDepartment struct {
	// The unique public id of the department
	ID   string `json:"id" api:"required"`
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The department the worker belongs to, or null if unassigned.

func (WorkerNewContractorResponseDepartment) RawJSON

Returns the unmodified JSON received from the API

func (*WorkerNewContractorResponseDepartment) UnmarshalJSON

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

type WorkerNewContractorResponseStatus

type WorkerNewContractorResponseStatus string
const (
	WorkerNewContractorResponseStatusDraft       WorkerNewContractorResponseStatus = "draft"
	WorkerNewContractorResponseStatusInvited     WorkerNewContractorResponseStatus = "invited"
	WorkerNewContractorResponseStatusOnboarding  WorkerNewContractorResponseStatus = "onboarding"
	WorkerNewContractorResponseStatusActive      WorkerNewContractorResponseStatus = "active"
	WorkerNewContractorResponseStatusOffboarding WorkerNewContractorResponseStatus = "offboarding"
	WorkerNewContractorResponseStatusInactive    WorkerNewContractorResponseStatus = "inactive"
)

type WorkerNewContractorResponseType

type WorkerNewContractorResponseType string
const (
	WorkerNewContractorResponseTypeEmployee   WorkerNewContractorResponseType = "employee"
	WorkerNewContractorResponseTypeContractor WorkerNewContractorResponseType = "contractor"
)

type WorkerNewEmployeeParams

type WorkerNewEmployeeParams struct {
	// The employee's base compensation.
	Compensation WorkerNewEmployeeParamsCompensation `json:"compensation,omitzero" api:"required"`
	// The department to assign this employee to.
	DepartmentID string `json:"departmentId" api:"required"`
	// Personal email address. The invite will be sent here.
	Email string `json:"email" api:"required"`
	// a non empty string
	FirstName string `json:"firstName" api:"required"`
	// a non empty string
	LastName string `json:"lastName" api:"required"`
	// The worker id of this employee's direct manager.
	ManagerID string `json:"managerId" api:"required"`
	// The employee's job title.
	Position string `json:"position" api:"required"`
	// A date string in the form YYYY-MM-DD
	StartDate string `json:"startDate" api:"required"`
	// Where the employee will work. Either an existing company workplace or a remote
	// US state.
	WorkLocation WorkerNewEmployeeParamsWorkLocationUnion `json:"workLocation,omitzero" api:"required"`
	// a non-negative number
	StockOptions param.Opt[float64] `json:"stockOptions,omitzero"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	WorkEmail param.Opt[string] `json:"workEmail,omitzero"`
	// Whether the employee is required to complete I-9 work authorization. Set to
	// false if the employee has already been verified off-platform. Defaults to true.
	RequireI9 param.Opt[bool] `json:"requireI9,omitzero"`
	// The employee's pay schedule. Must be a pay schedule that the company has
	// configured.
	//
	// Any of "weekly", "biweekly", "monthly", "semimonthly", "quarterly", "annually".
	PaySchedule WorkerNewEmployeeParamsPaySchedule `json:"paySchedule,omitzero"`
	// How state tax registration is handled for this employee's work state. Required
	// when hiring in a state where your company doesn't have an existing registration.
	// Use 'self_managed' if you've already registered in this state, or 'warp_managed'
	// for Warp to handle registration on your behalf.
	//
	// Any of "self_managed", "warp_managed".
	StateRegistration WorkerNewEmployeeParamsStateRegistration `json:"stateRegistration,omitzero"`
	// contains filtered or unexported fields
}

func (WorkerNewEmployeeParams) MarshalJSON

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

func (*WorkerNewEmployeeParams) UnmarshalJSON

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

type WorkerNewEmployeeParamsCompensation

type WorkerNewEmployeeParamsCompensation struct {
	// a positive number
	Amount float64 `json:"amount" api:"required"`
	// Whether the amount is per hour or per year.
	//
	// Any of "hour", "year".
	Per string `json:"per,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The employee's base compensation.

The properties Amount, Per are required.

func (WorkerNewEmployeeParamsCompensation) MarshalJSON

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

func (*WorkerNewEmployeeParamsCompensation) UnmarshalJSON

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

type WorkerNewEmployeeParamsPaySchedule

type WorkerNewEmployeeParamsPaySchedule string

The employee's pay schedule. Must be a pay schedule that the company has configured.

const (
	WorkerNewEmployeeParamsPayScheduleWeekly      WorkerNewEmployeeParamsPaySchedule = "weekly"
	WorkerNewEmployeeParamsPayScheduleBiweekly    WorkerNewEmployeeParamsPaySchedule = "biweekly"
	WorkerNewEmployeeParamsPayScheduleMonthly     WorkerNewEmployeeParamsPaySchedule = "monthly"
	WorkerNewEmployeeParamsPayScheduleSemimonthly WorkerNewEmployeeParamsPaySchedule = "semimonthly"
	WorkerNewEmployeeParamsPayScheduleQuarterly   WorkerNewEmployeeParamsPaySchedule = "quarterly"
	WorkerNewEmployeeParamsPayScheduleAnnually    WorkerNewEmployeeParamsPaySchedule = "annually"
)

type WorkerNewEmployeeParamsStateRegistration

type WorkerNewEmployeeParamsStateRegistration string

How state tax registration is handled for this employee's work state. Required when hiring in a state where your company doesn't have an existing registration. Use 'self_managed' if you've already registered in this state, or 'warp_managed' for Warp to handle registration on your behalf.

const (
	WorkerNewEmployeeParamsStateRegistrationSelfManaged WorkerNewEmployeeParamsStateRegistration = "self_managed"
	WorkerNewEmployeeParamsStateRegistrationWarpManaged WorkerNewEmployeeParamsStateRegistration = "warp_managed"
)

type WorkerNewEmployeeParamsWorkLocationOfficeWorkLocation added in v0.1.0

type WorkerNewEmployeeParamsWorkLocationOfficeWorkLocation struct {
	// Any of "office".
	Type string `json:"type,omitzero" api:"required"`
	// Public workplace identifier
	WorkplaceID string `json:"workplaceId" api:"required"`
	// contains filtered or unexported fields
}

Employee works from a company workplace.

The properties Type, WorkplaceID are required.

func (WorkerNewEmployeeParamsWorkLocationOfficeWorkLocation) MarshalJSON added in v0.1.0

func (*WorkerNewEmployeeParamsWorkLocationOfficeWorkLocation) UnmarshalJSON added in v0.1.0

type WorkerNewEmployeeParamsWorkLocationRemoteWorkLocation added in v0.1.0

type WorkerNewEmployeeParamsWorkLocationRemoteWorkLocation struct {
	// The US state where the remote employee works. Required for tax purposes.
	//
	// Any of "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI",
	// "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS",
	// "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR",
	// "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY".
	State string `json:"state,omitzero" api:"required"`
	// Any of "remote".
	Type string `json:"type,omitzero" api:"required"`
	// contains filtered or unexported fields
}

Employee works remotely from a US state.

The properties State, Type are required.

func (WorkerNewEmployeeParamsWorkLocationRemoteWorkLocation) MarshalJSON added in v0.1.0

func (*WorkerNewEmployeeParamsWorkLocationRemoteWorkLocation) UnmarshalJSON added in v0.1.0

type WorkerNewEmployeeParamsWorkLocationUnion

type WorkerNewEmployeeParamsWorkLocationUnion struct {
	OfWorkerNewEmployeesWorkLocationOfficeWorkLocation *WorkerNewEmployeeParamsWorkLocationOfficeWorkLocation `json:",omitzero,inline"`
	OfWorkerNewEmployeesWorkLocationRemoteWorkLocation *WorkerNewEmployeeParamsWorkLocationRemoteWorkLocation `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

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

func (WorkerNewEmployeeParamsWorkLocationUnion) MarshalJSON

func (*WorkerNewEmployeeParamsWorkLocationUnion) UnmarshalJSON

func (u *WorkerNewEmployeeParamsWorkLocationUnion) UnmarshalJSON(data []byte) error

type WorkerNewEmployeeResponse

type WorkerNewEmployeeResponse struct {
	// The id of the worker.
	ID           string `json:"id" api:"required"`
	BusinessName string `json:"businessName" api:"required"`
	// The department the worker belongs to, or null if unassigned.
	Department WorkerNewEmployeeResponseDepartment `json:"department" api:"required"`
	// The "ui" name of a worker. If it's a business contractor business name is used.
	// Otherwise we default to preferred name, then first-last.
	DisplayName string `json:"displayName" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	Email string `json:"email" api:"required"`
	// A date string in the form YYYY-MM-DD
	EndDate       string `json:"endDate" api:"required"`
	FirstName     string `json:"firstName" api:"required"`
	IsBusiness    bool   `json:"isBusiness" api:"required"`
	LastName      string `json:"lastName" api:"required"`
	Position      string `json:"position" api:"required"`
	PreferredName string `json:"preferredName" api:"required"`
	// A date string in the form YYYY-MM-DD
	StartDate string `json:"startDate" api:"required"`
	// Any of "draft", "invited", "onboarding", "active", "offboarding", "inactive".
	Status WorkerNewEmployeeResponseStatus `json:"status" api:"required"`
	// The IANA timezone of the worker (e.g., America/New_York).
	TimeZone string `json:"timeZone" api:"required"`
	// Any of "employee", "contractor".
	Type WorkerNewEmployeeResponseType `json:"type" api:"required"`
	// An email with a reasonably valid regex (shamelessly taken from zod)
	WorkEmail string `json:"workEmail" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		BusinessName  respjson.Field
		Department    respjson.Field
		DisplayName   respjson.Field
		Email         respjson.Field
		EndDate       respjson.Field
		FirstName     respjson.Field
		IsBusiness    respjson.Field
		LastName      respjson.Field
		Position      respjson.Field
		PreferredName respjson.Field
		StartDate     respjson.Field
		Status        respjson.Field
		TimeZone      respjson.Field
		Type          respjson.Field
		WorkEmail     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkerNewEmployeeResponse) RawJSON

func (r WorkerNewEmployeeResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkerNewEmployeeResponse) UnmarshalJSON

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

type WorkerNewEmployeeResponseDepartment

type WorkerNewEmployeeResponseDepartment struct {
	// The unique public id of the department
	ID   string `json:"id" api:"required"`
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The department the worker belongs to, or null if unassigned.

func (WorkerNewEmployeeResponseDepartment) RawJSON

Returns the unmodified JSON received from the API

func (*WorkerNewEmployeeResponseDepartment) UnmarshalJSON

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

type WorkerNewEmployeeResponseStatus

type WorkerNewEmployeeResponseStatus string
const (
	WorkerNewEmployeeResponseStatusDraft       WorkerNewEmployeeResponseStatus = "draft"
	WorkerNewEmployeeResponseStatusInvited     WorkerNewEmployeeResponseStatus = "invited"
	WorkerNewEmployeeResponseStatusOnboarding  WorkerNewEmployeeResponseStatus = "onboarding"
	WorkerNewEmployeeResponseStatusActive      WorkerNewEmployeeResponseStatus = "active"
	WorkerNewEmployeeResponseStatusOffboarding WorkerNewEmployeeResponseStatus = "offboarding"
	WorkerNewEmployeeResponseStatusInactive    WorkerNewEmployeeResponseStatus = "inactive"
)

type WorkerNewEmployeeResponseType

type WorkerNewEmployeeResponseType string
const (
	WorkerNewEmployeeResponseTypeEmployee   WorkerNewEmployeeResponseType = "employee"
	WorkerNewEmployeeResponseTypeContractor WorkerNewEmployeeResponseType = "contractor"
)

type WorkerService

type WorkerService struct {
	// contains filtered or unexported fields
}

Endpoints for worker management. "Workers" include anyone employed by your company, whether US or international, full-time employees or contractors.

WorkerService contains methods and other services that help with interacting with the warp 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 NewWorkerService method instead.

func NewWorkerService

func NewWorkerService(opts ...option.RequestOption) (r WorkerService)

NewWorkerService 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 (*WorkerService) Delete

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

Delete a worker. Only workers who have not yet completed onboarding can be deleted. Active workers must be properly offboarded.

func (*WorkerService) Get

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

Get a specific worker by id.

func (*WorkerService) Invite

func (r *WorkerService) Invite(ctx context.Context, id string, opts ...option.RequestOption) (res *WorkerInviteResponse, err error)

Send or resend the worker invite so they can accept and complete onboarding to Warp. If the worker has already been invited, the invite will be resent with extended validity.

func (*WorkerService) List

List all workers. Workers include anyone employed by the company, whether US or international, full-time employees or contractors.

func (*WorkerService) ListAutoPaging

List all workers. Workers include anyone employed by the company, whether US or international, full-time employees or contractors.

func (*WorkerService) NewContractor

Create a new contractor. The worker will be created in draft status and must be invited separately via the invite endpoint. For business contractors, the businessName field is required.

func (*WorkerService) NewEmployee

Create a new US employee. The worker will be created in draft status and must be invited separately via the invite endpoint. If hiring in a state without an existing tax registration, you must specify the stateRegistration field.

type WorkplaceListParams

type WorkplaceListParams struct {
	// Public workplace identifier
	AfterID param.Opt[string] `query:"afterId,omitzero" json:"-"`
	// Public workplace identifier
	BeforeID param.Opt[string] `query:"beforeId,omitzero" json:"-"`
	// a number less than or equal to 100
	Limit param.Opt[string] `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WorkplaceListParams) URLQuery

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

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

type WorkplaceListResponse

type WorkplaceListResponse struct {
	// Public workplace identifier
	ID string `json:"id" api:"required"`
	// A valid US address
	Address WorkplaceListResponseAddress `json:"address" api:"required"`
	// a string to be decoded into a Date
	CreatedAt string `json:"createdAt" api:"required"`
	Name      string `json:"name" api:"required"`
	// Any of "active", "archived".
	Status WorkplaceListResponseStatus `json:"status" api:"required"`
	// Any of "remote", "office".
	Type WorkplaceListResponseType `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Address     respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkplaceListResponse) RawJSON

func (r WorkplaceListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkplaceListResponse) UnmarshalJSON

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

type WorkplaceListResponseAddress

type WorkplaceListResponseAddress struct {
	City string `json:"city" api:"required"`
	// Any of "US".
	Country string `json:"country" api:"required"`
	// a non empty string
	Line1      string `json:"line1" api:"required"`
	PostalCode string `json:"postalCode" api:"required"`
	// Any of "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI",
	// "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS",
	// "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR",
	// "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY".
	State string `json:"state" api:"required"`
	Line2 string `json:"line2" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		City        respjson.Field
		Country     respjson.Field
		Line1       respjson.Field
		PostalCode  respjson.Field
		State       respjson.Field
		Line2       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A valid US address

func (WorkplaceListResponseAddress) RawJSON

Returns the unmodified JSON received from the API

func (*WorkplaceListResponseAddress) UnmarshalJSON

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

type WorkplaceListResponseStatus

type WorkplaceListResponseStatus string
const (
	WorkplaceListResponseStatusActive   WorkplaceListResponseStatus = "active"
	WorkplaceListResponseStatusArchived WorkplaceListResponseStatus = "archived"
)

type WorkplaceListResponseType

type WorkplaceListResponseType string
const (
	WorkplaceListResponseTypeRemote WorkplaceListResponseType = "remote"
	WorkplaceListResponseTypeOffice WorkplaceListResponseType = "office"
)

type WorkplaceNewParams

type WorkplaceNewParams struct {
	// A valid US address
	Address WorkplaceNewParamsAddress `json:"address,omitzero" api:"required"`
	// a non empty string
	Name string `json:"name" api:"required"`
	// Any of "remote", "office".
	Type WorkplaceNewParamsType `json:"type,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (WorkplaceNewParams) MarshalJSON

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

func (*WorkplaceNewParams) UnmarshalJSON

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

type WorkplaceNewParamsAddress

type WorkplaceNewParamsAddress struct {
	City string `json:"city" api:"required"`
	// Any of "US".
	Country string `json:"country,omitzero" api:"required"`
	// a non empty string
	Line1      string `json:"line1" api:"required"`
	PostalCode string `json:"postalCode" api:"required"`
	// Any of "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI",
	// "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS",
	// "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR",
	// "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY".
	State string            `json:"state,omitzero" api:"required"`
	Line2 param.Opt[string] `json:"line2,omitzero"`
	// contains filtered or unexported fields
}

A valid US address

The properties City, Country, Line1, PostalCode, State are required.

func (WorkplaceNewParamsAddress) MarshalJSON

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

func (*WorkplaceNewParamsAddress) UnmarshalJSON

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

type WorkplaceNewParamsType

type WorkplaceNewParamsType string
const (
	WorkplaceNewParamsTypeRemote WorkplaceNewParamsType = "remote"
	WorkplaceNewParamsTypeOffice WorkplaceNewParamsType = "office"
)

type WorkplaceNewResponse

type WorkplaceNewResponse struct {
	// Public workplace identifier
	ID string `json:"id" api:"required"`
	// A valid US address
	Address WorkplaceNewResponseAddress `json:"address" api:"required"`
	// a string to be decoded into a Date
	CreatedAt string `json:"createdAt" api:"required"`
	Name      string `json:"name" api:"required"`
	// Any of "active", "archived".
	Status WorkplaceNewResponseStatus `json:"status" api:"required"`
	// Any of "remote", "office".
	Type WorkplaceNewResponseType `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Address     respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkplaceNewResponse) RawJSON

func (r WorkplaceNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkplaceNewResponse) UnmarshalJSON

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

type WorkplaceNewResponseAddress

type WorkplaceNewResponseAddress struct {
	City string `json:"city" api:"required"`
	// Any of "US".
	Country string `json:"country" api:"required"`
	// a non empty string
	Line1      string `json:"line1" api:"required"`
	PostalCode string `json:"postalCode" api:"required"`
	// Any of "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI",
	// "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS",
	// "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR",
	// "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY".
	State string `json:"state" api:"required"`
	Line2 string `json:"line2" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		City        respjson.Field
		Country     respjson.Field
		Line1       respjson.Field
		PostalCode  respjson.Field
		State       respjson.Field
		Line2       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A valid US address

func (WorkplaceNewResponseAddress) RawJSON

func (r WorkplaceNewResponseAddress) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkplaceNewResponseAddress) UnmarshalJSON

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

type WorkplaceNewResponseStatus

type WorkplaceNewResponseStatus string
const (
	WorkplaceNewResponseStatusActive   WorkplaceNewResponseStatus = "active"
	WorkplaceNewResponseStatusArchived WorkplaceNewResponseStatus = "archived"
)

type WorkplaceNewResponseType

type WorkplaceNewResponseType string
const (
	WorkplaceNewResponseTypeRemote WorkplaceNewResponseType = "remote"
	WorkplaceNewResponseTypeOffice WorkplaceNewResponseType = "office"
)

type WorkplaceService

type WorkplaceService struct {
	// contains filtered or unexported fields
}

Endpoints for workplace management. Create, list, and update workplaces within your company.

WorkplaceService contains methods and other services that help with interacting with the warp 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 NewWorkplaceService method instead.

func NewWorkplaceService

func NewWorkplaceService(opts ...option.RequestOption) (r WorkplaceService)

NewWorkplaceService 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 (*WorkplaceService) List

List all workplaces for your company.

func (*WorkplaceService) ListAutoPaging

List all workplaces for your company.

func (*WorkplaceService) New

Create a new workplace.

func (*WorkplaceService) Update

Update an existing workplace.

type WorkplaceUpdateParams

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

func (WorkplaceUpdateParams) MarshalJSON

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

func (*WorkplaceUpdateParams) UnmarshalJSON

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

type WorkplaceUpdateResponse

type WorkplaceUpdateResponse struct {
	// Public workplace identifier
	ID string `json:"id" api:"required"`
	// A valid US address
	Address WorkplaceUpdateResponseAddress `json:"address" api:"required"`
	// a string to be decoded into a Date
	CreatedAt string `json:"createdAt" api:"required"`
	Name      string `json:"name" api:"required"`
	// Any of "active", "archived".
	Status WorkplaceUpdateResponseStatus `json:"status" api:"required"`
	// Any of "remote", "office".
	Type WorkplaceUpdateResponseType `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Address     respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkplaceUpdateResponse) RawJSON

func (r WorkplaceUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkplaceUpdateResponse) UnmarshalJSON

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

type WorkplaceUpdateResponseAddress

type WorkplaceUpdateResponseAddress struct {
	City string `json:"city" api:"required"`
	// Any of "US".
	Country string `json:"country" api:"required"`
	// a non empty string
	Line1      string `json:"line1" api:"required"`
	PostalCode string `json:"postalCode" api:"required"`
	// Any of "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI",
	// "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS",
	// "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR",
	// "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY".
	State string `json:"state" api:"required"`
	Line2 string `json:"line2" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		City        respjson.Field
		Country     respjson.Field
		Line1       respjson.Field
		PostalCode  respjson.Field
		State       respjson.Field
		Line2       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A valid US address

func (WorkplaceUpdateResponseAddress) RawJSON

Returns the unmodified JSON received from the API

func (*WorkplaceUpdateResponseAddress) UnmarshalJSON

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

type WorkplaceUpdateResponseStatus

type WorkplaceUpdateResponseStatus string
const (
	WorkplaceUpdateResponseStatusActive   WorkplaceUpdateResponseStatus = "active"
	WorkplaceUpdateResponseStatusArchived WorkplaceUpdateResponseStatus = "archived"
)

type WorkplaceUpdateResponseType

type WorkplaceUpdateResponseType string
const (
	WorkplaceUpdateResponseTypeRemote WorkplaceUpdateResponseType = "remote"
	WorkplaceUpdateResponseTypeOffice WorkplaceUpdateResponseType = "office"
)

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