-
Notifications
You must be signed in to change notification settings - Fork 7
/
mergeQueue.js
47 lines (44 loc) · 1.32 KB
/
mergeQueue.js
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
47
import { get } from '../../entity'
export function MergeQueue (http, data = {}) {
this.stackHeaders = data.stackHeaders
this.urlPath = `/stacks/branches_queue`
if (data.uid) {
/**
* @description Fetch function gets the status of a merge job and it's configuration details.
* @memberof MergeQueue
* @func fetch
* @returns {Promise<Response>} Promise for response.
* @example
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client()
*
* client.stack({ api_key: 'api_key'}).branch().mergeQueue('UID').fetch()
* .then(response)
* .catch(error)
*
*/
this.fetch = async () => {
const url = `${this.urlPath}/${data.uid}`
return get(http, url, {}, data)
}
} else {
/**
* @description Find function lists all recent merge jobs.
* @memberof MergeQueue
* @func find
* @returns {Promise<Response>} Promise for response.
* @example
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client()
*
* client.stack({ api_key: 'api_key'}).branch().mergeQueue().find()
* .then(response)
* .catch(error)
*
*/
this.find = async (params = {}) => {
return get(http, this.urlPath, params, data)
}
}
return this
}