Help us shape the future of Go! Take the 2026 Go Developer Survey

management

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugTransport = &LogTransport{
	transport: http.DefaultTransport,
}

Functions

func BoolRef

func BoolRef(value bool) *bool

func IntRef

func IntRef(value int) *int

func StringRef

func StringRef(value string) *string

Types

type Auth

type Auth struct {
	AuthToken string
}

type Client

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

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

func NewClientWithToken

func NewClientWithToken(auth *Auth) *Client

func (*Client) Login

func (c *Client) Login(ctx context.Context, s UserCredentials) error

func (*Client) Organization

func (c *Client) Organization(ouid string) *OrganizationClient

func (*Client) Stack

func (c *Client) Stack(s *StackAuth) (*StackInstance, error)

Stack creates a new StackInstance which can be used for actions on the given stack instance.

func (*Client) Stacks

func (c *Client) Stacks(ctx context.Context, input StacksInput) ([]Stack, error)

type ClientConfig

type ClientConfig struct {
	BaseURL         string
	HTTPClient      *http.Client
	AuthToken       string
	OrganizationUID string
}

type ContentType

type ContentType struct {
	CreatedAt         time.Time           `json:"created_at"`
	UpdatedAt         time.Time           `json:"updated_at"`
	Title             string              `json:"title,omitempty"`
	UID               string              `json:"uid,omitempty"`
	Schema            json.RawMessage     `json:"schema"`
	Options           *ContentTypeOptions `json:"options"`
	MaintainRevisions bool                `json:"maintain_revisions"`
	Description       string              `json:"description"`
}

ContentType represents the content type in contentstack.

type ContentTypeInput

type ContentTypeInput struct {
	Title       *string         `json:"title,omitempty"`
	UID         *string         `json:"uid,omitempty"`
	Description *string         `json:"description,omitempty"`
	Schema      json.RawMessage `json:"schema,omitempty"`
}

ContentTypeInput is used to create or update a content type

type ContentTypeOptions

type ContentTypeOptions struct {
	Title       string     `json:"title"`
	Publishable bool       `json:"bool"`
	IsPage      bool       `json:"is_page"`
	Singleton   bool       `json:"singleton"`
	SubTitle    []string   `json:"sub_title"`
	UrlPattern  FlexString `json:"url_pattern"`
	UrlPrefix   FlexString `json:"url_prefix"`
}

type ContentTypeRequest

type ContentTypeRequest struct {
	ContentType ContentTypeInput `json:"content_type"`
}

type ContentTypeResponse

type ContentTypeResponse struct {
	ContentType ContentType `json:"content_type"`
}

type Entry

