Documentation
¶
Index ¶
- Variables
- func BoolRef(value bool) *bool
- func IntRef(value int) *int
- func StringRef(value string) *string
- type Auth
- type Client
- type ClientConfig
- type ContentType
- type ContentTypeInput
- type ContentTypeOptions
- type ContentTypeRequest
- type ContentTypeResponse
- type Entry
- type EntryContextInput
- type EntryInput
- type EntryRequest
- type EntryResponse
- type Environment
- type EnvironmentInput
- type EnvironmentRequest
- type EnvironmentResponse
- type EnvironmentUrl
- type ErrorMessage
- type FlexString
- type GlobalField
- type GlobalFieldInput
- type GlobalFieldRequest
- type GlobalFieldResponse
- type Locale
- type LocaleInput
- type LocaleRequest
- type LocaleResponse
- type LogTransport
- type OrganizationClient
- type Stack
- type StackAuth
- type StackInstance
- func (si *StackInstance) ContentTypeCreate(ctx context.Context, input ContentTypeInput) (*ContentType, error)
- func (si *StackInstance) ContentTypeDelete(ctx context.Context, uid string) error
- func (si *StackInstance) ContentTypeFetch(ctx context.Context, uid string) (*ContentType, error)
- func (si *StackInstance) ContentTypeFetchAll(ctx context.Context) ([]ContentType, error)
- func (si *StackInstance) ContentTypeUpdate(ctx context.Context, uid string, input ContentTypeInput) (*ContentType, error)
- func (si *StackInstance) EntryCreate(ctx context.Context, input *EntryInput) (*Entry, error)
- func (si *StackInstance) EntryDelete(ctx context.Context, input *EntryContextInput) error
- func (si *StackInstance) EntryFetch(ctx context.Context, input *EntryContextInput) (*Entry, error)
- func (si *StackInstance) EntryFetchAll(ctx context.Context, contentTypeUID string) ([]Entry, error)
- func (si *StackInstance) EntryUpdate(ctx context.Context, uid string, input *EntryInput) (*Entry, error)
- func (si *StackInstance) EnvironmentCreate(ctx context.Context, input EnvironmentInput) (*Environment, error)
- func (si *StackInstance) EnvironmentDelete(ctx context.Context, name string) error
- func (si *StackInstance) EnvironmentFetch(ctx context.Context, name string) (*Environment, error)
- func (si *StackInstance) EnvironmentFetchAll(ctx context.Context, name string) ([]Environment, error)
- func (si *StackInstance) EnvironmentUpdate(ctx context.Context, name string, input EnvironmentInput) (*Environment, error)
- func (si *StackInstance) GlobalFieldCreate(ctx context.Context, input GlobalFieldInput) (*GlobalField, error)
- func (si *StackInstance) GlobalFieldDelete(ctx context.Context, uid string) error
- func (si *StackInstance) GlobalFieldFetch(ctx context.Context, uid string) (*GlobalField, error)
- func (si *StackInstance) GlobalFieldFetchAll(ctx context.Context) ([]GlobalField, error)
- func (si *StackInstance) GlobalFieldUpdate(ctx context.Context, uid string, input GlobalFieldInput) (*GlobalField, error)
- func (si *StackInstance) LocaleCreate(ctx context.Context, input LocaleInput) (*Locale, error)
- func (si *StackInstance) LocaleDelete(ctx context.Context, code string) error
- func (si *StackInstance) LocaleFetch(ctx context.Context, code string) (*Locale, error)
- func (si *StackInstance) LocaleFetchAll(ctx context.Context) ([]Locale, error)
- func (si *StackInstance) LocaleUpdate(ctx context.Context, code string, input LocaleInput) (*Locale, error)
- func (si *StackInstance) Settings(ctx context.Context) (*StackSettings, error)
- func (si *StackInstance) WebHookCreate(ctx context.Context, input WebHookInput) (*WebHook, error)
- func (si *StackInstance) WebHookDelete(ctx context.Context, uid string) error
- func (si *StackInstance) WebHookFetch(ctx context.Context, uid string) (*WebHook, error)
- func (si *StackInstance) WebHookFetchAll(ctx context.Context) ([]WebHook, error)
- func (si *StackInstance) WebHookUpdate(ctx context.Context, uid string, input WebHookInput) (*WebHook, error)
- type StackSettings
- type StacksInput
- type UserCredentials
- type WebHook
- type WebHookInput
- type WebHookRequest
- type WebHookResponse
- type WebhookDestination
- type WebhookHeader
Constants ¶
This section is empty.
Variables ¶
var DebugTransport = &LogTransport{ transport: http.DefaultTransport, }
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg ClientConfig) (*Client, error)
func NewClientWithToken ¶
func (*Client) Organization ¶
func (c *Client) Organization(ouid string) *OrganizationClient
type ClientConfig ¶
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 ¶
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 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
}
type OrganizationClient ¶
type OrganizationClient struct {
// contains filtered or unexported fields
}
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 (*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 (*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 (*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 UserCredentials ¶
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"`
}