Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
deleteFile = (path, commit_message, options = {}) => {
const branch = options.branch || this.branch;
const commitParams = { commit_message, branch };
if (this.commitAuthor) {
const { name, email } = this.commitAuthor;
commitParams.author_name = name;
commitParams.author_email = email;
}
return flow([
unsentRequest.withMethod('DELETE'),
// TODO: only send author params if they are defined.
unsentRequest.withParams(commitParams),
this.request,
])(`${this.repoURL}/repository/files/${encodeURIComponent(path)}`);
};
}
listFiles = async (path, depth) => {
const node = await this.branchCommitSha();
const { entries, cursor } = await flow([
// sort files by filename ascending
unsentRequest.withParams({ sort: '-path', max_depth: depth }),
this.requestJSON,
then(this.getEntriesAndCursor),
])(`${this.repoURL}/src/${node}/${path}`);
return { entries: this.processFiles(entries), cursor };
};