Skip to content

Commit

Permalink
add destination code
Browse files Browse the repository at this point in the history
  • Loading branch information
obs-gh-owengoebel committed Jul 25, 2024
1 parent 55e5617 commit 3b83521
Show file tree
Hide file tree
Showing 7 changed files with 945 additions and 0 deletions.
31 changes: 31 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,37 @@ func (c *Client) GetMonitorV2(ctx context.Context, id string) (*meta.MonitorV2,
return c.Meta.GetMonitorV2(ctx, id)
}

func (c *Client) CreateMonitorV2Destination(ctx context.Context, workspaceId string, input *meta.MonitorV2DestinationInput) (*meta.MonitorV2Destination, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
if c.Config.ManagingObjectID != nil {
input.ManagedById = c.Config.ManagingObjectID
}
return c.Meta.CreateMonitorV2Destination(ctx, workspaceId, input)
}

func (c *Client) UpdateMonitorV2Destination(ctx context.Context, id string, input *meta.MonitorV2DestinationInput) (*meta.MonitorV2Destination, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
return c.Meta.UpdateMonitorV2Destination(ctx, id, input)
}

func (c *Client) DeleteMonitorV2Destination(ctx context.Context, id string) error {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
return c.Meta.DeleteMonitorV2Destination(ctx, id)
}

func (c *Client) GetMonitorV2Destination(ctx context.Context, id string) (*meta.MonitorV2Destination, error) {
return c.Meta.GetMonitorV2Destination(ctx, id)
}

// CreateMonitorActionAttachment creates a monitor action attachment
func (c *Client) CreateMonitorActionAttachment(ctx context.Context, input *meta.MonitorActionAttachmentInput) (*meta.MonitorActionAttachment, error) {
if !c.Flags[flagObs2110] {
Expand Down
79 changes: 79 additions & 0 deletions client/internal/meta/operation/monitorv2_destination.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
fragment MonitorV2Destination on MonitorV2Destination {
inline
type
# @genqlient(flatten: true)
email {
...MonitorV2EmailDestination
}
# @genqlient(flatten: true)
webhook {
...MonitorV2WebhookDestination
}
id
workspaceId
name
iconUrl
description
createdBy
}

fragment MonitorV2EmailDestination on MonitorV2EmailDestination {
users
addresses
}

fragment MonitorV2WebhookDestination on MonitorV2WebhookDestination {
url
method
}

# @genqlient(for: "MonitorV2DestinationInput.inline", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.email", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.webhook", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.iconUrl", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.description", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.description", omitempty: true)
# @genqlient(for: "MonitorV2EmailDestinationInput.users", omitempty: true)
# @genqlient(for: "MonitorV2EmailDestinationInput.addresses", omitempty: true)
mutation createMonitorV2Destination(
$workspaceId: ObjectId!,
$input: MonitorV2DestinationInput!
) {
# @genqlient(flatten: true)
monitorV2Destination: createMonitorV2Destination(workspaceId: $workspaceId, input: $input) {
...MonitorV2Destination
}
}

# @genqlient(for: "MonitorV2DestinationInput.inline", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.email", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.webhook", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.iconUrl", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.description", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.description", omitempty: true)
# @genqlient(for: "MonitorV2EmailDestinationInput.users", omitempty: true)
# @genqlient(for: "MonitorV2EmailDestinationInput.addresses", omitempty: true)
mutation updateMonitorV2Destination(
$id: ObjectId!,
$input: MonitorV2DestinationInput!
) {
# @genqlient(flatten: true)
monitorV2Destination: updateMonitorV2Destination(id: $id, input: $input) {
...MonitorV2Destination
}
}

query getMonitorV2Destination($id: ObjectId!) {
# @genqlient(flatten: true)
monitorV2Destination: monitorV2Destination(id: $id) {
...MonitorV2Destination
}
}

mutation deleteMonitorV2Destination($id: ObjectId!) {
# @genqlient(flatten: true)
resultStatus: deleteMonitorV2Destination(id: $id) {
...ResultStatus
}
}

Loading

0 comments on commit 3b83521

Please sign in to comment.