summaryrefslogtreecommitdiff
path: root/spec/contracts/consumer/resources/api/project/pipelines.js
blob: 8c6f5199666bceeec3b278c2c4e069424f669a54 (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
import axios from 'axios';

export async function getProjectPipelines(endpoint) {
  const { url } = endpoint;

  return axios({
    method: 'GET',
    baseURL: url,
    url: '/gitlab-org/gitlab-qa/-/pipelines.json',
    headers: { Accept: '*/*' },
    params: {
      scope: 'all',
      page: 1,
    },
  }).then((response) => response.data);
}

export async function postProjectPipelines(endpoint) {
  const { url } = endpoint;

  return axios({
    method: 'POST',
    baseURL: url,
    url: '/gitlab-org/gitlab-qa/-/pipelines',
    headers: {
      Accept: '*/*',
      'Content-Type': 'application/json; charset=utf-8',
    },
    data: { ref: 'master' },
    validateStatus: (status) => {
      return status === 302;
    },
  });
}