management

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 11 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  string   `json:"url_pattern"`
	UrlPrefix   string   `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 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 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
}

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