2019-10-09 06:01:52 +00:00
|
|
|
import gql from "graphql-tag";
|
|
|
|
|
|
|
|
import { TypedQuery } from "../queries";
|
|
|
|
import { Webhook, WebhookVariables } from "./types/Webhook";
|
|
|
|
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
|
|
|
events {
|
|
|
|
eventType
|
|
|
|
}
|
|
|
|
isActive
|
|
|
|
secretKey
|
|
|
|
targetUrl
|
|
|
|
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}
|
|
|
|
query Webhooks($first: Int, $after: String, $last: Int, $before: String) {
|
|
|
|
webhooks(before: $before, after: $after, first: $first, last: $last) {
|
|
|
|
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-09 06:01:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedWebhooksDetailsQuery = TypedQuery<Webhook, WebhookVariables>(
|
|
|
|
webhooksDetails
|
|
|
|
);
|