UNPKG

mattermost-redux

Version:

Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client

61 lines (60 loc) 1.86 kB
"use strict"; // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. Object.defineProperty(exports, "__esModule", { value: true }); exports.createJob = createJob; exports.getJob = getJob; exports.getJobs = getJobs; exports.getJobsByType = getJobsByType; exports.cancelJob = cancelJob; const action_types_1 = require("mattermost-redux/action_types"); const client_1 = require("mattermost-redux/client"); const helpers_1 = require("./helpers"); const constants_1 = require("../constants"); function createJob(job) { return (0, helpers_1.bindClientFunc)({ clientFunc: client_1.Client4.createJob, onSuccess: action_types_1.JobTypes.RECEIVED_JOB, params: [ job, ], }); } function getJob(id) { return (0, helpers_1.bindClientFunc)({ clientFunc: client_1.Client4.getJob, onSuccess: action_types_1.JobTypes.RECEIVED_JOB, params: [ id, ], }); } function getJobs(page = 0, perPage = constants_1.General.JOBS_CHUNK_SIZE) { return (0, helpers_1.bindClientFunc)({ clientFunc: client_1.Client4.getJobs, onSuccess: action_types_1.JobTypes.RECEIVED_JOBS, params: [ page, perPage, ], }); } function getJobsByType(type, page = 0, perPage = constants_1.General.JOBS_CHUNK_SIZE) { return (0, helpers_1.bindClientFunc)({ clientFunc: client_1.Client4.getJobsByType, onSuccess: [action_types_1.JobTypes.RECEIVED_JOBS, action_types_1.JobTypes.RECEIVED_JOBS_BY_TYPE], params: [ type, page, perPage, ], }); } function cancelJob(job) { return (0, helpers_1.bindClientFunc)({ clientFunc: client_1.Client4.cancelJob, params: [ job, ], }); }