Sha256: d333b1669ee6355bb97eb136866c06508207877a32901612ddd48e7af53a3c10

Contents?: true

Size: 921 Bytes

Versions: 1

Compression:

Stored size: 921 Bytes

Contents

const sample = {
  "id": 1,
  "global_access": "none"
}

const searchProject = (z, bundle) => {
  const requestParams = {}

  if (Boolean(bundle.inputData.id)) {
    requestParams['id'] = bundle.inputData.id
  }

  const responsePromise = z.request({
    method: 'GET',
    url: 'https://app.files.com/api/rest/v1/projects/' + bundle.inputData.id + '.json',
    params: {
      ...requestParams,
    }
  })
  return responsePromise
    .then(response => [JSON.parse(response.content)])
}

module.exports = {
  key: 'project',
  noun: 'Project',

  display: {
    label: 'Find Project',
    description: 'Find a single project.',
    important: false,
  },

  operation: {
    inputFields: [
      {
        key: 'id',
        label: 'Id',
        helpText: "Project ID.",
        required: true,
        type: 'integer',
        dynamic: 'project.id',
      },
    ],
    perform: searchProject,
    sample: sample
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
files.com-1.0.55 zapier/searches/projectFind.js