Documentation ¶
Index ¶
- Constants
- Variables
- type APIError
- type APIKey
- type APIKeyPolicy
- type APIKeyService
- type AccessDeniedError
- type AccessToken
- type AccessTokenInvalidError
- type AccessTokensService
- type AliasDetail
- type AppDefinition
- type AppDefinitionsService
- func (service *AppDefinitionsService) Delete(organizationID, appDefinitionID string) error
- func (service *AppDefinitionsService) Get(organizationID, appDefinitionID string) (*AppDefinition, error)
- func (service *AppDefinitionsService) List(organizationID string) *Collection
- func (service *AppDefinitionsService) Upsert(organizationID string, definition *AppDefinition) error
- type AppInstallation
- type AppInstallationsService
- func (service *AppInstallationsService) Delete(spaceID, appInstallationID string) error
- func (service *AppInstallationsService) Get(spaceID, appInstallationID string) (*AppInstallation, error)
- func (service *AppInstallationsService) List(spaceID string) *Collection
- func (service *AppInstallationsService) Upsert(spaceID, appInstallationID string, installation *AppInstallation) error
- type Asset
- type AssetFields
- type AssetsService
- func (service *AssetsService) Archive(spaceID string, asset *Asset) error
- func (service *AssetsService) Delete(spaceID string, asset *Asset) error
- func (service *AssetsService) Get(spaceID, assetID string) (*Asset, error)
- func (service *AssetsService) List(spaceID string) *Collection
- func (service *AssetsService) ListPublished(spaceID string) *Collection
- func (service *AssetsService) Process(spaceID string, asset *Asset) error
- func (service *AssetsService) Publish(spaceID string, asset *Asset) error
- func (service *AssetsService) Unarchive(spaceID string, asset *Asset) error
- func (service *AssetsService) Unpublish(spaceID string, asset *Asset) error
- func (service *AssetsService) Upsert(spaceID string, asset *Asset) error
- type AssignedTo
- type BadRequestError
- type Client
- type Collection
- func (col *Collection) Next() (*Collection, error)
- func (col *Collection) ToAPIKey() []*APIKey
- func (col *Collection) ToAccessToken() []*AccessToken
- func (col *Collection) ToAppDefinition() []*AppDefinition
- func (col *Collection) ToAppInstallation() []*AppInstallation
- func (col *Collection) ToAsset() []*Asset
- func (col *Collection) ToContentType() []*ContentType
- func (col *Collection) ToContentTypeSnapshot() []*ContentTypeSnapshot
- func (col *Collection) ToEditorInterface() []*EditorInterface
- func (col *Collection) ToEntry() []*Entry
- func (col *Collection) ToEntrySnapshot() []*EntrySnapshot
- func (col *Collection) ToEntryTask() []*EntryTask
- func (col *Collection) ToEnvironment() []*Environment
- func (col *Collection) ToEnvironmentAlias() []*EnvironmentAlias
- func (col *Collection) ToExtension() []*Extension
- func (col *Collection) ToLocale() []*Locale
- func (col *Collection) ToMembership() []*Membership
- func (col *Collection) ToOrganization() []*Organization
- func (col *Collection) ToRole() []*Role
- func (col *Collection) ToScheduledAction() []*ScheduledAction
- func (col *Collection) ToSpace() []*Space
- func (col *Collection) ToUsage() []*Usage
- func (col *Collection) ToWebhook() []*Webhook
- func (col *Collection) ToWebhookCall() []*WebhookCall
- type CollectionOptions
- type Constraint
- type ConstraintDetail
- type ContentType
- type ContentTypeFields
- type ContentTypeSnapshot
- type ContentTypeSnapshotDetail
- type ContentTypesService
- func (service *ContentTypesService) Activate(spaceID string, ct *ContentType) error
- func (service *ContentTypesService) ActivateWithEnv(env *Environment, ct *ContentType) error
- func (service *ContentTypesService) Deactivate(spaceID string, ct *ContentType) error
- func (service *ContentTypesService) DeactivateWithEnv(env *Environment, ct *ContentType) error
- func (service *ContentTypesService) Delete(spaceID string, ct *ContentType) error
- func (service *ContentTypesService) DeleteWithEnv(env *Environment, ct *ContentType) error
- func (service *ContentTypesService) Get(spaceID, contentTypeID string) (*ContentType, error)
- func (service *ContentTypesService) GetWithEnv(env *Environment, contentTypeID string) (*ContentType, error)
- func (service *ContentTypesService) List(spaceID string) *Collection
- func (service *ContentTypesService) ListActivated(spaceID string) *Collection
- func (service *ContentTypesService) Upsert(spaceID string, ct *ContentType) error
- func (service *ContentTypesService) UpsertWithEnv(env *Environment, ct *ContentType) error
- type Controls
- type DateMinMax
- type DateRange
- type DetailItem
- type EditorInterface
- type EditorInterfacesService
- type Entity
- type EntriesService
- func (service *EntriesService) Archive(spaceID string, entry *Entry) error
- func (service *EntriesService) Delete(spaceID string, entryID string) error
- func (service *EntriesService) Get(spaceID, entryID string) (*Entry, error)
- func (service *EntriesService) List(spaceID string) *Collection
- func (service *EntriesService) Publish(spaceID string, entry *Entry) error
- func (service *EntriesService) Unarchive(spaceID string, entry *Entry) error
- func (service *EntriesService) Unpublish(spaceID string, entry *Entry) error
- func (service *EntriesService) Upsert(spaceID, contentTypeID string, e *Entry) error
- type Entry
- type EntrySnapshot
- type EntrySnapshotDetail
- type EntryTask
- type EntryTasksService
- func (service *EntryTasksService) Delete(spaceID, entryID, entryTaskID string) error
- func (service *EntryTasksService) Get(spaceID, entryID, entryTaskID string) (*EntryTask, error)
- func (service *EntryTasksService) List(spaceID, entryID string) *Collection
- func (service *EntryTasksService) Upsert(spaceID, entryID string, entryTask *EntryTask) error
- type Environment
- type EnvironmentAlias
- type EnvironmentAliasesService
- type EnvironmentLink
- type Environments
- type EnvironmentsService
- func (service *EnvironmentsService) Delete(spaceID string, e *Environment) error
- func (service *EnvironmentsService) Get(spaceID, environmentID string) (*Environment, error)
- func (service *EnvironmentsService) List(spaceID string) *Collection
- func (service *EnvironmentsService) Upsert(spaceID string, e *Environment) error
- type ErrorDetail
- type ErrorDetails
- type ErrorResponse
- type Extension
- type ExtensionDetails
- type ExtensionsService
- func (service *ExtensionsService) Delete(spaceID string, extensionID string) error
- func (service *ExtensionsService) Get(spaceID, extensionID string) (*Extension, error)
- func (service *ExtensionsService) List(spaceID string) *Collection
- func (service *ExtensionsService) Upsert(spaceID string, e *Extension) error
- type Field
- type FieldTypeArrayItem
- type FieldTypes
- type FieldValidation
- type FieldValidationDate
- type FieldValidationDimension
- type FieldValidationFileSize
- type FieldValidationLink
- type FieldValidationMimeType
- type FieldValidationPredefinedValues
- type FieldValidationRange
- type FieldValidationRegex
- type FieldValidationSize
- type FieldValidationUnique
- type File
- type FileDetails
- type HealthDetails
- type ImageFields
- type InvalidQueryError
- type Locale
- type LocalesService
- type Locations
- type Member
- type Membership
- type MembershipsService
- func (service *MembershipsService) Delete(spaceID string, membershipID string) error
- func (service *MembershipsService) Get(spaceID, membershipID string) (*Membership, error)
- func (service *MembershipsService) List(spaceID string) *Collection
- func (service *MembershipsService) Upsert(spaceID string, m *Membership) error
- type MinMax
- type NotFoundError
- type Organization
- type OrganizationsService
- type Permissions
- type Policies
- type PreviewAPIKey
- type Query
- func (q *Query) All(field string, value []string) *Query
- func (q *Query) ContentType(ct string) *Query
- func (q *Query) Equal(field string, value interface{}) *Query
- func (q *Query) Exists(field string) *Query
- func (q *Query) GreaterThan(field string, value interface{}) *Query
- func (q *Query) GreaterThanOrEqual(field string, value interface{}) *Query
- func (q *Query) In(field string, value []string) *Query
- func (q *Query) Include(include uint16) *Query
- func (q *Query) LessThan(field string, value interface{}) *Query
- func (q *Query) LessThanOrEqual(field string, value interface{}) *Query
- func (q *Query) Limit(limit uint16) *Query
- func (q *Query) Locale(locale string) *Query
- func (q *Query) Match(field, match string) *Query
- func (q *Query) MimeType(mime string) *Query
- func (q *Query) Near(field string, lat, lon int16) *Query
- func (q *Query) NotEqual(field string, value interface{}) *Query
- func (q *Query) NotExists(field string) *Query
- func (q *Query) NotIn(field string, value []string) *Query
- func (q *Query) Order(field string, reverse bool) *Query
- func (q *Query) Query(qStr string) *Query
- func (q *Query) Select(fields []string) *Query
- func (q *Query) Skip(skip uint16) *Query
- func (q *Query) String() string
- func (q *Query) Values() url.Values
- func (q *Query) Within(field string, lat1, lon1, lat2, lon2 int16) *Query
- func (q *Query) WithinRadius(field string, lat1, lon1, radius int16) *Query
- type RateLimitExceededError
- type Regex
- type Request
- type Resource
- type ResourcesService
- type Response
- type Role
- type Roles
- type RolesService
- type ScheduledAction
- type ScheduledActionsService
- type ServerError
- type Sidebar
- type SnapshotsService
- func (service *SnapshotsService) GetContentTypeSnapshots(spaceID, contentTypeID, snapshotID string) (*ContentTypeSnapshot, error)
- func (service *SnapshotsService) GetEntrySnapshot(spaceID, entryID, snapshotID string) (*EntrySnapshot, error)
- func (service *SnapshotsService) ListContentTypeSnapshots(spaceID, contentTypeID string) *Collection
- func (service *SnapshotsService) ListEntrySnapshots(spaceID, entryID string) *Collection
- type Space
- type SpacesService
- type Sys
- type UploadFrom
- type Usage
- type UsagesService
- type User
- type UsersService
- type ValidationFailedError
- type VersionMismatchError
- type Webhook
- type WebhookCall
- type WebhookCallsService
- type WebhookHeader
- type WebhookHealth
- type WebhooksService
- func (service *WebhooksService) Delete(spaceID string, webhook *Webhook) error
- func (service *WebhooksService) Get(spaceID, webhookID string) (*Webhook, error)
- func (service *WebhooksService) List(spaceID string) *Collection
- func (service *WebhooksService) Upsert(spaceID string, webhook *Webhook) error
Examples ¶
- ContentTypesService.Activate
- ContentTypesService.Activate (With_environment)
- ContentTypesService.Deactivate
- ContentTypesService.Deactivate (With_environment)
- ContentTypesService.Delete
- ContentTypesService.Delete (All_drafts)
- ContentTypesService.Delete (With_environment)
- ContentTypesService.Get
- ContentTypesService.List
- ContentTypesService.Upsert (Create)
- ContentTypesService.Upsert (Create_with_environment)
- ContentTypesService.Upsert (Update)
- ContentTypesService.Upsert (Update_with_environment)
- SpacesService.Delete
- SpacesService.Delete (All)
- SpacesService.Get
- SpacesService.List
- SpacesService.Upsert (Create)
- SpacesService.Upsert (Update)
Constants ¶
const ( // FieldTypeText content type field type for text data FieldTypeText = "Text" // FieldTypeSymbol content type field type for text data FieldTypeSymbol = "Symbol" // FieldTypeArray content type field type for array data FieldTypeArray = "Array" // FieldTypeLink content type field type for link data FieldTypeLink = "Link" // FieldTypeInteger content type field type for integer data FieldTypeInteger = "Integer" // FieldTypeLocation content type field type for location data FieldTypeLocation = "Location" // FieldTypeBoolean content type field type for boolean data FieldTypeBoolean = "Boolean" // FieldTypeDate content type field type for date data FieldTypeDate = "Date" // FieldTypeObject content type field type for object data FieldTypeObject = "Object" )
noinspection GoUnusedConst
const ( // MimeTypeAttachment mime type validation for content type field MimeTypeAttachment = "attachment" // MimeTypePlainText mime type validation for content type field MimeTypePlainText = "plaintext" // MimeTypeImage mime type validation for content type field MimeTypeImage = "image" // MimeTypeAudio mime type validation for content type field MimeTypeAudio = "audio" // MimeTypeVideo mime type validation for content type field MimeTypeVideo = "video" // MimeTypeRichText mime type validation for content type field MimeTypeRichText = "richtext" // MimeTypePresentation mime type validation for content type field MimeTypePresentation = "presentation" // MimeTypeSpreadSheet mime type validation for content type field MimeTypeSpreadSheet = "spreadsheet" // MimeTypePDF mime type validation for content type field MimeTypePDF = "pdfdocument" // MimeTypeArchive mime type validation for content type field MimeTypeArchive = "archive" // MimeTypeCode mime type validation for content type field MimeTypeCode = "code" // MimeTypeMarkup mime type validation for content type field MimeTypeMarkup = "markup" )
const ( // FieldValidationRegexPatternEmail email validation FieldValidationRegexPatternEmail = `^\w[\w.-]*@([\w-]+\.)+[\w-]+$` // FieldValidationRegexPatternURL url validation FieldValidationRegexPatternURL = `^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$` // FieldValidationRegexPatternUSDate us date validation FieldValidationRegexPatternUSDate = `^(0?[1-9]|[12][0-9]|3[01])[- \/.](0?[1-9]|1[012])[- \/.](19|20)?\d\d$` // FieldValidationRegexPatternEuorpeanDate euorpean date validation FieldValidationRegexPatternEuorpeanDate = `^(0?[1-9]|[12][0-9]|3[01])[- \/.](0?[1-9]|1[012])[- \/.](19|20)?\d\d$` // FieldValidationRegexPattern12HourTime 12-hour time validation FieldValidationRegexPattern12HourTime = `^(0?[1-9]|1[012]):[0-5][0-9](:[0-5][0-9])?\s*[aApP][mM]$` // FieldValidationRegexPattern24HourTime 24-hour time validation FieldValidationRegexPattern24HourTime = `^(0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$` // FieldValidationRegexPatternUSPhoneNumber us phone number validation FieldValidationRegexPatternUSPhoneNumber = `^\d[ -.]?\(?\d\d\d\)?[ -.]?\d\d\d[ -.]?\d\d\d\d$` // FieldValidationRegexPatternUSZipCode us zip code validation FieldValidationRegexPatternUSZipCode = `^\d{5}$|^\d{5}-\d{4}$}` )
noinspection GoUnusedConst
Variables ¶
var Version = "0.5.2"
Version for SDK Version
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct { Sys *Sys `json:"sys,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` AccessToken string `json:"accessToken,omitempty"` Policies []*APIKeyPolicy `json:"policies,omitempty"` PreviewAPIKey PreviewAPIKey `json:"preview_api_key,omitempty"` Environments []Environments `json:"environments,omitempty"` }
APIKey model
func (*APIKey) GetVersion ¶
GetVersion returns entity version
func (*APIKey) MarshalJSON ¶
MarshalJSON for custom json marshaling
type APIKeyPolicy ¶
type APIKeyPolicy struct { Effect string `json:"effect,omitempty"` Actions string `json:"actions,omitempty"` }
APIKeyPolicy model
type APIKeyService ¶
type APIKeyService service
APIKeyService service
func (*APIKeyService) Delete ¶
func (service *APIKeyService) Delete(spaceID string, apiKey *APIKey) error
Delete deletes a sinlge api key entity
func (*APIKeyService) Get ¶
func (service *APIKeyService) Get(spaceID, apiKeyID string) (*APIKey, error)
Get returns a single api key entity
func (*APIKeyService) List ¶
func (service *APIKeyService) List(spaceID string) *Collection
List returns all api keys collection
type AccessDeniedError ¶
type AccessDeniedError struct{}
AccessDeniedError error model for access denied responses
type AccessToken ¶
type AccessToken struct { Sys *Sys `json:"sys,omitempty"` Name string `json:"name,omitempty"` RevokedAt string `json:"revokedAt,omitempty"` Scopes []string `json:"scopes,omitempty"` }
AccessToken model
func (*AccessToken) GetVersion ¶
func (accessToken *AccessToken) GetVersion() int
GetVersion returns entity version
type AccessTokenInvalidError ¶
type AccessTokenInvalidError struct {
APIError
}
AccessTokenInvalidError for 401 errors
func (AccessTokenInvalidError) Error ¶
func (e AccessTokenInvalidError) Error() string
type AccessTokensService ¶
type AccessTokensService service
AccessTokensService service
func (*AccessTokensService) Create ¶
func (service *AccessTokensService) Create(accessToken *AccessToken) error
Create creates a new access token
func (*AccessTokensService) Get ¶
func (service *AccessTokensService) Get(accessTokenID string) (*AccessToken, error)
Get returns a single access token
func (*AccessTokensService) List ¶
func (service *AccessTokensService) List() *Collection
List returns an access tokens collection
func (*AccessTokensService) Revoke ¶
func (service *AccessTokensService) Revoke(accessToken *AccessToken) error
Revoke revokes a personal access token
type AppDefinition ¶
type AppDefinition struct { Sys *Sys `json:"sys"` Name string `json:"name"` SRC string `json:"src"` Locations []Locations `json:"locations"` }
AppDefinition model
func (*AppDefinition) GetVersion ¶
func (appDefinition *AppDefinition) GetVersion() int
GetVersion returns entity version
type AppDefinitionsService ¶
type AppDefinitionsService service
AppDefinitionsService service
func (*AppDefinitionsService) Delete ¶
func (service *AppDefinitionsService) Delete(organizationID, appDefinitionID string) error
Delete the app definition
func (*AppDefinitionsService) Get ¶
func (service *AppDefinitionsService) Get(organizationID, appDefinitionID string) (*AppDefinition, error)
Get returns a single app definition
func (*AppDefinitionsService) List ¶
func (service *AppDefinitionsService) List(organizationID string) *Collection
List returns an app definitions collection
func (*AppDefinitionsService) Upsert ¶
func (service *AppDefinitionsService) Upsert(organizationID string, definition *AppDefinition) error
Upsert updates or creates a new app definition
type AppInstallation ¶
type AppInstallation struct { Sys *Sys `json:"sys"` Parameters map[string]string `json:"parameters"` }
AppInstallation model
func (*AppInstallation) GetVersion ¶
func (appInstallation *AppInstallation) GetVersion() int
GetVersion returns entity version
type AppInstallationsService ¶
type AppInstallationsService service
AppInstallationsService service
func (*AppInstallationsService) Delete ¶
func (service *AppInstallationsService) Delete(spaceID, appInstallationID string) error
Delete the app installation
func (*AppInstallationsService) Get ¶
func (service *AppInstallationsService) Get(spaceID, appInstallationID string) (*AppInstallation, error)
Get returns a single app installation
func (*AppInstallationsService) List ¶
func (service *AppInstallationsService) List(spaceID string) *Collection
List returns an app installations collection
func (*AppInstallationsService) Upsert ¶
func (service *AppInstallationsService) Upsert(spaceID, appInstallationID string, installation *AppInstallation) error
Upsert updates or creates a new app installation
type Asset ¶
type Asset struct { Locale string Sys *Sys `json:"sys,omitempty"` Fields *AssetFields `json:"fields,omitempty"` }
Asset represents a Contentful asset
type AssetFields ¶
type AssetFields struct { Title map[string]string `json:"title,omitempty"` Description map[string]string `json:"description,omitempty"` File map[string]*File `json:"file,omitempty"` }
AssetFields model
type AssetsService ¶
type AssetsService service
AssetsService service
func (*AssetsService) Archive ¶
func (service *AssetsService) Archive(spaceID string, asset *Asset) error
Archive archives the asset
func (*AssetsService) Delete ¶
func (service *AssetsService) Delete(spaceID string, asset *Asset) error
Delete sends delete request
func (*AssetsService) Get ¶
func (service *AssetsService) Get(spaceID, assetID string) (*Asset, error)
Get returns a single asset entity
func (*AssetsService) List ¶
func (service *AssetsService) List(spaceID string) *Collection
List returns asset collection
func (*AssetsService) ListPublished ¶
func (service *AssetsService) ListPublished(spaceID string) *Collection
ListPublished return a content type collection, with only activated content types
func (*AssetsService) Process ¶
func (service *AssetsService) Process(spaceID string, asset *Asset) error
Process the asset
func (*AssetsService) Publish ¶
func (service *AssetsService) Publish(spaceID string, asset *Asset) error
Publish published the asset
func (*AssetsService) Unarchive ¶
func (service *AssetsService) Unarchive(spaceID string, asset *Asset) error
Unarchive unarchives the asset
type BadRequestError ¶
type BadRequestError struct{}
BadRequestError error model for bad request responses
type Client ¶
type Client struct { Debug bool QueryParams map[string]string Headers map[string]string BaseURL string Environment string Spaces *SpacesService Users *UsersService Environments *EnvironmentsService EnvironmentAliases *EnvironmentAliasesService Organizations *OrganizationsService Roles *RolesService Memberships *MembershipsService Snapshots *SnapshotsService APIKeys *APIKeyService AccessTokens *AccessTokensService Assets *AssetsService ContentTypes *ContentTypesService Entries *EntriesService EntryTasks *EntryTasksService ScheduledActions *ScheduledActionsService Locales *LocalesService Webhooks *WebhooksService WebhookCalls *WebhookCallsService EditorInterfaces *EditorInterfacesService Extensions *ExtensionsService AppDefinitions *AppDefinitionsService AppInstallations *AppInstallationsService Usages *UsagesService Resources *ResourcesService // contains filtered or unexported fields }
Client model
func NewResourceClient ¶
NewResourceClient returns a client for the resource/uploads endpoints
func (*Client) SetEnvironment ¶
SetEnvironment sets the given environment. https://www.contentful.com/developers/docs/references/content-management-api/#/reference/environments
func (*Client) SetHTTPClient ¶
SetHTTPClient sets the underlying http.Client used to make requests.
func (*Client) SetOrganization ¶
SetOrganization sets the given organization id
type Collection ¶
type Collection struct { Query Sys *Sys `json:"sys"` Total int `json:"total"` Skip int `json:"skip"` Limit int `json:"limit"` Items []interface{} `json:"items"` Includes interface{} `json:"includes"` // contains filtered or unexported fields }
Collection model
func NewCollection ¶
func NewCollection(options *CollectionOptions) *Collection
NewCollection initializes a new collection
func (*Collection) ToAPIKey ¶
func (col *Collection) ToAPIKey() []*APIKey
ToAPIKey cast Items to APIKey model
func (*Collection) ToAccessToken ¶
func (col *Collection) ToAccessToken() []*AccessToken
ToAccessToken cast Items to AccessToken model
func (*Collection) ToAppDefinition ¶
func (col *Collection) ToAppDefinition() []*AppDefinition
ToAppDefinition cast Items to AppDefinition model
func (*Collection) ToAppInstallation ¶
func (col *Collection) ToAppInstallation() []*AppInstallation
ToAppInstallation cast Items to AppInstallation model
func (*Collection) ToAsset ¶
func (col *Collection) ToAsset() []*Asset
ToAsset cast Items to Asset model
func (*Collection) ToContentType ¶
func (col *Collection) ToContentType() []*ContentType
ToContentType cast Items to ContentType model
func (*Collection) ToContentTypeSnapshot ¶
func (col *Collection) ToContentTypeSnapshot() []*ContentTypeSnapshot
ToContentTypeSnapshot cast Items to Snapshot model for content types
func (*Collection) ToEditorInterface ¶
func (col *Collection) ToEditorInterface() []*EditorInterface
ToEditorInterface cast Items to EditorInterface model
func (*Collection) ToEntry ¶
func (col *Collection) ToEntry() []*Entry
ToEntry cast Items to Entry model
func (*Collection) ToEntrySnapshot ¶
func (col *Collection) ToEntrySnapshot() []*EntrySnapshot
ToEntrySnapshot cast Items to Snapshot model for entries
func (*Collection) ToEntryTask ¶
func (col *Collection) ToEntryTask() []*EntryTask
ToEntryTask cast Items to EntryTask model
func (*Collection) ToEnvironment ¶
func (col *Collection) ToEnvironment() []*Environment
ToEnvironment cast Items to Environment model
func (*Collection) ToEnvironmentAlias ¶
func (col *Collection) ToEnvironmentAlias() []*EnvironmentAlias
ToEnvironmentAlias cast Items to EnvironmentAlias model
func (*Collection) ToExtension ¶
func (col *Collection) ToExtension() []*Extension
ToExtension cast Items to Extension model
func (*Collection) ToLocale ¶
func (col *Collection) ToLocale() []*Locale
ToLocale cast Items to Locale model
func (*Collection) ToMembership ¶
func (col *Collection) ToMembership() []*Membership
ToMembership cast Items to Membership model
func (*Collection) ToOrganization ¶
func (col *Collection) ToOrganization() []*Organization
ToOrganization cast Items to Organization model
func (*Collection) ToScheduledAction ¶
func (col *Collection) ToScheduledAction() []*ScheduledAction
ToScheduledAction cast Items to ScheduledAction model
func (*Collection) ToSpace ¶
func (col *Collection) ToSpace() []*Space
ToSpace cast Items to Space model
func (*Collection) ToUsage ¶
func (col *Collection) ToUsage() []*Usage
ToUsage cast Items to Usage model
func (*Collection) ToWebhook ¶
func (col *Collection) ToWebhook() []*Webhook
ToWebhook cast Items to Webhook model
func (*Collection) ToWebhookCall ¶
func (col *Collection) ToWebhookCall() []*WebhookCall
ToWebhookCall cast Items to WebhookCall model
type CollectionOptions ¶
type CollectionOptions struct {
Limit uint16
}
CollectionOptions holds init options
type ConstraintDetail ¶
type ConstraintDetail struct {
Equals DetailItem `json:"equals"`
}
ConstraintDetail model
type ContentType ¶
type ContentType struct { Sys *Sys `json:"sys"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Fields []*Field `json:"fields,omitempty"` DisplayField string `json:"displayField,omitempty"` }
ContentType model
func (*ContentType) GetVersion ¶
func (ct *ContentType) GetVersion() int
GetVersion returns entity version
type ContentTypeFields ¶
type ContentTypeFields struct { ID string `json:"id"` Name string `json:"name"` Required bool `json:"required"` Localized bool `json:"localized"` Type string `json:"type"` }
ContentTypeFields model
type ContentTypeSnapshot ¶
type ContentTypeSnapshot struct { Sys *Sys `json:"sys"` ContentTypeSnapshotDetail ContentTypeSnapshotDetail `json:"snapshot"` }
ContentTypeSnapshot model
type ContentTypeSnapshotDetail ¶
type ContentTypeSnapshotDetail struct { Name string `json:"name"` Fields []ContentTypeFields `json:"fields"` Sys *Sys `json:"sys"` }
ContentTypeSnapshotDetail model
type ContentTypesService ¶
type ContentTypesService service
ContentTypesService service
func (*ContentTypesService) Activate ¶
func (service *ContentTypesService) Activate(spaceID string, ct *ContentType) error
Activate a contenttype, a.k.a publish
Example ¶
cma := NewCMA("cma-token") contentType, err := cma.ContentTypes.Get("space-id", "content-type-id") if err != nil { log.Fatal(err) } err = cma.ContentTypes.Activate("space-id", contentType) if err != nil { log.Fatal(err) }
Output:
Example (With_environment) ¶
cma := NewCMA("cma-token") env, _ := environmentFromTestData("environment_1.json") contentType, err := cma.ContentTypes.Get("space-id", "content-type-id") if err != nil { log.Fatal(err) } err = cma.ContentTypes.ActivateWithEnv(env, contentType) if err != nil { log.Fatal(err) }
Output:
func (*ContentTypesService) ActivateWithEnv ¶ added in v0.5.2
func (service *ContentTypesService) ActivateWithEnv(env *Environment, ct *ContentType) error
Activate a contenttype in a specific environment, a.k.a publish
func (*ContentTypesService) Deactivate ¶
func (service *ContentTypesService) Deactivate(spaceID string, ct *ContentType) error
Deactivate a contenttype, a.k.a unpublish
Example ¶
cma := NewCMA("cma-token") contentType, err := cma.ContentTypes.Get("space-id", "content-type-id") if err != nil { log.Fatal(err) } err = cma.ContentTypes.Deactivate("space-id", contentType) if err != nil { log.Fatal(err) }
Output:
Example (With_environment) ¶
cma := NewCMA("cma-token") env, _ := environmentFromTestData("environment_1.json") contentType, err := cma.ContentTypes.Get("space-id", "content-type-id") if err != nil { log.Fatal(err) } err = cma.ContentTypes.DeactivateWithEnv(env, contentType) if err != nil { log.Fatal(err) }
Output:
func (*ContentTypesService) DeactivateWithEnv ¶ added in v0.5.2
func (service *ContentTypesService) DeactivateWithEnv(env *Environment, ct *ContentType) error
Deactivate a contenttype in a specific environment, a.k.a unpublish
func (*ContentTypesService) Delete ¶
func (service *ContentTypesService) Delete(spaceID string, ct *ContentType) error
Delete the content_type
Example ¶
cma := NewCMA("cma-token") contentType, err := cma.ContentTypes.Get("space-id", "content-type-id") if err != nil { log.Fatal(err) } err = cma.ContentTypes.Delete("space-id", contentType) if err != nil { log.Fatal(err) }
Output:
Example (All_drafts) ¶
cma := NewCMA("cma-token") collection, err := cma.ContentTypes.List("space-id").Next() if err != nil { log.Fatal(err) } contentTypes := collection.ToContentType() for _, contentType := range contentTypes { if contentType.Sys.PublishedAt == "" { err := cma.ContentTypes.Delete("space-id", contentType) if err != nil { log.Fatal(err) } } }
Output:
Example (With_environment) ¶
cma := NewCMA("cma-token") env, _ := environmentFromTestData("environment_1.json") contentType, err := cma.ContentTypes.GetWithEnv(env, "content-type-id") if err != nil { log.Fatal(err) } err = cma.ContentTypes.DeleteWithEnv(env, contentType) if err != nil { log.Fatal(err) }
Output:
func (*ContentTypesService) DeleteWithEnv ¶ added in v0.5.2
func (service *ContentTypesService) DeleteWithEnv(env *Environment, ct *ContentType) error
DeleteFromEnv a content type from an environment
func (*ContentTypesService) Get ¶
func (service *ContentTypesService) Get(spaceID, contentTypeID string) (*ContentType, error)
Get fetched a content type specified by `contentTypeID`
Example ¶
cma := NewCMA("cma-token") contentType, err := cma.ContentTypes.Get("space-id", "content-type-id") if err != nil { log.Fatal(err) } fmt.Println(contentType.Name)
Output:
func (*ContentTypesService) GetWithEnv ¶ added in v0.5.2
func (service *ContentTypesService) GetWithEnv(env *Environment, contentTypeID string) (*ContentType, error)
GetFromEnv a content type by `contentTypeID` from an environment
func (*ContentTypesService) List ¶
func (service *ContentTypesService) List(spaceID string) *Collection
List return a content type collection
Example ¶
cma := NewCMA("cma-token") collection, err := cma.ContentTypes.List("space-id").Next() if err != nil { log.Fatal(err) } contentTypes := collection.ToContentType() for _, contentType := range contentTypes { fmt.Println(contentType.Sys.ID, contentType.Sys.PublishedAt) }
Output:
func (*ContentTypesService) ListActivated ¶
func (service *ContentTypesService) ListActivated(spaceID string) *Collection
ListActivated return a content type collection, with only activated content types
func (*ContentTypesService) Upsert ¶
func (service *ContentTypesService) Upsert(spaceID string, ct *ContentType) error
Upsert updates or creates a new content type
Example (Create) ¶
cma := NewCMA("cma-token") ct, _ := contentTypeFromTestData("content_type.json") err := cma.ContentTypes.Upsert("space-id", ct) if err != nil { log.Fatal(err) }
Output:
Example (Create_with_environment) ¶
cma := NewCMA("cma-token") env, _ := environmentFromTestData("environment_1.json") ct, _ := contentTypeFromTestData("content_type.json") err := cma.ContentTypes.UpsertWithEnv(env, ct) if err != nil { log.Fatal(err) }
Output:
Example (Update) ¶
cma := NewCMA("cma-token") contentType, err := cma.ContentTypes.Get("space-id", "content-type-id") if err != nil { log.Fatal(err) } contentType.Name = "modified content type name" err = cma.ContentTypes.Upsert("space-id", contentType) if err != nil { log.Fatal(err) }
Output:
Example (Update_with_environment) ¶
cma := NewCMA("cma-token") env, _ := environmentFromTestData("environment_1.json") contentType, err := cma.ContentTypes.Get("space-id", "content-type-id") if err != nil { log.Fatal(err) } contentType.Name = "modified content type name" err = cma.ContentTypes.UpsertWithEnv(env, contentType) if err != nil { log.Fatal(err) }
Output:
func (*ContentTypesService) UpsertWithEnv ¶ added in v0.5.2
func (service *ContentTypesService) UpsertWithEnv(env *Environment, ct *ContentType) error
UpsertEnv a content type for an environment
type Controls ¶
type Controls struct { FieldID string `json:"fieldId"` WidgetNameSpace string `json:"widgetNamespace"` WidgetID string `json:"widgetId"` Settings map[string]string `json:"settings,omitempty"` }
Controls model
type DateMinMax ¶
type DateMinMax struct { Min time.Time `json:"min,omitempty"` Max time.Time `json:"max,omitempty"` }
DateMinMax model
type DetailItem ¶
DetailItem model
type EditorInterface ¶
type EditorInterface struct { Sys *Sys `json:"sys"` Controls []Controls `json:"controls"` SideBar []Sidebar `json:"sidebar"` }
EditorInterface model
type EditorInterfacesService ¶
type EditorInterfacesService service
EditorInterfacesService service
func (*EditorInterfacesService) Get ¶
func (service *EditorInterfacesService) Get(spaceID, contentTypeID string) (*EditorInterface, error)
Get returns a single EditorInterface
func (*EditorInterfacesService) List ¶
func (service *EditorInterfacesService) List(spaceID string) *Collection
List returns an EditorInterface collection
func (*EditorInterfacesService) Update ¶
func (service *EditorInterfacesService) Update(spaceID, contentTypeID string, e *EditorInterface) error
Update updates an editor interface
type EntriesService ¶
type EntriesService service
EntriesService service
func (*EntriesService) Archive ¶
func (service *EntriesService) Archive(spaceID string, entry *Entry) error
Archive the entry
func (*EntriesService) Delete ¶
func (service *EntriesService) Delete(spaceID string, entryID string) error
Delete the entry
func (*EntriesService) Get ¶
func (service *EntriesService) Get(spaceID, entryID string) (*Entry, error)
Get returns a single entry
func (*EntriesService) List ¶
func (service *EntriesService) List(spaceID string) *Collection
List returns entries collection
func (*EntriesService) Publish ¶
func (service *EntriesService) Publish(spaceID string, entry *Entry) error
Publish the entry
func (*EntriesService) Unarchive ¶
func (service *EntriesService) Unarchive(spaceID string, entry *Entry) error
Unarchive the entry
type Entry ¶
type Entry struct { Locale string `json:"locale"` Sys *Sys `json:"sys"` Fields map[string]interface{} `json:"fields"` }
Entry model
type EntrySnapshot ¶
type EntrySnapshot struct { Sys *Sys `json:"sys"` EntrySnapshotDetail EntrySnapshotDetail `json:"snapshot"` }
EntrySnapshot model
type EntrySnapshotDetail ¶
type EntrySnapshotDetail struct { Fields map[string]interface{} `json:"fields"` Sys *Sys `json:"sys"` }
EntrySnapshotDetail model
type EntryTask ¶
type EntryTask struct { Sys *Sys `json:"sys"` Body string `json:"body"` Status string `json:"status"` AssignedTo AssignedTo `json:"assignedTo"` }
EntryTask model
func (*EntryTask) GetVersion ¶
GetVersion returns entity version
type EntryTasksService ¶
type EntryTasksService service
EntryTasksService service
func (*EntryTasksService) Delete ¶
func (service *EntryTasksService) Delete(spaceID, entryID, entryTaskID string) error
Delete the entry task
func (*EntryTasksService) Get ¶
func (service *EntryTasksService) Get(spaceID, entryID, entryTaskID string) (*EntryTask, error)
Get returns a single entry task
func (*EntryTasksService) List ¶
func (service *EntryTasksService) List(spaceID, entryID string) *Collection
List returns entry tasks collection
type Environment ¶
Environment model
func (*Environment) GetVersion ¶
func (e *Environment) GetVersion() int
GetVersion returns entity version
type EnvironmentAlias ¶
type EnvironmentAlias struct { Sys *Sys `json:"sys"` Alias *AliasDetail `json:"environment"` }
EnvironmentAlias model
func (*EnvironmentAlias) GetVersion ¶
func (environmentAlias *EnvironmentAlias) GetVersion() int
GetVersion returns entity version
type EnvironmentAliasesService ¶
type EnvironmentAliasesService service
EnvironmentAliasesService service
func (*EnvironmentAliasesService) Get ¶
func (service *EnvironmentAliasesService) Get(spaceID, environmentAliasID string) (*EnvironmentAlias, error)
Get returns a single environment alias entity
func (*EnvironmentAliasesService) List ¶
func (service *EnvironmentAliasesService) List(spaceID string) *Collection
List returns an environment aliases collection
func (*EnvironmentAliasesService) Update ¶
func (service *EnvironmentAliasesService) Update(spaceID string, ea *EnvironmentAlias) error
Update updates an environment alias
type EnvironmentsService ¶
type EnvironmentsService service
EnvironmentsService service
func (*EnvironmentsService) Delete ¶
func (service *EnvironmentsService) Delete(spaceID string, e *Environment) error
Delete the environment
func (*EnvironmentsService) Get ¶
func (service *EnvironmentsService) Get(spaceID, environmentID string) (*Environment, error)
Get returns a single environment entity
func (*EnvironmentsService) List ¶
func (service *EnvironmentsService) List(spaceID string) *Collection
List returns an environments collection
func (*EnvironmentsService) Upsert ¶
func (service *EnvironmentsService) Upsert(spaceID string, e *Environment) error
Upsert updates or creates a new environment
type ErrorDetail ¶
type ErrorDetail struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Path interface{} `json:"path,omitempty"` Details string `json:"details,omitempty"` Value interface{} `json:"value,omitempty"` }
ErrorDetail model
type ErrorDetails ¶
type ErrorDetails struct {
Errors []*ErrorDetail `json:"errors,omitempty"`
}
ErrorDetails model
type ErrorResponse ¶
type ErrorResponse struct { Sys *Sys `json:"sys"` Message string `json:"message,omitempty"` RequestID string `json:"requestId,omitempty"` Details *ErrorDetails `json:"details,omitempty"` }
ErrorResponse model
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type Extension ¶
type Extension struct { Sys *Sys `json:"sys"` Extension ExtensionDetails `json:"extension"` }
Extension model
func (*Extension) GetVersion ¶
GetVersion returns entity version
type ExtensionDetails ¶
type ExtensionDetails struct { SRC string `json:"src"` Name string `json:"name"` FieldTypes []FieldTypes `json:"fieldTypes"` Sidebar bool `json:"sidebar"` }
ExtensionDetails model
type ExtensionsService ¶
type ExtensionsService service
ExtensionsService service
func (*ExtensionsService) Delete ¶
func (service *ExtensionsService) Delete(spaceID string, extensionID string) error
Delete the extension
func (*ExtensionsService) Get ¶
func (service *ExtensionsService) Get(spaceID, extensionID string) (*Extension, error)
Get returns a single extension
func (*ExtensionsService) List ¶
func (service *ExtensionsService) List(spaceID string) *Collection
List returns an extensions collection
type Field ¶
type Field struct { ID string `json:"id,omitempty"` Name string `json:"name"` Type string `json:"type"` LinkType string `json:"linkType,omitempty"` Items *FieldTypeArrayItem `json:"items,omitempty"` Required bool `json:"required,omitempty"` Localized bool `json:"localized,omitempty"` Disabled bool `json:"disabled,omitempty"` Omitted bool `json:"omitted,omitempty"` Validations []FieldValidation `json:"validations,omitempty"` }
Field model
func (*Field) UnmarshalJSON ¶
UnmarshalJSON for custom json unmarshaling
type FieldTypeArrayItem ¶
type FieldTypeArrayItem struct { Type string `json:"type,omitempty"` Validations []FieldValidation `json:"validations,omitempty"` LinkType string `json:"linkType,omitempty"` }
FieldTypeArrayItem model
func (*FieldTypeArrayItem) UnmarshalJSON ¶
func (item *FieldTypeArrayItem) UnmarshalJSON(data []byte) error
UnmarshalJSON for custom json unmarshaling
type FieldValidation ¶
type FieldValidation interface{}
FieldValidation interface
func ParseValidations ¶
func ParseValidations(data []interface{}) (validations []FieldValidation, err error)
ParseValidations converts json representation to go struct
type FieldValidationDate ¶
type FieldValidationDate struct { Range *DateMinMax `json:"dateRange,omitempty"` ErrorMessage string `json:"message,omitempty"` }
FieldValidationDate model
func (*FieldValidationDate) MarshalJSON ¶
func (v *FieldValidationDate) MarshalJSON() ([]byte, error)
MarshalJSON for custom json marshaling
func (*FieldValidationDate) UnmarshalJSON ¶
func (v *FieldValidationDate) UnmarshalJSON(data []byte) error
UnmarshalJSON for custom json unmarshaling
type FieldValidationDimension ¶
type FieldValidationDimension struct { Width *MinMax `json:"width,omitempty"` Height *MinMax `json:"height,omitempty"` ErrorMessage string `json:"message,omitempty"` }
FieldValidationDimension model
func (*FieldValidationDimension) MarshalJSON ¶
func (v *FieldValidationDimension) MarshalJSON() ([]byte, error)
MarshalJSON for custom json marshaling
func (*FieldValidationDimension) UnmarshalJSON ¶
func (v *FieldValidationDimension) UnmarshalJSON(data []byte) error
UnmarshalJSON for custom json unmarshaling
type FieldValidationFileSize ¶
type FieldValidationFileSize struct { Size *MinMax `json:"assetFileSize,omitempty"` ErrorMessage string `json:"message,omitempty"` }
FieldValidationFileSize model
type FieldValidationLink ¶
type FieldValidationLink struct {
LinkContentType []string `json:"linkContentType,omitempty"`
}
FieldValidationLink model
type FieldValidationMimeType ¶
type FieldValidationMimeType struct {
MimeTypes []string `json:"linkMimetypeGroup,omitempty"`
}
FieldValidationMimeType model
type FieldValidationPredefinedValues ¶
type FieldValidationPredefinedValues struct { In []interface{} `json:"in,omitempty"` ErrorMessage string `json:"message"` }
FieldValidationPredefinedValues model
type FieldValidationRange ¶
type FieldValidationRange struct { Range *MinMax `json:"range,omitempty"` ErrorMessage string `json:"message,omitempty"` }
FieldValidationRange model
type FieldValidationRegex ¶
type FieldValidationRegex struct { Regex *Regex `json:"regexp,omitempty"` ErrorMessage string `json:"message,omitempty"` }
FieldValidationRegex model
type FieldValidationSize ¶
type FieldValidationSize struct { Size *MinMax `json:"size,omitempty"` ErrorMessage string `json:"message,omitempty"` }
FieldValidationSize model
type FieldValidationUnique ¶
type FieldValidationUnique struct {
Unique bool `json:"unique"`
}
FieldValidationUnique model
type File ¶
type File struct { URL string `json:"url,omitempty"` UploadURL string `json:"upload,omitempty"` UploadFrom *UploadFrom `json:"uploadFrom,omitempty"` Details *FileDetails `json:"details,omitempty"` FileName string `json:"fileName,omitempty"` ContentType string `json:"contentType,omitempty"` }
File represents a Contentful File
type FileDetails ¶
type FileDetails struct { Size int `json:"size,omitempty"` Image *ImageFields `json:"image,omitempty"` }
FileDetails model
type HealthDetails ¶
HealthDetails model
type ImageFields ¶
ImageFields model
type InvalidQueryError ¶
type InvalidQueryError struct{}
InvalidQueryError error model for invalid query responses
type Locale ¶
type Locale struct { Sys *Sys `json:"sys,omitempty"` // Locale name Name string `json:"name,omitempty"` // Language code Code string `json:"code,omitempty"` // If no content is provided for the locale, the Delivery API will return content in a locale specified below: FallbackCode string `json:"fallbackCode,omitempty"` // Make the locale as default locale for your account Default bool `json:"default,omitempty"` // Entries with required fields can still be published if locale is empty. Optional bool `json:"optional,omitempty"` // Includes locale in the Delivery API response. CDA bool `json:"contentDeliveryApi"` // Displays locale to editors and enables it in Management API. CMA bool `json:"contentManagementApi"` }
Locale model
func (*Locale) GetVersion ¶
GetVersion returns entity version
type LocalesService ¶
type LocalesService service
LocalesService service
func (*LocalesService) Delete ¶
func (service *LocalesService) Delete(spaceID string, locale *Locale) error
Delete the locale
func (*LocalesService) Get ¶
func (service *LocalesService) Get(spaceID, localeID string) (*Locale, error)
Get returns a single locale entity
func (*LocalesService) List ¶
func (service *LocalesService) List(spaceID string) *Collection
List returns a locales collection
type Membership ¶
type Membership struct { Sys *Sys `json:"sys"` Admin bool `json:"admin"` Roles []Roles `json:"roles"` User Member `json:"user, omitempty"` Email string `json:"email, omitempty"` }
Membership model
func (*Membership) GetVersion ¶
func (membership *Membership) GetVersion() int
GetVersion returns entity version
type MembershipsService ¶
type MembershipsService service
MembershipsService service
func (*MembershipsService) Delete ¶
func (service *MembershipsService) Delete(spaceID string, membershipID string) error
Delete the role
func (*MembershipsService) Get ¶
func (service *MembershipsService) Get(spaceID, membershipID string) (*Membership, error)
Get returns a single membership
func (*MembershipsService) List ¶
func (service *MembershipsService) List(spaceID string) *Collection
List returns membership collection
func (*MembershipsService) Upsert ¶
func (service *MembershipsService) Upsert(spaceID string, m *Membership) error
Upsert updates or creates a new membership
type NotFoundError ¶
type NotFoundError struct {
APIError
}
NotFoundError for 404 errors
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type Organization ¶
Organization model
type OrganizationsService ¶
type OrganizationsService service
OrganizationsService service
func (*OrganizationsService) List ¶
func (service *OrganizationsService) List() *Collection
List returns an organizations collection
type Permissions ¶
type Permissions struct { ContentModel []string `json:"ContentModel"` Settings string `json:"Settings"` ContentDelivery string `json:"ContentDelivery"` Environments string `json:"Environments"` EnvironmentAliases string `json:"EnvironmentAliases"` }
Permissions model
type Policies ¶
type Policies struct { Effect string `json:"effect"` Actions []string `json:"actions"` Constraint Constraint `json:"constraint"` }
Policies model
type PreviewAPIKey ¶
type PreviewAPIKey struct {
Sys Sys `json:"sys,omitempty"`
}
PreviewAPIKey model
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query model
func (*Query) GreaterThan ¶
GreaterThan [gt] query
func (*Query) GreaterThanOrEqual ¶
GreaterThanOrEqual [lte] query
func (*Query) LessThanOrEqual ¶
LessThanOrEqual [lte] query
type RateLimitExceededError ¶
type RateLimitExceededError struct {
APIError
}
RateLimitExceededError for rate limit errors
func (RateLimitExceededError) Error ¶
func (e RateLimitExceededError) Error() string
type Regex ¶
type Regex struct { Pattern string `json:"pattern,omitempty"` Flags string `json:"flags,omitempty"` }
Regex model
type Request ¶
type Request struct { URL string `json:"url"` Method string `json:"method"` Headers map[string]string `json:"headers"` Body string `json:"body"` }
Request model
type ResourcesService ¶
type ResourcesService service
ResourcesService service
func (*ResourcesService) Create ¶
func (service *ResourcesService) Create(spaceID, filePath string) error
Create creates an upload resource
func (*ResourcesService) Delete ¶
func (service *ResourcesService) Delete(spaceID, resourceID string) error
Delete the resource
type Response ¶
type Response struct { URL string `json:"url"` Headers map[string]string `json:"headers"` Body string `json:"body"` StatusCode int `json:"statusCode"` }
Response model
type Role ¶
type Role struct { Sys *Sys `json:"sys"` Name string `json:"name"` Description string `json:"description"` Policies []Policies `json:"policies"` Permissions Permissions `json:"permissions"` }
Role model
type RolesService ¶
type RolesService service
RolesService service
func (*RolesService) Delete ¶
func (service *RolesService) Delete(spaceID string, roleID string) error
Delete the role
func (*RolesService) Get ¶
func (service *RolesService) Get(spaceID, roleID string) (*Role, error)
Get returns a single role
func (*RolesService) List ¶
func (service *RolesService) List(spaceID string) *Collection
List returns an environments collection
type ScheduledAction ¶
type ScheduledAction struct { Sys *Sys `json:"sys"` Entity Entity `json:"entity"` Environment EnvironmentLink `json:"environment"` ScheduledFor map[string]string `json:"scheduledFor"` Action string `json:"action"` }
ScheduledAction model
func (*ScheduledAction) GetVersion ¶
func (scheduledAction *ScheduledAction) GetVersion() int
GetVersion returns entity version
type ScheduledActionsService ¶
type ScheduledActionsService service
ScheduledActionsService service
func (*ScheduledActionsService) Create ¶
func (service *ScheduledActionsService) Create(spaceID, entryID string, scheduledAction *ScheduledAction) error
Create creates a new scheduled actions
func (*ScheduledActionsService) Delete ¶
func (service *ScheduledActionsService) Delete(spaceID, entryID, scheduledActionID string) error
Delete the scheduled action
func (*ScheduledActionsService) List ¶
func (service *ScheduledActionsService) List(spaceID, entryID string) *Collection
List returns scheduled actions collection
type Sidebar ¶
type Sidebar struct { WidgetNameSpace string `json:"widgetNamespace"` WidgetID string `json:"widgetId"` Settings map[string]string `json:"settings,omitempty"` Disabled bool `json:"disabled"` }
Sidebar model
type SnapshotsService ¶
type SnapshotsService service
SnapshotsService service
func (*SnapshotsService) GetContentTypeSnapshots ¶
func (service *SnapshotsService) GetContentTypeSnapshots(spaceID, contentTypeID, snapshotID string) (*ContentTypeSnapshot, error)
GetContentTypeSnapshots returns a single snapshot of an entry
func (*SnapshotsService) GetEntrySnapshot ¶
func (service *SnapshotsService) GetEntrySnapshot(spaceID, entryID, snapshotID string) (*EntrySnapshot, error)
GetEntrySnapshot returns a single snapshot of an entry
func (*SnapshotsService) ListContentTypeSnapshots ¶
func (service *SnapshotsService) ListContentTypeSnapshots(spaceID, contentTypeID string) *Collection
ListContentTypeSnapshots returns snapshot collection
func (*SnapshotsService) ListEntrySnapshots ¶
func (service *SnapshotsService) ListEntrySnapshots(spaceID, entryID string) *Collection
ListEntrySnapshots returns snapshot collection
type Space ¶
type Space struct { Sys *Sys `json:"sys,omitempty"` Name string `json:"name,omitempty"` DefaultLocale string `json:"defaultLocale,omitempty"` }
Space model
func (*Space) MarshalJSON ¶
MarshalJSON for custom json marshaling
type SpacesService ¶
type SpacesService service
SpacesService model
func (*SpacesService) Delete ¶
func (service *SpacesService) Delete(space *Space) error
Delete the given space
Example ¶
cma := NewCMA("cma-token") space, err := cma.Spaces.Get("space-id") if err != nil { log.Fatal(err) } err = cma.Spaces.Delete(space) if err != nil { log.Fatal(err) }
Output:
Example (All) ¶
cma := NewCMA("cma-token") collection, err := cma.Spaces.List().Next() if err != nil { log.Fatal(err) } for _, space := range collection.ToSpace() { err := cma.Spaces.Delete(space) if err != nil { log.Fatal(err) } }
Output:
func (*SpacesService) Get ¶
func (service *SpacesService) Get(spaceID string) (*Space, error)
Get returns a single space entity
Example ¶
cma := NewCMA("cma-token") space, err := cma.Spaces.Get("space-id") if err != nil { log.Fatal(err) } fmt.Println(space.Name)
Output:
func (*SpacesService) List ¶
func (service *SpacesService) List() *Collection
List creates a spaces collection
Example ¶
cma := NewCMA("cma-token") collection, err := cma.Spaces.List().Next() if err != nil { log.Fatal(err) } spaces := collection.ToSpace() for _, space := range spaces { fmt.Println(space.Sys.ID, space.Name) }
Output:
func (*SpacesService) Upsert ¶
func (service *SpacesService) Upsert(space *Space) error
Upsert updates or creates a new space
Example (Create) ¶
cma := NewCMA("cma-token") space := &Space{ Name: "space-name", DefaultLocale: "en-US", } err := cma.Spaces.Upsert(space) if err != nil { log.Fatal(err) }
Output:
Example (Update) ¶
cma := NewCMA("cma-token") space, err := cma.Spaces.Get("space-id") if err != nil { log.Fatal(err) } space.Name = "modified" err = cma.Spaces.Upsert(space) if err != nil { log.Fatal(err) }
Output:
type Sys ¶
type Sys struct { ID string `json:"id,omitempty"` Type string `json:"type,omitempty"` LinkType string `json:"linkType,omitempty"` CreatedAt string `json:"createdAt,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"` UpdatedBy *Sys `json:"updatedBy,omitempty"` Version int `json:"version,omitempty"` Revision int `json:"revision,omitempty"` ContentType *ContentType `json:"contentType,omitempty"` Space *Space `json:"space,omitempty"` FirstPublishedAt string `json:"firstPublishedAt,omitempty"` PublishedCounter int `json:"publishedCounter,omitempty"` PublishedAt string `json:"publishedAt,omitempty"` PublishedBy *Sys `json:"publishedBy,omitempty"` PublishedVersion int `json:"publishedVersion,omitempty"` ArchivedAt string `json:"archivedAt,omitempty"` ArchivedBy *Sys `json:"archivedBy,omitempty"` ArchivedVersion int `json:"archivedVersion,omitempty"` }
Sys model
type Usage ¶
type Usage struct { Sys *Sys `json:"sys"` UnitOfMeasure string `json:"unitOfMeasure"` Metric string `json:"metric"` DateRange DateRange `json:"dateRange"` TotalUsage int `json:"usage"` UsagePerDay map[string]string `json:"usagePerDay"` }
Usage model
type UsagesService ¶
type UsagesService service
UsagesService service
func (*UsagesService) GetOrganizationUsage ¶
func (service *UsagesService) GetOrganizationUsage(organizationID, orderBy, metric, startAt, endAt string) *Collection
GetOrganizationUsage returns the usage of the specified organization
func (*UsagesService) GetSpaceUsage ¶
func (service *UsagesService) GetSpaceUsage(organizationID, orderBy, metric, startAt, endAt string) *Collection
GetSpaceUsage returns the organization usage by space
type User ¶
type User struct { Sys *Sys `json:"sys,omitempty"` FirstName string `json:"firstName"` LastName string `json:"lastName"` AvatarURL string `json:"avatarUrl"` Email string `json:"email"` Activated bool `json:"activated"` SignInCount int `json:"signInCount"` Confirmed bool `json:"confirmed"` TwoFactorAuthenticationEnabled bool `json:"2faEnabled"` }
User model
type UsersService ¶
type UsersService service
UsersService service
func (*UsersService) Me ¶
func (service *UsersService) Me() (*User, error)
Me returns current authenticated user
type ValidationFailedError ¶
type ValidationFailedError struct {
APIError
}
ValidationFailedError model
func (ValidationFailedError) Error ¶
func (e ValidationFailedError) Error() string
type VersionMismatchError ¶
type VersionMismatchError struct {
APIError
}
VersionMismatchError for 409 errors
func (VersionMismatchError) Error ¶
func (e VersionMismatchError) Error() string
type Webhook ¶
type Webhook struct { Sys *Sys `json:"sys,omitempty"` Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` Topics []string `json:"topics,omitempty"` HTTPBasicUsername string `json:"httpBasicUsername,omitempty"` HTTPBasicPassword string `json:"httpBasicPassword,omitempty"` Headers []*WebhookHeader `json:"headers,omitempty"` }
Webhook model
func (*Webhook) GetVersion ¶
GetVersion returns entity version
type WebhookCall ¶
type WebhookCall struct { Sys *Sys `json:"sys"` Request Request `json:"request,omitempty"` Response Response `json:"response,omitempty"` StatusCode int `json:"statusCode"` Errors []string `json:"errors"` EventType string `json:"eventType"` URL string `json:"url"` RequestAt string `json:"requestAt"` ResponseAt string `json:"responseAt"` }
WebhookCall model
type WebhookCallsService ¶
type WebhookCallsService service
WebhookCallsService service
func (*WebhookCallsService) Get ¶
func (service *WebhookCallsService) Get(spaceID, webhookID, callID string) (*WebhookCall, error)
Get returns details of a single webhook call
func (*WebhookCallsService) Health ¶
func (service *WebhookCallsService) Health(spaceID, webhookID string) (*WebhookHealth, error)
Health returns the health of a webhook
func (*WebhookCallsService) List ¶
func (service *WebhookCallsService) List(spaceID, webhookID string) *Collection
List returns a webhook calls collection
type WebhookHeader ¶
WebhookHeader model
type WebhookHealth ¶
type WebhookHealth struct { Sys *Sys `json:"sys"` Calls HealthDetails `json:"calls"` }
WebhookHealth model
type WebhooksService ¶
type WebhooksService service
WebhooksService service
func (*WebhooksService) Delete ¶
func (service *WebhooksService) Delete(spaceID string, webhook *Webhook) error
Delete the webhook
func (*WebhooksService) Get ¶
func (service *WebhooksService) Get(spaceID, webhookID string) (*Webhook, error)
Get returns a single webhook entity
func (*WebhooksService) List ¶
func (service *WebhooksService) List(spaceID string) *Collection
List returns webhooks collection
Source Files ¶
- access_token.go
- api_key.go
- app_definition.go
- app_installation.go
- asset.go
- collection.go
- content_type.go
- content_type_field_validations.go
- contentful.go
- editor_interface.go
- entry.go
- entry_task.go
- environment.go
- environment_alias.go
- errors.go
- extension.go
- locale.go
- membership.go
- organization.go
- query.go
- resource.go
- role.go
- scheduled_action.go
- snapshot.go
- space.go
- types.go
- usage.go
- user.go
- version.go
- webhook.go
- webhook_call.go