sdk

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

README

Scalar

This library provides convenient access to the Scalar REST API from Go.

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


Contents


Installation

go get github.com/scalar/scalar-go

Usage

package main

import (
	"context"
	"fmt"
	"os"

	sdk "github.com/scalar/scalar-go"
	"github.com/scalar/scalar-go/option"
)

func main() {
	client := sdk.NewClient(
		option.WithBearerAuth(os.Getenv("BEARER_AUTH")),
	)

	registry, err := client.Registry.ListAllAPIDocuments(context.Background())
	if err != nil {
		panic(err)
	}

	fmt.Println(registry)
}

The examples in the following sections assume a client configured as shown above.

See the API reference for every available operation.


Authentication

Pass credentials to the generated client constructor. Environment variables are read automatically when supported by the target runtime.

Option Type Default Description
option.WithBearerAuth string | provider - Credential for the BearerAuth client option. Defaults to BEARER_AUTH.

Declared schemes:

  • BearerAuth bearer token

Errors

Non-success responses return generated API errors. Error objects expose status, headers, response body, and request metadata where the target runtime supports it.

registry, err := client.Registry.ListAllAPIDocuments(context.Background())
if err != nil {
	var apiErr *sdk.Error
	if errors.As(err, &apiErr) {
		fmt.Println(apiErr.StatusCode, apiErr.RawJSON())
	}
	panic(err)
}

// imports: "context", "errors", "fmt", sdk "github.com/scalar/scalar-go"

Documented error statuses: 400, 401, 403, 404, 422, 500.


Client Options

Configure the generated client by setting any of these options when you create it.

client := sdk.NewClient(
	option.WithBaseURL("https://api.example.com"),
	option.WithMaxRetries(2),
	option.WithRequestTimeout(60*time.Second),
)

// imports: sdk "github.com/scalar/scalar-go", "github.com/scalar/scalar-go/option", "time"
Option Type Default Description
option.WithBearerAuth func(string) option.RequestOption os.Getenv("BEARER_AUTH") Credential for the BearerAuth client option.
option.WithEnvironmentProduction func() option.RequestOption - Select the production API environment.
option.WithBaseURL func(string) option.RequestOption os.Getenv("SCALAR_BASE_URL") Override the default API base URL.
option.WithRequestTimeout func(time.Duration) option.RequestOption - Maximum time to wait for each request attempt.
option.WithMaxRetries func(int) option.RequestOption 2 Number of retries for temporary failures.
option.WithHTTPClient func(option.HTTPClient) option.RequestOption - Custom HTTP client or transport implementation.

Request Options

Option Type Default Description
option.WithHeader func(string, string) option.RequestOption - Set a per-request header.
option.WithQuery func(string, string) option.RequestOption - Set a per-request query parameter.
option.WithRequestBody func(string, any) option.RequestOption - Override the serialized request body and content type.
option.WithResponseInto func(**http.Response) option.RequestOption - Capture the raw HTTP response.
option.WithResponseBodyInto func(any) option.RequestOption - Override the response deserialization target.

Retries and Timeouts

Generated clients support request timeouts and retry temporary failures such as network errors, 408, 409, 429, and 5xx responses. Retry delays honor Retry-After headers when present. Tune the retry and timeout client options shown above, or override them per request.


Helpers

  • Pass option.WithResponseInto(&raw) to capture the underlying *http.Response for a request.
  • Use the generated String, Int, Bool, Float, Time, Opt, and Ptr helpers when setting optional params.

Logging

  • Wrap the HTTP client with option.WithMiddleware(...) to add request logging or tracing.

Requirements

  • Go 1.22 or newer

Powered by Scalar.

Documentation

Index

Constants

View Source
const (
	ManagedDocVersionToolsMethodDelete  = shared.ManagedDocVersionToolsMethodDelete
	ManagedDocVersionToolsMethodGet     = shared.ManagedDocVersionToolsMethodGet
	ManagedDocVersionToolsMethodHead    = shared.ManagedDocVersionToolsMethodHead
	ManagedDocVersionToolsMethodOptions = shared.ManagedDocVersionToolsMethodOptions
	ManagedDocVersionToolsMethodPatch   = shared.ManagedDocVersionToolsMethodPatch
	ManagedDocVersionToolsMethodPost    = shared.ManagedDocVersionToolsMethodPost
	ManagedDocVersionToolsMethodPut     = shared.ManagedDocVersionToolsMethodPut
	ManagedDocVersionToolsMethodTrace   = shared.ManagedDocVersionToolsMethodTrace
)
View Source
const (
	ManagedDocVersionToolsEnabledToolExecuteRequest     = shared.ManagedDocVersionToolsEnabledToolExecuteRequest
	ManagedDocVersionToolsEnabledToolGetMiniOpenapiSpec = shared.ManagedDocVersionToolsEnabledToolGetMiniOpenapiSpec
)
View Source
const (
	ManagedDocVersionEmbedStatusComplete = shared.ManagedDocVersionEmbedStatusComplete
	ManagedDocVersionEmbedStatusFailed   = shared.ManagedDocVersionEmbedStatusFailed
)

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment. This should be used to initialize new clients.

func F

func F[T any](value T) param.Field[T]

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

func Float

func Float(value float64) param.Field[float64]

func Int

func Int(value int64) param.Field[int64]

func Null

func Null[T any]() param.Field[T]

func Raw

func Raw[T any](value any) param.Field[T]

func String

func String(value string) param.Field[string]

Types

type APIDocument

type APIDocument struct {
	UID         string                     `json:"uid" api:"required"`
	Version     string                     `json:"version" api:"required"`
	Title       string                     `json:"title" api:"required"`
	Slug        string                     `json:"slug" api:"required"`
	Description string                     `json:"description" api:"required"`
	Namespace   string                     `json:"namespace" api:"required"`
	IsPrivate   bool                       `json:"isPrivate" api:"required"`
	Tags        interface{}                `json:"tags" api:"required"`
	Versions    []shared.ManagedDocVersion `json:"versions" api:"required"`
	JSON        apiDocumentJSON            `json:"-"`
}

func (*APIDocument) UnmarshalJSON

func (r *APIDocument) UnmarshalJSON(data []byte) (err error)

type AccessGroupParam

type AccessGroupParam struct {
	AccessGroupSlug param.Field[string] `json:"accessGroupSlug" api:"required"`
}

func (AccessGroupParam) MarshalJSON

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

type AuthenticationExchangePersonalTokenParams

type AuthenticationExchangePersonalTokenParams struct {
	PersonalToken param.Field[string] `json:"personalToken" api:"required"`
}

func (AuthenticationExchangePersonalTokenParams) MarshalJSON

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

type AuthenticationExchangePersonalTokenResponse

type AuthenticationExchangePersonalTokenResponse struct {
	AccessToken string                                          `json:"accessToken" api:"required"`
	JSON        authenticationExchangePersonalTokenResponseJSON `json:"-"`
}

func (*AuthenticationExchangePersonalTokenResponse) UnmarshalJSON

func (r *AuthenticationExchangePersonalTokenResponse) UnmarshalJSON(data []byte) (err error)

type AuthenticationListCurrentUserResponse

