Skip to content

Commit

Permalink
update scheduledactions struct
Browse files Browse the repository at this point in the history
  • Loading branch information
fauzi-as committed Mar 11, 2024
1 parent 304ba86 commit a5e14b7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
18 changes: 9 additions & 9 deletions contentful.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ type Contentful struct {
BaseURL string
Environment string

Spaces *SpacesService
APIKeys *APIKeyService
Assets *AssetsService
ContentTypes *ContentTypesService
Entries *EntriesService
Locales *LocalesService
Webhooks *WebhooksService
Spaces *SpacesService
APIKeys *APIKeyService
Assets *AssetsService
ContentTypes *ContentTypesService
Entries *EntriesService
Locales *LocalesService
Webhooks *WebhooksService
ScheduledActions *ScheduledActionsService
}

Expand All @@ -56,8 +56,8 @@ func NewCMA(token string) *Contentful {
Debug: false,
Headers: map[string]string{
"Authorization": fmt.Sprintf("Bearer %s", token),
// "Content-Type": "application/vnd.contentful.management.v1+json",
// "X-Contentful-User-Agent": fmt.Sprintf("sdk contentful.go/%s", Version),
"Content-Type": "application/vnd.contentful.management.v1+json",
"X-Contentful-User-Agent": fmt.Sprintf("sdk contentful.go/%s", Version),
},
BaseURL: "https://api.contentful.com",
}
Expand Down
15 changes: 9 additions & 6 deletions scheduled_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import (
// SpacesService model
type ScheduledActionsService service

type ScheduledFor struct {
Datetime string `json:"datetime,omitempty"`
Timezone string `json:"timezone,omitempty"`
}

// ScheduledActions model
type ScheduledActions struct {
Sys *Sys `json:"sys,omitempty"`
Action string `json:"action,omitempty"`
ScheduleFor struct {
Datetime string `json:"datetime,omitempty"`
TimeZone string `json:"timezone,omitempty"`
} `json:"scheduledFor,omitempty"`
Sys *Sys `json:"sys,omitempty"`
Action string `json:"action,omitempty"`
ScheduledFor *ScheduledFor `json:"scheduledFor,omitempty"`
}

// Get returns a single scheduledActions entity
Expand Down Expand Up @@ -51,5 +53,6 @@ func (service *ScheduledActionsService) Get(spaceID string, entryID string, envi
for _, ct := range col.ToScheduledAction() {
fmt.Println(ct)
}

return &ScheduledActions{}, nil
}
6 changes: 2 additions & 4 deletions scheduled_actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import (

func Test_ExampleScheduledActionsService_Get(t *testing.T) {

fmt.Println("HII")

cma := NewCMA("TOKEN HERE")
cma := NewCMA("cma-token")
assert.NotNil(t, cma)
assert.NotNil(t, cma.ScheduledActions)

scheduledActions, err := cma.ScheduledActions.Get("qfsyzz7ytbcy", "2zgxTOq8CGHMGuusEpnJDq", "master")
scheduledActions, err := cma.ScheduledActions.Get("space-id", "entry-id", "env")

if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit a5e14b7

Please sign in to comment.