type Entry struct {
	UID       string    `json:"uid"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	CreatedBy string    `json:"created_by"`
	UpdatedBy string    `json:"updated_by"`
	Locale    string    `json:"locale"`
	Version   int       `json:"_version"`

	Fields map[string]interface{} `json:"-"`
}

Entry represents the content type in contentstack.

type EntryContextInput

type EntryContextInput struct {
	ContentTypeUID string
	Locale         string
	UID            string
}

EntryDeleteInput is used to delete an entry

type EntryInput

type EntryInput struct {
	ContentTypeUID string `json:"-"`
	Locale         string `json:"-"`
	Fields         map[string]interface{}
}

EntryInput is used to create or update a entry

type EntryRequest

type EntryRequest struct {
	Entry json.RawMessage `json:"entry"`
}

type EntryResponse

type EntryResponse struct {
	Entry json.RawMessage `json:"entry"`
}

type Environment added in v0.1.0

type Environment struct {
	CreatedAt time.Time        `json:"created_at"`
	UpdatedAt time.Time        `json:"updated_at"`
	Name      string           `json:"name"`
	UID       string           `json:"uid,omitempty"`
	URLs      []EnvironmentUrl `json:"urls"`
}

Environment represents the environment in contentstack

type EnvironmentInput added in v0.1.0

type EnvironmentInput struct {
	Name string           `json:"name"`
	URLs []EnvironmentUrl `json:"urls"`
}

EnvironmentInput is used to create or update an environment

type EnvironmentRequest added in v0.1.0

type EnvironmentRequest struct {
	Environment EnvironmentInput `json:"environment"`
}

type EnvironmentResponse added in v0.1.0

type EnvironmentResponse struct {
	Environment Environment `json:"environment"`
}

type EnvironmentUrl added in v0.1.0

type EnvironmentUrl struct {
	Locale string `json:"locale"`
	URL    string `json:"url"`
}

type ErrorMessage

type ErrorMessage struct {
	ErrorMessage string              `json:"error_message"`
	ErrorCode    int                 `json:"error_code"`
	Errors       map[string][]string `json:"errors"`
}

func (*ErrorMessage) Error

func (e *ErrorMessage) Error() string

type FlexString added in v0.1.1

type FlexString string

FlexString unmarshals a JSON value that is either a string or a boolean. The Contentstack API returns false (boolean) for string fields that are unset, rather than omitting them or returning an empty string.

func (*FlexString) UnmarshalJSON added in v0.1.1

func (f *FlexString) UnmarshalJSON(data []byte) error

type GlobalField

type GlobalField struct {
	CreatedAt         time.Time       `json:"created_at"`
	UpdatedAt         time.Time       `json:"updated_at"`
	Title             string          `json:"title,omitempty"`
	UID               string          `json:"uid,omitempty"`
	Schema            json.RawMessage `json:"schema"`
	MaintainRevisions bool            `json:"maintain_revisions"`
	Description       string          `json:"description"`
}

GlobalField represents the global field in contentstack.

type GlobalFieldInput

type GlobalFieldInput struct {
	Title             *string         `json:"title,omitempty"`
	UID               *string         `json:"uid,omitempty"`
	Description       *string         `json:"description,omitempty"`
	MaintainRevisions bool            `json:"maintain_revisions"`
	Schema            json.RawMessage `json:"schema,omitempty"`
}

GlobalFieldInput is used to create or update a content type

type GlobalFieldRequest

type GlobalFieldRequest struct {
	GlobalField GlobalFieldInput `json:"global_field"`
}

type GlobalFieldResponse

type GlobalFieldResponse struct {
	GlobalField GlobalField `json:"global_field"`
}

type Locale

type Locale struct {
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	Name           string    `json:"name,omitempty"`
	UID            string    `json:"uid,omitempty"`
	Code           string    `json:"code"`
	FallbackLocale string    `json:"fallback_locale"`
}

Locale represents the global field in contentstack.

type LocaleInput

type LocaleInput struct {
	Name           string `json:"name,omitempty"`
	Code           string `json:"code"`
	FallbackLocale string `json:"fallback_locale"`
}

LocaleInput is used to create or update a content type

type LocaleRequest

type LocaleRequest struct {
	Locale LocaleInput `json:"locale"`
}

type LocaleResponse

type LocaleResponse struct {
	Locale Locale `json:"locale"`
}

type LogTransport

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

func (*LogTransport) RoundTrip

func (c *LogTransport) RoundTrip(request *http.Request) (*http.Response, error)

type OrganizationClient

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

type Stack

type Stack struct {
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	UID             string    `json:"uid"`
	OrganizationUID string    `json:"org_uid"`
	ApiKey          string    `json:"api_key"`
	Name            string    `json:"name"`
	MasterLocale    string    `json:"master_locale"`
}

type StackAuth

type StackAuth struct {
	ApiKey          string
	ManagementToken string
	Branch          string
}

type StackInstance

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

func (*StackInstance) ContentTypeCreate

func (si *StackInstance) ContentTypeCreate(ctx context.Context, input ContentTypeInput) (*ContentType, error)

func (*StackInstance) ContentTypeDelete

func (si *StackInstance) ContentTypeDelete(ctx context.Context, uid string) error

func (*StackInstance) ContentTypeFetch

func (si *StackInstance) ContentTypeFetch(ctx context.Context, uid string) (*ContentType, error)

func (*StackInstance) ContentTypeFetchAll

func (si *StackInstance) ContentTypeFetchAll(ctx context.Context) ([]ContentType, error)

func (*StackInstance) ContentTypeUpdate

func (si *StackInstance) ContentTypeUpdate(ctx context.Context, uid string, input ContentTypeInput) (*ContentType, error)

func (*StackInstance) EntryCreate

func (si *StackInstance) EntryCreate(ctx context.Context, input *EntryInput) (*Entry, error)

func (*StackInstance) EntryDelete

func (si *StackInstance) EntryDelete(ctx context.Context, input *EntryContextInput) error

func (*StackInstance) EntryFetch

func (si *StackInstance) EntryFetch(ctx context.Context, input *EntryContextInput) (*Entry, error)

func (*StackInstance) EntryFetchAll

func (si *StackInstance) EntryFetchAll(ctx context.Context, contentTypeUID string) ([]Entry, error)

func (*StackInstance) EntryUpdate

func (si *StackInstance) EntryUpdate(ctx context.Context, uid string, input *EntryInput) (*Entry, error)

func (*StackInstance) EnvironmentCreate added in v0.1.0

func (si *StackInstance) EnvironmentCreate(ctx context.Context, input EnvironmentInput) (*Environment, error)

func (*StackInstance) EnvironmentDelete added in v0.1.0

func (si *StackInstance) EnvironmentDelete(ctx context.Context, name string) error

func (*StackInstance) EnvironmentFetch added in v0.1.0

func (si *StackInstance) EnvironmentFetch(ctx context.Context, name string) (*Environment, error)

func (*StackInstance) EnvironmentFetchAll added in v0.1.0

func (si *StackInstance) EnvironmentFetchAll(ctx context.Context, name string) ([]Environment, error)

func (*StackInstance) EnvironmentUpdate added in v0.1.0

func (si *StackInstance) EnvironmentUpdate(ctx context.Context, name string, input EnvironmentInput) (*Environment, error)

func (*StackInstance) GlobalFieldCreate

func (si *StackInstance) GlobalFieldCreate(ctx context.Context, input GlobalFieldInput) (*GlobalField, error)

func (*StackInstance) GlobalFieldDelete

func (si *StackInstance) GlobalFieldDelete(ctx context.Context, uid string) error

func (*StackInstance) GlobalFieldFetch

func (si *StackInstance) GlobalFieldFetch(ctx context.Context, uid string) (*GlobalField, error)

func (*StackInstance) GlobalFieldFetchAll

func (si *StackInstance) GlobalFieldFetchAll(ctx context.Context) ([]GlobalField, error)

func (*StackInstance) GlobalFieldUpdate

func (si *StackInstance) GlobalFieldUpdate(ctx context.Context, uid string, input GlobalFieldInput) (*GlobalField, error)

func (*StackInstance) LocaleCreate

func (si *StackInstance) LocaleCreate(ctx context.Context, input LocaleInput) (*Locale, error)

func (*StackInstance) LocaleDelete

func (si *StackInstance) LocaleDelete(ctx context.Context, code string) error

func (*StackInstance) LocaleFetch

func (si *StackInstance) LocaleFetch(ctx context.Context, code string) (*Locale, error)

func (*StackInstance) LocaleFetchAll

func (si *StackInstance) LocaleFetchAll(ctx context.Context) ([]Locale, error)

func (*StackInstance) LocaleUpdate

func (si *StackInstance) LocaleUpdate(ctx context.Context, code string, input LocaleInput) (*Locale, error)

func (*StackInstance) Settings

func (si *StackInstance) Settings(ctx context.Context) (*StackSettings, error)

func (*StackInstance) WebHookCreate

func (si *StackInstance) WebHookCreate(ctx context.Context, input WebHookInput) (*WebHook, error)

func (*StackInstance) WebHookDelete

func (si *StackInstance) WebHookDelete(ctx context.Context, uid string) error

func (*StackInstance) WebHookFetch

func (si *StackInstance) WebHookFetch(ctx context.Context, uid string) (*WebHook, error)

func (*StackInstance) WebHookFetchAll

func (si *StackInstance) WebHookFetchAll(ctx context.Context) ([]WebHook, error)

func (*StackInstance) WebHookUpdate

func (si *StackInstance) WebHookUpdate(ctx context.Context, uid string, input WebHookInput) (*WebHook, error)

type StackSettings

type StackSettings struct {
}

type StacksInput

type StacksInput struct {
	OrganizationUid string
	IncludeCount    bool
	Limit           int
	Skip            int
	Asc             string
	Desc            string
}

type UserCredentials

type UserCredentials struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type WebHook

type WebHook struct {
	UID             string               `json:"uid,omitempty"`
	CreatedAt       time.Time            `json:"created_at"`
	UpdatedAt       time.Time            `json:"updated_at"`
	CreatedBy       string               `json:"created_by"`
	UpdatedBy       string               `json:"updated_by"`
	Name            string               `json:"name"`
	OrganizationUID string               `json:"org_uid,omitempty"`
	Channels        []string             `json:"channels"`
	Branches        []string             `json:"branches"`
	Destinations    []WebhookDestination `json:"destinations"`
	RetryPolicy     string               `json:"retry_policy"`
	Disabled        bool                 `json:"disabled"`
	ConcisePayload  bool                 `json:"concise_payload"`
}

WebHook represents the content type in contentstack.

type WebHookInput

type WebHookInput struct {
	Name           string               `json:"name"`
	Branches       []string             `json:"branches"`
	Channels       []string             `json:"channels"`
	Destinations   []WebhookDestination `json:"destinations"`
	RetryPolicy    string               `json:"retry_policy"`
	Disabled       bool                 `json:"disabled"`
	ConcisePayload bool                 `json:"concise_payload"`
}

WebHookInput is used to create or update a content type

type WebHookRequest

type WebHookRequest struct {
	WebHook WebHookInput `json:"webhook"`
}

type WebHookResponse

type WebHookResponse struct {
	WebHook WebHook `json:"webhook"`
}

type WebhookDestination

type WebhookDestination struct {
	TargetURL         string          `json:"target_url"`
	HttpBasicAuth     string          `json:"http_basic_auth"`
	HttpBasicPassword string          `json:"http_basic_password"`
	CustomHeaders     []WebhookHeader `json:"custom_header"`
}

type WebhookHeader

type WebhookHeader struct {
	Name  string `json:"header_name"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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