type AuthenticationListCurrentUserResponse struct {
	UID          string                                      `json:"uid" api:"required"`
	CreatedAt    int64                                       `json:"createdAt" api:"required"`
	UpdatedAt    int64                                       `json:"updatedAt" api:"required"`
	Email        string                                      `json:"email" api:"required" format:"email"`
	ActiveTeamID string                                      `json:"activeTeamId" api:"required,nullable"`
	HasGithub    bool                                        `json:"hasGithub" api:"required"`
	Teams        []AuthenticationListCurrentUserResponseTeam `json:"teams" api:"required"`
	Theme        string                                      `json:"theme"`
	JSON         authenticationListCurrentUserResponseJSON   `json:"-"`
}

func (*AuthenticationListCurrentUserResponse) UnmarshalJSON

func (r *AuthenticationListCurrentUserResponse) UnmarshalJSON(data []byte) (err error)

type AuthenticationListCurrentUserResponseTeam

type AuthenticationListCurrentUserResponseTeam struct {
	UID      string                                        `json:"uid" api:"required"`
	Name     string                                        `json:"name" api:"required"`
	ImageURI string                                        `json:"imageUri"`
	JSON     authenticationListCurrentUserResponseTeamJSON `json:"-"`
}

func (*AuthenticationListCurrentUserResponseTeam) UnmarshalJSON

func (r *AuthenticationListCurrentUserResponseTeam) UnmarshalJSON(data []byte) (err error)

type AuthenticationService

type AuthenticationService struct {
	Options []option.RequestOption
}

AuthenticationService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewAuthenticationService method instead.

func NewAuthenticationService

func NewAuthenticationService(opts ...option.RequestOption) (r *AuthenticationService)

NewAuthenticationService 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 (*AuthenticationService) ExchangePersonalToken

Exchange an API key for an access token.

Parameters:

ctx: Context for the request.
body: AuthenticationExchangePersonalTokenParams request parameters.
opts: Options to apply to this request.

Returns:

*AuthenticationExchangePersonalTokenResponse: Default Response

Example:

authentication, err := client.Authentication.ExchangePersonalToken(context.Background(), sdk.AuthenticationExchangePersonalTokenParams{
	PersonalToken: sdk.F[string](""),
})
if err != nil {
	panic(err)
}

fmt.Println(authentication)

func (*AuthenticationService) ListCurrentUser

Get the authenticated user, including their available teams and theme.

Parameters:

ctx: Context for the request.
opts: Options to apply to this request.

Returns:

*AuthenticationListCurrentUserResponse: Default Response

Example:

authentication, err := client.Authentication.ListCurrentUser(context.Background())
if err != nil {
	panic(err)
}

fmt.Println(authentication)

type Client

type Client struct {
	Options        []option.RequestOption
	Registry       *RegistryService
	Schemas        *SchemaService
	LoginPortals   *LoginPortalService
	Rules          *RuleService
	Themes         *ThemeService
	Teams          *TeamService
	ScalarDocs     *ScalarDocService
	Namespaces     *NamespaceService
	Authentication *AuthenticationService
}

Client creates a struct with services and top level methods that help with interacting with the Scalar 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. 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 interface{}, res interface{}, 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 interface{}, res interface{}, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, opts ...option.RequestOption) error

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

type Error

type Error = apierror.Error

type GithubProject

type GithubProject struct {
	UID              string                        `json:"uid" api:"required"`
	CreatedAt        int64                         `json:"createdAt" api:"required"`
	UpdatedAt        int64                         `json:"updatedAt" api:"required"`
	Name             string                        `json:"name" api:"required"`
	ActiveDeployment GithubProjectActiveDeployment `json:"activeDeployment" api:"required,nullable"`
	LastPublished    int64                         `json:"lastPublished" api:"required,nullable"`
	LastPublishedUID string                        `json:"lastPublishedUid" api:"required,nullable"`
	LoginPortalUID   string                        `json:"loginPortalUid" api:"required"`
	ActiveThemeID    string                        `json:"activeThemeId" api:"required"`
	IsPrivate        bool                          `json:"isPrivate" api:"required"`
	AgentEnabled     bool                          `json:"agentEnabled" api:"required"`
	AccessGroups     interface{}                   `json:"accessGroups" api:"required"`
	Slug             string                        `json:"slug" api:"required"`
	PublishStatus    string                        `json:"publishStatus" api:"required"`
	PublishMessage   string                        `json:"publishMessage" api:"required"`
	TypesenseID      float64                       `json:"typesenseId"`
	Repository       GithubProjectRepository       `json:"repository" api:"nullable"`
	JSON             githubProjectJSON             `json:"-"`
}

func (*GithubProject) UnmarshalJSON

func (r *GithubProject) UnmarshalJSON(data []byte) (err error)

type GithubProjectActiveDeployment

type GithubProjectActiveDeployment struct {
	UID         string                            `json:"uid" api:"required"`
	Domain      string                            `json:"domain" api:"required"`
	PublishedAt int64                             `json:"publishedAt" api:"required"`
	JSON        githubProjectActiveDeploymentJSON `json:"-"`
}

func (*GithubProjectActiveDeployment) UnmarshalJSON

func (r *GithubProjectActiveDeployment) UnmarshalJSON(data []byte) (err error)

type GithubProjectActiveDeploymentParam

type GithubProjectActiveDeploymentParam struct {
	Domain      param.Field[string] `json:"domain" api:"required"`
	PublishedAt param.Field[int64]  `json:"publishedAt" api:"required"`
	UID         param.Field[string] `json:"uid" api:"required"`
}

func (GithubProjectActiveDeploymentParam) MarshalJSON

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

type GithubProjectRepository

type GithubProjectRepository struct {
	LinkedBy        string                      `json:"linkedBy" api:"required"`
	ID              float64                     `json:"id" api:"required"`
	Name            string                      `json:"name" api:"required"`
	ConfigPath      string                      `json:"configPath" api:"required"`
	Branch          string                      `json:"branch" api:"required"`
	PublishOnMerge  bool                        `json:"publishOnMerge" api:"required"`
	PublishPreviews bool                        `json:"publishPreviews" api:"required"`
	PrComments      bool                        `json:"prComments" api:"required"`
	Expired         bool                        `json:"expired" api:"required"`
	JSON            githubProjectRepositoryJSON `json:"-"`
}

func (*GithubProjectRepository) UnmarshalJSON

func (r *GithubProjectRepository) UnmarshalJSON(data []byte) (err error)

type LoginPortal

type LoginPortal struct {
	UID   string          `json:"uid" api:"required"`
	Title string          `json:"title" api:"required"`
	Slug  string          `json:"slug" api:"required"`
	JSON  loginPortalJSON `json:"-"`
}

func (*LoginPortal) UnmarshalJSON

func (r *LoginPortal) UnmarshalJSON(data []byte) (err error)

type LoginPortalEmail

type LoginPortalEmail struct {
	LogoSize         string               `json:"logoSize" api:"required"`
	ButtonText       string               `json:"buttonText" api:"required"`
	Message          string               `json:"message" api:"required"`
	Title            string               `json:"title" api:"required"`
	MainColor        string               `json:"mainColor" api:"required"`
	MainBackground   string               `json:"mainBackground" api:"required"`
	CardColor        string               `json:"cardColor" api:"required"`
	CardBackground   string               `json:"cardBackground" api:"required"`
	ButtonColor      string               `json:"buttonColor" api:"required"`
	ButtonBackground string               `json:"buttonBackground" api:"required"`
	JSON             loginPortalEmailJSON `json:"-"`
}

