Skip to content

Commit

Permalink
Rename catalog to catalogue (#43)
Browse files Browse the repository at this point in the history
* Add operation to delete pages
  • Loading branch information
edsonmichaque committed Dec 1, 2023
1 parent 94ccea8 commit 955846e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
3 changes: 1 addition & 2 deletions catalogues.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Catalogues interface {
GetCatalogue(ctx context.Context, id int64, opts ...Option) (*GetCatalogueOutput, error)
ListCatalogues(ctx context.Context, options *ListCataloguesInput, opts ...Option) (*ListCataloguesOutput, error)
UpdateCatalogue(ctx context.Context, id int64, input *UpdateCatalogueInput, opts ...Option) (*UpdateCatalogueOutput, error)
DeleteCatalogue(ctx context.Context, id int64, opts ...Option) (*CatalogueOutput, error)
DeleteCatalogue(ctx context.Context, id int64, opts ...Option) (*CatalogueOutput, error)
}

type catalogues struct {
Expand Down Expand Up @@ -114,7 +114,6 @@ func (p catalogues) DeleteCatalogue(ctx context.Context, id int64, opts ...Optio
return &CatalogueOutput{}, nil
}


type CatalogueInput struct {
ID *int64 `json:"ID,omitempty"`
Name string `json:"Name,omitempty"`
Expand Down
4 changes: 1 addition & 3 deletions custom-time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import (
)

func TestCustomTime_UnmarshalJSON(t *testing.T) {
var (
t0, _ = time.Parse("2006-01-02 15:04", "2020-01-01 00:00")
)
t0, _ := time.Parse("2006-01-02 15:04", "2020-01-01 00:00")
tests := []struct {
name string
Time time.Time
Expand Down
23 changes: 18 additions & 5 deletions pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Pages interface {
GetPage(ctx context.Context, id int64, opts ...Option) (*GetPageOutput, error)
ListPages(ctx context.Context, options *ListPagesInput, opts ...Option) (*ListPagesOutput, error)
UpdatePage(ctx context.Context, id int64, input *UpdatePageInput, opts ...Option) (*UpdatePageOutput, error)
DeletePage(ctx context.Context, id int64, opts ...Option) (*PageOutput, error)
}

type pages struct {
Expand Down Expand Up @@ -104,10 +105,22 @@ func (p pages) UpdatePage(ctx context.Context, id int64, input *UpdatePageInput,
}, nil
}

func (p pages) DeletePage(ctx context.Context, id int64, opts ...Option) (*PageOutput, error) {
_, err := p.client.doDelete(ctx, fmt.Sprintf(pathPage, id), nil, nil)
if err != nil {
return nil, err
}

return &PageOutput{}, nil
}

type PageInput struct {
ID *int64 `json:",omitempty"`
Type string
Name string
AllowFormSubmission bool `json:"AllowFormSubmission"`
PageTypeID int64 `json:"PageTypeID"`
Path string `json:"Path"`
Status string `json:"Status"`
Template string `json:"Template"`
Title string `json:"Title"`
}

type UpdatePageInput = PageInput
Expand All @@ -122,8 +135,8 @@ type ListPagesOutput struct {

type Page struct {
AllowFormSubmission bool `json:"AllowFormSubmission"`
ID int `json:"ID"`
PageTypeID int `json:"PageTypeID"`
ID int64 `json:"ID"`
PageTypeID int64 `json:"PageTypeID"`
Path string `json:"Path"`
Status string `json:"Status"`
Template string `json:"Template"`
Expand Down

0 comments on commit 955846e

Please sign in to comment.