Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated web api methods #713

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/WebClient.spec.js
Expand Up @@ -919,23 +919,6 @@ describe('WebClient', function () {
this.capture.startCapture();
});

it('should warn when calling a deprecated method', function () {
return this.client.files.comments.add({ file: 'FILE', comment: 'COMMENT' })
.then(() => {
const output = this.capture.getCapturedText();
assert.isNotEmpty(output);
const warning = output[0];
assert.match(warning, /^\[WARN\]/);
this.scope.done();
})
.then(() => {
this.capture.stopCapture();
}, (error) => {
this.capture.stopCapture();
throw error;
});
});

it('should warn when calling an API method using a callback', function (done) {
this.client.apiCall('method', {}, () => {
const output = this.capture.getCapturedText();
Expand Down
11 changes: 0 additions & 11 deletions src/WebClient.ts
Expand Up @@ -146,15 +146,6 @@ export class WebClient extends EventEmitter {
throw new TypeError(`Expected an options argument but instead received a ${typeof options}`);
}

// warn for methods whose functionality is deprecated
if (method === 'files.comments.add' || method === 'files.comments.edit') {
this.logger.warn(
`File comments are deprecated in favor of file threads. Replace uses of ${method} in your app ` +
'to take advantage of improvements. See https://api.slack.com/changelog/2018-05-file-threads-soon-tread ' +
'to learn more.',
);
}

const methodSupportsCursorPagination = methods.cursorPaginationEnabledMethods.has(method);
const optionsPaginationType = getOptionsPaginationType(options);

Expand Down Expand Up @@ -378,9 +369,7 @@ export class WebClient extends EventEmitter {
(this.apiCall.bind(this, 'files.sharedPublicURL')) as Method<methods.FilesSharedPublicURLArguments>,
upload: (this.apiCall.bind(this, 'files.upload')) as Method<methods.FilesUploadArguments>,
comments: {
add: (this.apiCall.bind(this, 'files.comments.add')) as Method<methods.FilesCommentsAddArguments>,
delete: (this.apiCall.bind(this, 'files.comments.delete')) as Method<methods.FilesCommentsDeleteArguments>,
edit: (this.apiCall.bind(this, 'files.comments.edit')) as Method<methods.FilesCommentsEditArguments>,
},
};

Expand Down
9 changes: 0 additions & 9 deletions src/methods.ts
Expand Up @@ -612,19 +612,10 @@ export type FilesUploadArguments = TokenOverridable & {
title?: string;
thread_ts?: string; // if specified, `channels` must be set
};
export type FilesCommentsAddArguments = TokenOverridable & {
comment: string;
file: string; // file id
};
export type FilesCommentsDeleteArguments = TokenOverridable & {
file: string; // file id
id: string; // comment id
};
export type FilesCommentsEditArguments = TokenOverridable & {
comment: string;
file: string; // file id
id: string; // comment id
};

/*
* `groups.*`
Expand Down