func (*LoginPortalEmail) UnmarshalJSON

func (r *LoginPortalEmail) UnmarshalJSON(data []byte) (err error)

type LoginPortalEmailParam

type LoginPortalEmailParam struct {
	ButtonBackground param.Field[string] `json:"buttonBackground" api:"required"`
	ButtonColor      param.Field[string] `json:"buttonColor" api:"required"`
	ButtonText       param.Field[string] `json:"buttonText" api:"required"`
	CardBackground   param.Field[string] `json:"cardBackground" api:"required"`
	CardColor        param.Field[string] `json:"cardColor" api:"required"`
	LogoSize         param.Field[string] `json:"logoSize" api:"required"`
	MainBackground   param.Field[string] `json:"mainBackground" api:"required"`
	MainColor        param.Field[string] `json:"mainColor" api:"required"`
	Message          param.Field[string] `json:"message" api:"required"`
	Title            param.Field[string] `json:"title" api:"required"`
}

func (LoginPortalEmailParam) MarshalJSON

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

type LoginPortalGetResponse

type LoginPortalGetResponse struct {
	UID   string                     `json:"uid" api:"required"`
	Title string                     `json:"title" api:"required"`
	Slug  string                     `json:"slug" api:"required"`
	Email LoginPortalEmail           `json:"email" api:"required"`
	Page  LoginPortalPage            `json:"page" api:"required"`
	JSON  loginPortalGetResponseJSON `json:"-"`
}

func (*LoginPortalGetResponse) UnmarshalJSON

func (r *LoginPortalGetResponse) UnmarshalJSON(data []byte) (err error)

type LoginPortalNewParams

type LoginPortalNewParams struct {
	Email param.Field[LoginPortalEmailParam] `json:"email" api:"required"`
	Page  param.Field[LoginPortalPageParam]  `json:"page" api:"required"`
	Slug  param.Field[string]                `json:"slug" api:"required"`
	Title param.Field[string]                `json:"title" api:"required"`
}

func (LoginPortalNewParams) MarshalJSON

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

type LoginPortalPage

type LoginPortalPage struct {
	Title           string              `json:"title" api:"required"`
	Description     string              `json:"description" api:"required"`
	Head            string              `json:"head" api:"required"`
	Script          string              `json:"script" api:"required"`
	Theme           string              `json:"theme" api:"required"`
	CompanyName     string              `json:"companyName" api:"required"`
	LogoURL         string              `json:"logoURL" api:"required"`
	Favicon         string              `json:"favicon" api:"required"`
	TermsLink       string              `json:"termsLink" api:"required"`
	PrivacyLink     string              `json:"privacyLink" api:"required"`
	FormTitle       string              `json:"formTitle" api:"required"`
	FormDescription string              `json:"formDescription" api:"required"`
	FormImage       string              `json:"formImage" api:"required"`
	JSON            loginPortalPageJSON `json:"-"`
}

func (*LoginPortalPage) UnmarshalJSON

func (r *LoginPortalPage) UnmarshalJSON(data []byte) (err error)

type LoginPortalPageParam

type LoginPortalPageParam struct {
	CompanyName     param.Field[string] `json:"companyName" api:"required"`
	Description     param.Field[string] `json:"description" api:"required"`
	Favicon         param.Field[string] `json:"favicon" api:"required"`
	FormDescription param.Field[string] `json:"formDescription" api:"required"`
	FormImage       param.Field[string] `json:"formImage" api:"required"`
	FormTitle       param.Field[string] `json:"formTitle" api:"required"`
	Head            param.Field[string] `json:"head" api:"required"`
	LogoURL         param.Field[string] `json:"logoURL" api:"required"`
	PrivacyLink     param.Field[string] `json:"privacyLink" api:"required"`
	Script          param.Field[string] `json:"script" api:"required"`
	TermsLink       param.Field[string] `json:"termsLink" api:"required"`
	Theme           param.Field[string] `json:"theme" api:"required"`
	Title           param.Field[string] `json:"title" api:"required"`
}

func (LoginPortalPageParam) MarshalJSON

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

type LoginPortalService

type LoginPortalService struct {
	Options []option.RequestOption
}

LoginPortalService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewLoginPortalService method instead.

func NewLoginPortalService

func NewLoginPortalService(opts ...option.RequestOption) (r *LoginPortalService)

NewLoginPortalService 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 (*LoginPortalService) Delete

