2019-10-09 06:01:52 +00:00
|
|
|
import gql from "graphql-tag";
|
|
|
|
|
|
|
|
import { TypedQuery } from "../queries";
|
2019-10-17 11:59:18 +00:00
|
|
|
import { WebhookDetails, WebhookDetailsVariables } from "./types/WebhookDetails";
|
2019-10-09 06:01:52 +00:00
|
|
|
import { Webhooks, WebhooksVariables } from "./types/Webhooks";
|
|
|
|
|
|
|
|
export const webhooksFragment = gql`
|
|
|
|
fragment WebhookFragment on Webhook {
|
|
|
|
id
|
2019-10-09 06:56:46 +00:00
|
|
|
name
|
2019-10-09 06:01:52 +00:00
|
|
|
isActive
|
|
|
|
serviceAccount {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const webhooksDetailsFragment = gql`
|
|
|
|
${webhooksFragment}
|
|
|
|
fragment WebhooksDetailsFragment on Webhook {
|
2019-10-09 06:56:46 +00:00
|
|
|
...WebhookFragment
|
2019-10-09 06:01:52 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const webhooksList = gql`
|
|
|
|
${webhooksFragment}
|
2019-10-15 10:06:19 +00:00
|
|
|
query Webhooks(
|
|
|
|
$first: Int
|
|
|
|
$after: String
|
|
|
|
$last: Int
|
|
|
|
$before: String
|
|
|
|
$filter: WebhookFilterInput
|
|
|
|
) {
|
|
|
|
webhooks(
|
|
|
|
first: $first
|
|
|
|
after: $after
|
|
|
|
before: $before
|
|
|
|
last: $last
|
|
|
|
filter: $filter
|
|
|
|
) {
|
2019-10-09 06:01:52 +00:00
|
|
|
edges {
|
|
|
|
node {
|
2019-10-09 06:56:46 +00:00
|
|
|
...WebhookFragment
|
2019-10-09 06:01:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pageInfo {
|
|
|
|
hasPreviousPage
|
|
|
|
hasNextPage
|
|
|
|
startCursor
|
|
|
|
endCursor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedWebhooksListQuery = TypedQuery<Webhooks, WebhooksVariables>(
|
|
|
|
webhooksList
|
|
|
|
);
|
|
|
|
|
|
|
|
const webhooksDetails = gql`
|
|
|
|
${webhooksFragment}
|
2019-10-11 13:35:33 +00:00
|
|
|
query WebhookDetails($id: ID!) {
|
2019-10-09 06:01:52 +00:00
|
|
|
webhook(id: $id) {
|
2019-10-09 06:56:46 +00:00
|
|
|
...WebhookFragment
|
2019-10-15 10:06:19 +00:00
|
|
|
events {
|
|
|
|
eventType
|
|
|
|
}
|
|
|
|
secretKey
|
|
|
|
targetUrl
|
2019-10-09 06:01:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2019-10-17 11:59:18 +00:00
|
|
|
export const TypedWebhooksDetailsQuery = TypedQuery<WebhookDetails, WebhookDetailsVariables>(
|
2019-10-09 06:01:52 +00:00
|
|
|
webhooksDetails
|
|
|
|
);
|