summaryrefslogtreecommitdiff
path: root/spec/contracts/consumer/resources/graphql/pipelines.js
blob: 48724e15eb8438b057b1694db7c909f95e731449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import axios from 'axios';

import { extractGraphQLQuery } from '../../helpers/graphql_query_extractor';

export async function getPipelineHeaderDataRequest(endpoint) {
  const { url } = endpoint;
  const query = await extractGraphQLQuery(
    'app/assets/javascripts/pipelines/graphql/queries/get_pipeline_header_data.query.graphql',
  );
  const graphqlQuery = {
    query,
    variables: {
      fullPath: 'gitlab-org/gitlab-qa',
      iid: 1,
    },
  };

  return axios({
    method: 'POST',
    baseURL: url,
    url: '/api/graphql',
    headers: { Accept: '*/*' },
    data: graphqlQuery,
  });
}

export async function deletePipeline(endpoint) {
  const { url } = endpoint;
  const query = await extractGraphQLQuery(
    'app/assets/javascripts/pipelines/graphql/mutations/delete_pipeline.mutation.graphql',
  );
  const graphqlQuery = {
    query,
    variables: {
      id: 'gid://gitlab/Ci::Pipeline/316112',
    },
  };

  return axios({
    baseURL: url,
    url: '/api/graphql',
    method: 'POST',
    headers: { Accept: '*/*' },
    data: graphqlQuery,
  });
}