func (r *LoginPortalService) Delete(ctx context.Context, slug string, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Delete a login portal.

Parameters:

ctx: Context for the request.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

loginPortal, err := client.LoginPortals.Delete(context.Background(), "slug")
if err != nil {
	panic(err)
}

fmt.Println(loginPortal)

func (*LoginPortalService) Get

Get a login portal by slug.

Parameters:

ctx: Context for the request.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*LoginPortalGetResponse: Default Response

Example:

loginPortal, err := client.LoginPortals.Get(context.Background(), "slug")
if err != nil {
	panic(err)
}

fmt.Println(loginPortal)

func (*LoginPortalService) List

func (r *LoginPortalService) List(ctx context.Context, opts ...option.RequestOption) (res *[]LoginPortal, err error)

List all login portals for the current team.

Parameters:

ctx: Context for the request.
opts: Options to apply to this request.

Returns:

*[]LoginPortal: Default Response

Example:

loginPortal, err := client.LoginPortals.List(context.Background())
if err != nil {
	panic(err)
}

fmt.Println(loginPortal)

func (*LoginPortalService) New

Create a login portal for the current team.

Parameters:

ctx: Context for the request.
body: LoginPortalNewParams request parameters.
opts: Options to apply to this request.

Returns:

*shared.UID: Default Response

Example:

loginPortal, err := client.LoginPortals.New(context.Background(), sdk.LoginPortalNewParams{
	Email: sdk.F[sdk.LoginPortalEmailParam](sdk.LoginPortalEmailParam{
		Logo:             sdk.F[string](""),
		LogoSize:         sdk.F[string]("100"),
		ButtonText:       sdk.F[string]("Login"),
		Message:          sdk.F[string]("Click to access private documentation hosted by scalar.com"),
		Title:            sdk.F[string]("Private Docs"),
		MainColor:        sdk.F[string]("#2a2f45"),
		MainBackground:   sdk.F[string]("#f6f6f6"),
		CardColor:        sdk.F[string]("2a2f45"),
		CardBackground:   sdk.F[string]("#fff"),
		ButtonColor:      sdk.F[string]("#fff"),
		ButtonBackground: sdk.F[string]("#0f0f0f"),
	}),
	Page: sdk.F[sdk.LoginPortalPageParam](sdk.LoginPortalPageParam{
		Title:           sdk.F[string]("Scalar Private Docs"),
		Description:     sdk.F[string]("Login to access your documentation"),
		Head:            sdk.F[string](""),
		Script:          sdk.F[string](""),
		Theme:           sdk.F[string](""),
		CompanyName:     sdk.F[string](""),
		Logo:            sdk.F[string](""),
		LogoURL:         sdk.F[string](""),
		Favicon:         sdk.F[string](""),
		TermsLink:       sdk.F[string](""),
		PrivacyLink:     sdk.F[string](""),
		FormTitle:       sdk.F[string]("Scalar Private Docs"),
		FormDescription: sdk.F[string]("Login to access your documentation"),
		FormImage:       sdk.F[string](""),
	}),
	Slug:  sdk.F[string](""),
	Title: sdk.F[string](""),
})
if err != nil {
	panic(err)
}

fmt.Println(loginPortal)

func (*LoginPortalService) Update

func (r *LoginPortalService) Update(ctx context.Context, slug string, body LoginPortalUpdateParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Update metadata for a login portal.

Parameters:

ctx: Context for the request.
slug: Path parameter.
body: LoginPortalUpdateParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

loginPortal, err := client.LoginPortals.Update(context.Background(), "slug", sdk.LoginPortalUpdateParams{})
if err != nil {
	panic(err)
}

fmt.Println(loginPortal)

type LoginPortalUpdateParams

type LoginPortalUpdateParams struct {
	Title param.Field[string] `json:"title"`
}

func (LoginPortalUpdateParams) MarshalJSON

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

type ManagedDocVersion

type ManagedDocVersion = shared.ManagedDocVersion

type ManagedDocVersionEmbedStatus

type ManagedDocVersionEmbedStatus = shared.ManagedDocVersionEmbedStatus

type ManagedDocVersionTool added in v0.4.0

type ManagedDocVersionTool = shared.ManagedDocVersionTool

type ManagedDocVersionToolsEnabledTool added in v0.4.0

type ManagedDocVersionToolsEnabledTool = shared.ManagedDocVersionToolsEnabledTool

type ManagedDocVersionToolsMethod added in v0.4.0

type ManagedDocVersionToolsMethod = shared.ManagedDocVersionToolsMethod

type Namespace added in v0.4.0

type Namespace = shared.Namespace

type NamespaceService

type NamespaceService struct {
	Options []option.RequestOption
}

NamespaceService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewNamespaceService method instead.

func NewNamespaceService

func NewNamespaceService(opts ...option.RequestOption) (r *NamespaceService)

NewNamespaceService 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 (*NamespaceService) List

func (r *NamespaceService) List(ctx context.Context, opts ...option.RequestOption) (res *[]string, err error)

Get all namespaces for the current team

Parameters:

ctx: Context for the request.
opts: Options to apply to this request.

Returns:

*[]string: Default Response

Example:

namespace, err := client.Namespaces.List(context.Background())
if err != nil {
	panic(err)
}

fmt.Println(namespace)

type Nanoid added in v0.4.0

type Nanoid = shared.Nanoid

type RegistryDeleteAPIDocumentAccessGroupParams

type RegistryDeleteAPIDocumentAccessGroupParams struct {
	AccessGroup AccessGroupParam `json:"access_group" api:"required"`
}

func (RegistryDeleteAPIDocumentAccessGroupParams) MarshalJSON

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

type RegistryNewAPIDocumentAccessGroupParams

type RegistryNewAPIDocumentAccessGroupParams struct {
	AccessGroup AccessGroupParam `json:"access_group" api:"required"`
}

func (RegistryNewAPIDocumentAccessGroupParams) MarshalJSON

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

type RegistryNewAPIDocumentParams

type RegistryNewAPIDocumentParams struct {
	Document    param.Field[string] `json:"document" api:"required"`
	Slug        param.Field[string] `json:"slug" api:"required"`
	Title       param.Field[string] `json:"title" api:"required"`
	Version     param.Field[string] `json:"version" api:"required"`
	Description param.Field[string] `json:"description"`
	IsPrivate   param.Field[bool]   `json:"isPrivate"`
	Ruleset     param.Field[string] `json:"ruleset"`
}

func (RegistryNewAPIDocumentParams) MarshalJSON

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

type RegistryNewAPIDocumentResponse

type RegistryNewAPIDocumentResponse struct {
	UID        string                             `json:"uid" api:"required"`
	VersionUID string                             `json:"versionUid" api:"required"`
	Title      string                             `json:"title" api:"required"`
	JsonSha    string                             `json:"jsonSha" api:"required"`
	YamlSha    string                             `json:"yamlSha" api:"required"`
	VersionSha string                             `json:"versionSha" api:"required"`
	JSON       registryNewAPIDocumentResponseJSON `json:"-"`
}

func (*RegistryNewAPIDocumentResponse) UnmarshalJSON

func (r *RegistryNewAPIDocumentResponse) UnmarshalJSON(data []byte) (err error)

type RegistryNewAPIDocumentVersionParams

type RegistryNewAPIDocumentVersionParams struct {
	Document            param.Field[string] `json:"document" api:"required"`
	Version             param.Field[string] `json:"version" api:"required"`
	Force               param.Field[bool]   `json:"force"`
	LastKnownVersionSha param.Field[string] `json:"lastKnownVersionSha"`
}

func (RegistryNewAPIDocumentVersionParams) MarshalJSON

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

type RegistryService

type RegistryService struct {
	Options []option.RequestOption
}

RegistryService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewRegistryService method instead.

func NewRegistryService

func NewRegistryService(opts ...option.RequestOption) (r *RegistryService)

NewRegistryService 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 (*RegistryService) DeleteAPIDocument

func (r *RegistryService) DeleteAPIDocument(ctx context.Context, namespace string, slug string, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Delete an API document and all versions.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

registry, err := client.Registry.DeleteAPIDocument(context.Background(), "namespace", "slug")
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) DeleteAPIDocumentAccessGroup

func (r *RegistryService) DeleteAPIDocumentAccessGroup(ctx context.Context, namespace string, slug string, body RegistryDeleteAPIDocumentAccessGroupParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Remove an access group from an API document.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: RegistryDeleteAPIDocumentAccessGroupParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

registry, err := client.Registry.DeleteAPIDocumentAccessGroup(context.Background(), "namespace", "slug", sdk.RegistryDeleteAPIDocumentAccessGroupParams{
	AccessGroup: sdk.AccessGroupParam{
		AccessGroupSlug: sdk.F[string]("xxx"),
	},
})
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) DeleteAPIDocumentVersion

func (r *RegistryService) DeleteAPIDocumentVersion(ctx context.Context, namespace string, slug string, semver string, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Delete a specific API document version.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
semver: Path parameter.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

registry, err := client.Registry.DeleteAPIDocumentVersion(context.Background(), "namespace", "slug", "semver")
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) GetAPIDocumentVersion

func (r *RegistryService) GetAPIDocumentVersion(ctx context.Context, namespace string, slug string, semver string, opts ...option.RequestOption) (res *string, err error)

Get a specific API document version.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
semver: Path parameter.
opts: Options to apply to this request.

Returns:

*string: Default Response

Example:

registry, err := client.Registry.GetAPIDocumentVersion(context.Background(), "namespace", "slug", "semver")
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) ListAPIDocumentVersionMetadata

func (r *RegistryService) ListAPIDocumentVersionMetadata(ctx context.Context, namespace string, slug string, semver string, opts ...option.RequestOption) (res *shared.ManagedDocVersion, err error)

Get metadata (uid, content shas, version sha, tags) for a specific API document version.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
semver: Path parameter.
opts: Options to apply to this request.

Returns:

*shared.ManagedDocVersion: Default Response

Example:

registry, err := client.Registry.ListAPIDocumentVersionMetadata(context.Background(), "namespace", "slug", "semver")
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) ListAPIDocuments

