Skip to content

Commit

Permalink
Merge pull request #34 from iLert/feature/status-page-layout-fields
Browse files Browse the repository at this point in the history
Feature/status page layout fields
  • Loading branch information
STLVRTX authored Jan 3, 2024
2 parents 0b1fd01 + 995e19f commit b948361
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- deprecate uptime monitors in [#32](https://github.com/iLert/ilert-go/pull/32)
- add new resource support hours in [#33](https://github.com/iLert/ilert-go/pull/33)
- add new status page fields in [#34](https://github.com/iLert/ilert-go/pull/34)

# 12.12.2023, Version 3.3.0

Expand Down
1 change: 1 addition & 0 deletions examples/status_page/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func main() {
Visibility: "PRIVATE",
Services: []ilert.Service{{ID: 0}}, // your service id
Timezone: "Europe/Berlin",
PageLayout: "SINGLE_COLUMN",
}
input := &ilert.CreateStatusPageInput{
StatusPage: newStatuspage,
Expand Down
52 changes: 51 additions & 1 deletion status_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
)

// StatusPage definition https://api.ilert.com/api-docs/#!/Status-Pages
// StatusPage definition https://api.ilert.com/api-docs/#tag/Status-Pages
type StatusPage struct {
ID int64 `json:"id"`
Name string `json:"name"`
Expand All @@ -23,6 +23,7 @@ type StatusPage struct {
ShowIncidentHistoryOption bool `json:"showIncidentHistoryOption"`
PageTitle string `json:"pageTitle"`
PageDescription string `json:"pageDescription"`
PageLayout string `json:"pageLayout,omitempty"`
LogoRedirectUrl string `json:"logoRedirectUrl"`
Activated bool `json:"activated"`
Status string `json:"status"`
Expand All @@ -33,6 +34,7 @@ type StatusPage struct {
IpWhitelist []string `json:"ipWhitelist,omitempty"`
AccountWideView bool `json:"accountWideView,omitempty"`
Structure *StatusPageStructure `json:"structure,omitempty"`
ThemeMode string `json:"themeMode,omitempty"`
}

// StatusPageStructure defines status page structure
Expand All @@ -49,6 +51,9 @@ type StatusPageElement struct {
// Must be either "SERVICE" or "GROUP", corresponding to given ID
Type string `json:"type"`

// Allowed values are "expand" | "no-graph"
Options []string `json:"options,omitempty"`

// Can only contain StatusPageElement of type "SERVICE".
// Must not be set on type "SERVICE".
// Must be set on type "GROUP".
Expand Down Expand Up @@ -85,6 +90,51 @@ var StatusPageElementTypeAll = []string{
StatusPageElementType.Group,
}

// StatusPageLayout defines status page layout
var StatusPageLayout = struct {
SingleColumn string
Responsive string
}{
SingleColumn: "SINGLE_COLUMN",
Responsive: "RESPONSIVE",
}

// StatusPageLayoutAll defines all status page layouts
var StatusPageLayoutAll = []string{
StatusPageLayout.SingleColumn,
StatusPageLayout.Responsive,
}

// StatusPageThemeMode defines status page theme mode
var StatusPageThemeMode = struct {
Light string
Dark string
}{
Light: "LIGHT",
Dark: "DARK",
}

// StatusPageThemeModeAll defines all status page theme modes
var StatusPageThemeModeAll = []string{
StatusPageThemeMode.Light,
StatusPageThemeMode.Dark,
}

// StatusPageElementOption defines status page element option
var StatusPageElementOption = struct {
Expand string
NoGraph string
}{
Expand: "expand",
NoGraph: "no-graph",
}

// StatusPageElementOptionAll defines all status page element options
var StatusPageElementOptionAll = []string{
StatusPageElementOption.Expand,
StatusPageElementOption.NoGraph,
}

// CreateStatusPageInput represents the input of a CreateStatusPage operation.
type CreateStatusPageInput struct {
_ struct{}
Expand Down

0 comments on commit b948361

Please sign in to comment.