func (r *RegistryService) ListAPIDocuments(ctx context.Context, namespace string, opts ...option.RequestOption) (res *[]APIDocument, err error)

List API documents in a namespace.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
opts: Options to apply to this request.

Returns:

*[]APIDocument: Default Response

Example:

registry, err := client.Registry.ListAPIDocuments(context.Background(), "namespace")
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) ListAllAPIDocuments

func (r *RegistryService) ListAllAPIDocuments(ctx context.Context, opts ...option.RequestOption) (res *[]APIDocument, err error)

List all API documents across every namespace the caller can access.

Parameters:

ctx: Context for the request.
opts: Options to apply to this request.

Returns:

*[]APIDocument: Default Response

Example:

registry, err := client.Registry.ListAllAPIDocuments(context.Background())
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) NewAPIDocument

func (r *RegistryService) NewAPIDocument(ctx context.Context, namespace string, body RegistryNewAPIDocumentParams, opts ...option.RequestOption) (res *RegistryNewAPIDocumentResponse, err error)

Create an API document.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
body: RegistryNewAPIDocumentParams request parameters.
opts: Options to apply to this request.

Returns:

*RegistryNewAPIDocumentResponse: Default Response

Example:

registry, err := client.Registry.NewAPIDocument(context.Background(), "namespace", sdk.RegistryNewAPIDocumentParams{
	Document: sdk.F[string](""),
	Slug:     sdk.F[string](""),
	Title:    sdk.F[string](""),
	Version:  sdk.F[string]("x"),
})
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) NewAPIDocumentAccessGroup

func (r *RegistryService) NewAPIDocumentAccessGroup(ctx context.Context, namespace string, slug string, body RegistryNewAPIDocumentAccessGroupParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Add an access group to an API document.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: RegistryNewAPIDocumentAccessGroupParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

registry, err := client.Registry.NewAPIDocumentAccessGroup(context.Background(), "namespace", "slug", sdk.RegistryNewAPIDocumentAccessGroupParams{
	AccessGroup: sdk.AccessGroupParam{
		AccessGroupSlug: sdk.F[string]("xxx"),
	},
})
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) NewAPIDocumentVersion

func (r *RegistryService) NewAPIDocumentVersion(ctx context.Context, namespace string, slug string, body RegistryNewAPIDocumentVersionParams, opts ...option.RequestOption) (res *shared.ManagedDocVersion, err error)

Create a new API document version.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: RegistryNewAPIDocumentVersionParams request parameters.
opts: Options to apply to this request.

Returns:

*shared.ManagedDocVersion: Default Response

Example:

registry, err := client.Registry.NewAPIDocumentVersion(context.Background(), "namespace", "slug", sdk.RegistryNewAPIDocumentVersionParams{
	Document: sdk.F[string](""),
	Version:  sdk.F[string]("x"),
})
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) UpdateAPIDocument

func (r *RegistryService) UpdateAPIDocument(ctx context.Context, namespace string, slug string, body RegistryUpdateAPIDocumentParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Update metadata for an API document.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: RegistryUpdateAPIDocumentParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

registry, err := client.Registry.UpdateAPIDocument(context.Background(), "namespace", "slug", sdk.RegistryUpdateAPIDocumentParams{})
if err != nil {
	panic(err)
}

fmt.Println(registry)

func (*RegistryService) UpdateAPIDocumentVersion

func (r *RegistryService) UpdateAPIDocumentVersion(ctx context.Context, namespace string, slug string, semver string, body RegistryUpdateAPIDocumentVersionParams, opts ...option.RequestOption) (res *RegistryUpdateAPIDocumentVersionResponse, err error)

Update the registry file content for an API document version.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
semver: Path parameter.
body: RegistryUpdateAPIDocumentVersionParams request parameters.
opts: Options to apply to this request.

Returns:

*RegistryUpdateAPIDocumentVersionResponse: Default Response

Example:

registry, err := client.Registry.UpdateAPIDocumentVersion(context.Background(), "namespace", "slug", "semver", sdk.RegistryUpdateAPIDocumentVersionParams{
	Document: sdk.F[string](""),
})
if err != nil {
	panic(err)
}

fmt.Println(registry)

type RegistryUpdateAPIDocumentParams

type RegistryUpdateAPIDocumentParams struct {
	Description param.Field[string] `json:"description"`
	IsPrivate   param.Field[bool]   `json:"isPrivate"`
	Ruleset     param.Field[string] `json:"ruleset"`
	Title       param.Field[string] `json:"title"`
}

func (RegistryUpdateAPIDocumentParams) MarshalJSON

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

type RegistryUpdateAPIDocumentVersionParams

type RegistryUpdateAPIDocumentVersionParams struct {
	Document            param.Field[string] `json:"document" api:"required"`
	LastKnownVersionSha param.Field[string] `json:"lastKnownVersionSha"`
}

func (RegistryUpdateAPIDocumentVersionParams) MarshalJSON

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

type RegistryUpdateAPIDocumentVersionResponse

type RegistryUpdateAPIDocumentVersionResponse struct {
	JsonSha    string                                       `json:"jsonSha" api:"required"`
	YamlSha    string                                       `json:"yamlSha" api:"required"`
	VersionSha string                                       `json:"versionSha" api:"required"`
	JSON       registryUpdateAPIDocumentVersionResponseJSON `json:"-"`
}

func (*RegistryUpdateAPIDocumentVersionResponse) UnmarshalJSON

func (r *RegistryUpdateAPIDocumentVersionResponse) UnmarshalJSON(data []byte) (err error)

type Rule

type Rule struct {
	UID         string   `json:"uid" api:"required"`
	Title       string   `json:"title" api:"required"`
	Description string   `json:"description" api:"required"`
	Slug        string   `json:"slug" api:"required"`
	Namespace   string   `json:"namespace" api:"required"`
	IsPrivate   bool     `json:"isPrivate" api:"required"`
	JSON        ruleJSON `json:"-"`
}

func (*Rule) UnmarshalJSON

func (r *Rule) UnmarshalJSON(data []byte) (err error)

type RuleDeleteRulesetAccessGroupParams

type RuleDeleteRulesetAccessGroupParams struct {
	AccessGroup AccessGroupParam `json:"access_group" api:"required"`
}

func (RuleDeleteRulesetAccessGroupParams) MarshalJSON

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

type RuleNewRulesetAccessGroupParams

type RuleNewRulesetAccessGroupParams struct {
	AccessGroup AccessGroupParam `json:"access_group" api:"required"`
}

func (RuleNewRulesetAccessGroupParams) MarshalJSON

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

type RuleNewRulesetParams

type RuleNewRulesetParams struct {
	Document    param.Field[string] `json:"document" api:"required"`
	Slug        param.Field[string] `json:"slug" api:"required"`
	Title       param.Field[string] `json:"title" api:"required"`
	Description param.Field[string] `json:"description"`
	IsPrivate   param.Field[bool]   `json:"isPrivate"`
}

func (RuleNewRulesetParams) MarshalJSON

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

type RuleService

type RuleService struct {
	Options []option.RequestOption
}

RuleService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewRuleService method instead.

func NewRuleService

func NewRuleService(opts ...option.RequestOption) (r *RuleService)

NewRuleService 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 (*RuleService) DeleteRuleset

func (r *RuleService) DeleteRuleset(ctx context.Context, namespace string, slug string, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Delete a rule by slug.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

rule, err := client.Rules.DeleteRuleset(context.Background(), "namespace", "slug")
if err != nil {
	panic(err)
}

fmt.Println(rule)

func (*RuleService) DeleteRulesetAccessGroup

func (r *RuleService) DeleteRulesetAccessGroup(ctx context.Context, namespace string, slug string, body RuleDeleteRulesetAccessGroupParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Remove an access group from a rule.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: RuleDeleteRulesetAccessGroupParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

rule, err := client.Rules.DeleteRulesetAccessGroup(context.Background(), "namespace", "slug", sdk.RuleDeleteRulesetAccessGroupParams{
	AccessGroup: sdk.AccessGroupParam{
		AccessGroupSlug: sdk.F[string]("xxx"),
	},
})
if err != nil {
	panic(err)
}

fmt.Println(rule)

func (*RuleService) GetRulesetDocument

func (r *RuleService) GetRulesetDocument(ctx context.Context, namespace string, slug string, opts ...option.RequestOption) (res *string, err error)

Get a rule document by slug.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*string: Default Response

Example:

rule, err := client.Rules.GetRulesetDocument(context.Background(), "namespace", "slug")
if err != nil {
	panic(err)
}

fmt.Println(rule)

func (*RuleService) ListRulesets

func (r *RuleService) ListRulesets(ctx context.Context, namespace string, opts ...option.RequestOption) (res *[]Rule, err error)

List all rulesets in a namespace.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
opts: Options to apply to this request.

Returns:

*[]Rule: Default Response

Example:

rule, err := client.Rules.ListRulesets(context.Background(), "namespace")
if err != nil {
	panic(err)
}

fmt.Println(rule)

func (*RuleService) NewRuleset

func (r *RuleService) NewRuleset(ctx context.Context, namespace string, body RuleNewRulesetParams, opts ...option.RequestOption) (res *shared.UID, err error)

Create a rule in a namespace.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
body: RuleNewRulesetParams request parameters.
opts: Options to apply to this request.

Returns:

*shared.UID: Default Response

Example:

rule, err := client.Rules.NewRuleset(context.Background(), "namespace", sdk.RuleNewRulesetParams{
	Document: sdk.F[string](""),
	Slug:     sdk.F[string](""),
	Title:    sdk.F[string](""),
})
if err != nil {
	panic(err)
}

fmt.Println(rule)

func (*RuleService) NewRulesetAccessGroup

func (r *RuleService) NewRulesetAccessGroup(ctx context.Context, namespace string, slug string, body RuleNewRulesetAccessGroupParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Grant an access group to a rule.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: RuleNewRulesetAccessGroupParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

rule, err := client.Rules.NewRulesetAccessGroup(context.Background(), "namespace", "slug", sdk.RuleNewRulesetAccessGroupParams{
	AccessGroup: sdk.AccessGroupParam{
		AccessGroupSlug: sdk.F[string]("xxx"),
	},
})
if err != nil {
	panic(err)
}

fmt.Println(rule)

func (*RuleService) UpdateRuleset

func (r *RuleService) UpdateRuleset(ctx context.Context, namespace string, slug string, body RuleUpdateRulesetParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Update rule metadata by slug.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: RuleUpdateRulesetParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

rule, err := client.Rules.UpdateRuleset(context.Background(), "namespace", "slug", sdk.RuleUpdateRulesetParams{})
if err != nil {
	panic(err)
}

fmt.Println(rule)

type RuleUpdateRulesetParams

type RuleUpdateRulesetParams struct {
	Description param.Field[string] `json:"description"`
	IsPrivate   param.Field[bool]   `json:"isPrivate"`
	Namespace   param.Field[string] `json:"namespace"`
	Slug        param.Field[string] `json:"slug"`
	Title       param.Field[string] `json:"title"`
}

func (RuleUpdateRulesetParams) MarshalJSON

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

type ScalarDocNewGuideParams

type ScalarDocNewGuideParams struct {
	AllowedDomains param.Field[[]string] `json:"allowedDomains" api:"required"`
	AllowedUsers   param.Field[[]string] `json:"allowedUsers" api:"required"`
	IsPrivate      param.Field[bool]     `json:"isPrivate" api:"required"`
	Name           param.Field[string]   `json:"name" api:"required"`
	Slug           param.Field[string]   `json:"slug"`
}

func (ScalarDocNewGuideParams) MarshalJSON

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

type ScalarDocNewGuideResponse

type ScalarDocNewGuideResponse struct {
	UID  string                        `json:"uid" api:"required"`
	Slug string                        `json:"slug" api:"required"`
	JSON scalarDocNewGuideResponseJSON `json:"-"`
}

func (*ScalarDocNewGuideResponse) UnmarshalJSON

func (r *ScalarDocNewGuideResponse) UnmarshalJSON(data []byte) (err error)

type ScalarDocPublishGuideResponse

type ScalarDocPublishGuideResponse struct {
	PublishUID string                            `json:"publishUid" api:"required"`
	JSON       scalarDocPublishGuideResponseJSON `json:"-"`
}

func (*ScalarDocPublishGuideResponse) UnmarshalJSON

func (r *ScalarDocPublishGuideResponse) UnmarshalJSON(data []byte) (err error)

type ScalarDocService

type ScalarDocService struct {
	Options []option.RequestOption
}

ScalarDocService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewScalarDocService method instead.

func NewScalarDocService

func NewScalarDocService(opts ...option.RequestOption) (r *ScalarDocService)

NewScalarDocService 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 (*ScalarDocService) ListGuides

func (r *ScalarDocService) ListGuides(ctx context.Context, opts ...option.RequestOption) (res *[]GithubProject, err error)

List all guide projects.

Parameters:

ctx: Context for the request.
opts: Options to apply to this request.

Returns:

*[]GithubProject: Default Response

Example:

scalarDoc, err := client.ScalarDocs.ListGuides(context.Background())
if err != nil {
	panic(err)
}

fmt.Println(scalarDoc)

func (*ScalarDocService) NewGuide

Create a guide project.

Parameters:

ctx: Context for the request.
body: ScalarDocNewGuideParams request parameters.
opts: Options to apply to this request.

Returns:

*ScalarDocNewGuideResponse: Default Response

Example:

scalarDoc, err := client.ScalarDocs.NewGuide(context.Background(), sdk.ScalarDocNewGuideParams{
	AllowedDomains: sdk.F[[]string]([]string{""}),
	AllowedUsers:   sdk.F[[]string]([]string{""}),
	IsPrivate:      sdk.F[bool](false),
	Name:           sdk.F[string](""),
})
if err != nil {
	panic(err)
}

fmt.Println(scalarDoc)

func (*ScalarDocService) PublishGuide

func (r *ScalarDocService) PublishGuide(ctx context.Context, slug string, opts ...option.RequestOption) (res *ScalarDocPublishGuideResponse, err error)

Start a new publish process.

Parameters:

ctx: Context for the request.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*ScalarDocPublishGuideResponse: Default Response

Example:

scalarDoc, err := client.ScalarDocs.PublishGuide(context.Background(), "slug")
if err != nil {
	panic(err)
}

fmt.Println(scalarDoc)

type Schema

type Schema struct {
	UID         string          `json:"uid" api:"required"`
	Title       string          `json:"title" api:"required"`
	Description string          `json:"description" api:"required"`
	Slug        string          `json:"slug" api:"required"`
	Namespace   string          `json:"namespace" api:"required"`
	IsPrivate   bool            `json:"isPrivate" api:"required"`
	Versions    []SchemaVersion `json:"versions" api:"required"`
	JSON        schemaJSON      `json:"-"`
}

func (*Schema) UnmarshalJSON

func (r *Schema) UnmarshalJSON(data []byte) (err error)

type SchemaAccessGroupDeleteParams added in v0.4.0

type SchemaAccessGroupDeleteParams struct {
	AccessGroup AccessGroupParam `json:"access_group" api:"required"`
}

func (SchemaAccessGroupDeleteParams) MarshalJSON added in v0.4.0

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

type SchemaAccessGroupNewParams added in v0.4.0

type SchemaAccessGroupNewParams struct {
	AccessGroup AccessGroupParam `json:"access_group" api:"required"`
}

func (SchemaAccessGroupNewParams) MarshalJSON added in v0.4.0

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

type SchemaAccessGroupService

type SchemaAccessGroupService struct {
	Options []option.RequestOption
}

SchemaAccessGroupService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewSchemaAccessGroupService method instead.

func NewSchemaAccessGroupService

func NewSchemaAccessGroupService(opts ...option.RequestOption) (r *SchemaAccessGroupService)

NewSchemaAccessGroupService 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 (*SchemaAccessGroupService) Delete added in v0.4.0

func (r *SchemaAccessGroupService) Delete(ctx context.Context, namespace string, slug string, body SchemaAccessGroupDeleteParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Remove an access group from a schema.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: SchemaAccessGroupDeleteParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

accessGroup, err := client.Schemas.AccessGroup.Delete(context.Background(), "namespace", "slug", sdk.SchemaAccessGroupDeleteParams{
	AccessGroup: sdk.AccessGroupParam{
		AccessGroupSlug: sdk.F[string]("xxx"),
	},
})
if err != nil {
	panic(err)
}

fmt.Println(accessGroup)

func (*SchemaAccessGroupService) New added in v0.4.0

func (r *SchemaAccessGroupService) New(ctx context.Context, namespace string, slug string, body SchemaAccessGroupNewParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Add an access group to a schema.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: SchemaAccessGroupNewParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

accessGroup, err := client.Schemas.AccessGroup.New(context.Background(), "namespace", "slug", sdk.SchemaAccessGroupNewParams{
	AccessGroup: sdk.AccessGroupParam{
		AccessGroupSlug: sdk.F[string]("xxx"),
	},
})
if err != nil {
	panic(err)
}

fmt.Println(accessGroup)

type SchemaNewParams

type SchemaNewParams struct {
	Document    param.Field[string] `json:"document" api:"required"`
	Slug        param.Field[string] `json:"slug" api:"required"`
	Title       param.Field[string] `json:"title" api:"required"`
	Version     param.Field[string] `json:"version" api:"required"`
	Description param.Field[string] `json:"description"`
	IsPrivate   param.Field[bool]   `json:"isPrivate"`
}

func (SchemaNewParams) MarshalJSON

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

type SchemaService

type SchemaService struct {
	Options     []option.RequestOption
	Version     *SchemaVersionService
	AccessGroup *SchemaAccessGroupService
}

SchemaService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewSchemaService method instead.

func NewSchemaService

func NewSchemaService(opts ...option.RequestOption) (r *SchemaService)

NewSchemaService 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 (*SchemaService) Delete

func (r *SchemaService) Delete(ctx context.Context, namespace string, slug string, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Delete a schema and all related versions.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

schema, err := client.Schemas.Delete(context.Background(), "namespace", "slug")
if err != nil {
	panic(err)
}

fmt.Println(schema)

func (*SchemaService) List

func (r *SchemaService) List(ctx context.Context, namespace string, opts ...option.RequestOption) (res *[]Schema, err error)

List schemas in a namespace.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
opts: Options to apply to this request.

Returns:

*[]Schema: Default Response

Example:

schema, err := client.Schemas.List(context.Background(), "namespace")
if err != nil {
	panic(err)
}

fmt.Println(schema)

func (*SchemaService) New

func (r *SchemaService) New(ctx context.Context, namespace string, body SchemaNewParams, opts ...option.RequestOption) (res *shared.UID, err error)

Create a schema in a namespace.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
body: SchemaNewParams request parameters.
opts: Options to apply to this request.

Returns:

*shared.UID: Default Response

Example:

schema, err := client.Schemas.New(context.Background(), "namespace", sdk.SchemaNewParams{
	Document: sdk.F[string](""),
	Slug:     sdk.F[string](""),
	Title:    sdk.F[string](""),
	Version:  sdk.F[string]("x"),
})
if err != nil {
	panic(err)
}

fmt.Println(schema)

func (*SchemaService) Update

func (r *SchemaService) Update(ctx context.Context, namespace string, slug string, body SchemaUpdateParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Update schema metadata.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: SchemaUpdateParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

schema, err := client.Schemas.Update(context.Background(), "namespace", "slug", sdk.SchemaUpdateParams{})
if err != nil {
	panic(err)
}

fmt.Println(schema)

type SchemaUpdateParams

type SchemaUpdateParams struct {
	Description param.Field[string] `json:"description"`
	IsPrivate   param.Field[bool]   `json:"isPrivate"`
	Title       param.Field[string] `json:"title"`
}

func (SchemaUpdateParams) MarshalJSON

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

type SchemaVersion

type SchemaVersion struct {
	UID       string            `json:"uid" api:"required"`
	CreatedAt int64             `json:"createdAt" api:"required"`
	UpdatedAt int64             `json:"updatedAt" api:"required"`
	Version   string            `json:"version" api:"required"`
	JSON      schemaVersionJSON `json:"-"`
}

func (*SchemaVersion) UnmarshalJSON

func (r *SchemaVersion) UnmarshalJSON(data []byte) (err error)

type SchemaVersionNewParams added in v0.4.0

type SchemaVersionNewParams struct {
	Document param.Field[string] `json:"document" api:"required"`
	Version  param.Field[string] `json:"version" api:"required"`
}

func (SchemaVersionNewParams) MarshalJSON added in v0.4.0

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

type SchemaVersionService

type SchemaVersionService struct {
	Options []option.RequestOption
}

SchemaVersionService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewSchemaVersionService method instead.

func NewSchemaVersionService

func NewSchemaVersionService(opts ...option.RequestOption) (r *SchemaVersionService)

NewSchemaVersionService 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 (*SchemaVersionService) Delete added in v0.4.0

func (r *SchemaVersionService) Delete(ctx context.Context, namespace string, slug string, semver string, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Delete a schema version.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
semver: Path parameter.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

version, err := client.Schemas.Version.Delete(context.Background(), "namespace", "slug", "semver")
if err != nil {
	panic(err)
}

fmt.Println(version)

func (*SchemaVersionService) Get added in v0.4.0

func (r *SchemaVersionService) Get(ctx context.Context, namespace string, slug string, semver string, opts ...option.RequestOption) (res *string, err error)

Get a specific schema version document.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
semver: Path parameter.
opts: Options to apply to this request.

Returns:

*string: Default Response

Example:

version, err := client.Schemas.Version.Get(context.Background(), "namespace", "slug", "semver")
if err != nil {
	panic(err)
}

fmt.Println(version)

func (*SchemaVersionService) New added in v0.4.0

func (r *SchemaVersionService) New(ctx context.Context, namespace string, slug string, body SchemaVersionNewParams, opts ...option.RequestOption) (res *shared.UID, err error)

Create a schema version.

Parameters:

ctx: Context for the request.
namespace: Path parameter.
slug: Path parameter.
body: SchemaVersionNewParams request parameters.
opts: Options to apply to this request.

Returns:

*shared.UID: Default Response

Example:

version, err := client.Schemas.Version.New(context.Background(), "namespace", "slug", sdk.SchemaVersionNewParams{
	Document: sdk.F[string](""),
	Version:  sdk.F[string]("x"),
})
if err != nil {
	panic(err)
}

fmt.Println(version)

type Team

type Team struct {
	UID      string   `json:"uid" api:"required"`
	Name     string   `json:"name" api:"required"`
	Slug     string   `json:"slug" api:"required"`
	Theme    string   `json:"theme" api:"required"`
	ImageURI string   `json:"imageUri"`
	JSON     teamJSON `json:"-"`
}

func (*Team) UnmarshalJSON

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

type TeamService

type TeamService struct {
	Options []option.RequestOption
}

TeamService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewTeamService method instead.

func NewTeamService

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

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

func (*TeamService) List

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

List all available teams

Parameters:

ctx: Context for the request.
opts: Options to apply to this request.

Returns:

*[]Team: Default Response

Example:

team, err := client.Teams.List(context.Background())
if err != nil {
	panic(err)
}

fmt.Println(team)

type Theme

type Theme struct {
	UID         string    `json:"uid" api:"required"`
	Name        string    `json:"name" api:"required"`
	Description string    `json:"description" api:"required"`
	Slug        string    `json:"slug" api:"required"`
	JSON        themeJSON `json:"-"`
}

func (*Theme) UnmarshalJSON

func (r *Theme) UnmarshalJSON(data []byte) (err error)

type ThemeNewParams

type ThemeNewParams struct {
	Document    param.Field[string] `json:"document" api:"required"`
	Name        param.Field[string] `json:"name" api:"required"`
	Slug        param.Field[string] `json:"slug" api:"required"`
	Description param.Field[string] `json:"description"`
}

func (ThemeNewParams) MarshalJSON

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

type ThemeReplaceDocumentParams

type ThemeReplaceDocumentParams struct {
	Document param.Field[string] `json:"document" api:"required"`
}

func (ThemeReplaceDocumentParams) MarshalJSON

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

type ThemeService

type ThemeService struct {
	Options []option.RequestOption
}

ThemeService contains methods and other services that help with interacting with the API. You should not instantiate this service directly, and instead use the NewThemeService method instead.

func NewThemeService

func NewThemeService(opts ...option.RequestOption) (r *ThemeService)

NewThemeService 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 (*ThemeService) Delete

func (r *ThemeService) Delete(ctx context.Context, slug string, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Delete a theme by slug.

Parameters:

ctx: Context for the request.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

theme, err := client.Themes.Delete(context.Background(), "slug")
if err != nil {
	panic(err)
}

fmt.Println(theme)

func (*ThemeService) Get

func (r *ThemeService) Get(ctx context.Context, slug string, opts ...option.RequestOption) (res *string, err error)

Get the theme document by slug.

Parameters:

ctx: Context for the request.
slug: Path parameter.
opts: Options to apply to this request.

Returns:

*string: Default Response

Example:

theme, err := client.Themes.Get(context.Background(), "slug")
if err != nil {
	panic(err)
}

fmt.Println(theme)

func (*ThemeService) List

func (r *ThemeService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Theme, err error)

List all team themes.

Parameters:

ctx: Context for the request.
opts: Options to apply to this request.

Returns:

*[]Theme: Default Response

Example:

theme, err := client.Themes.List(context.Background())
if err != nil {
	panic(err)
}

fmt.Println(theme)

func (*ThemeService) New

func (r *ThemeService) New(ctx context.Context, body ThemeNewParams, opts ...option.RequestOption) (res *shared.UID, err error)

Create a team theme.

Parameters:

ctx: Context for the request.
body: ThemeNewParams request parameters.
opts: Options to apply to this request.

Returns:

*shared.UID: Default Response

Example:

theme, err := client.Themes.New(context.Background(), sdk.ThemeNewParams{
	Document: sdk.F[string](""),
	Name:     sdk.F[string](""),
	Slug:     sdk.F[string](""),
})
if err != nil {
	panic(err)
}

fmt.Println(theme)

func (*ThemeService) ReplaceDocument

func (r *ThemeService) ReplaceDocument(ctx context.Context, slug string, body ThemeReplaceDocumentParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Replace the theme document.

Parameters:

ctx: Context for the request.
slug: Path parameter.
body: ThemeReplaceDocumentParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

theme, err := client.Themes.ReplaceDocument(context.Background(), "slug", sdk.ThemeReplaceDocumentParams{
	Document: sdk.F[string](""),
})
if err != nil {
	panic(err)
}

fmt.Println(theme)

func (*ThemeService) Update

func (r *ThemeService) Update(ctx context.Context, slug string, body ThemeUpdateParams, opts ...option.RequestOption) (res *map[string]interface{}, err error)

Update theme metadata.

Parameters:

ctx: Context for the request.
slug: Path parameter.
body: ThemeUpdateParams request parameters.
opts: Options to apply to this request.

Returns:

*map[string]interface{}: Default Response

Example:

theme, err := client.Themes.Update(context.Background(), "slug", sdk.ThemeUpdateParams{})
if err != nil {
	panic(err)
}

fmt.Println(theme)

type ThemeUpdateParams

type ThemeUpdateParams struct {
	Description param.Field[string] `json:"description"`
	Name        param.Field[string] `json:"name"`
}

func (ThemeUpdateParams) MarshalJSON

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

type Timestamp added in v0.4.0

type Timestamp = shared.Timestamp

type UID added in v0.4.0

type UID = shared.UID

type Value400 added in v0.4.0

type Value400 = shared.Value400

type Value401 added in v0.4.0

type Value401 = shared.Value401

type Value403 added in v0.4.0

type Value403 = shared.Value403

type Value404 added in v0.4.0

type Value404 = shared.Value404

type Value422 added in v0.4.0

type Value422 = shared.Value422

type Value500 added in v0.4.0

type Value500 = shared.Value500

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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