Skip to content

Add explicit arguments for files_info#1085

Merged
seratch merged 6 commits intoslackapi:mainfrom
jaebradley:remove-unnecessary-kwargs-for-some-files-methods
Aug 6, 2021
Merged

Add explicit arguments for files_info#1085
seratch merged 6 commits intoslackapi:mainfrom
jaebradley:remove-unnecessary-kwargs-for-some-files-methods

Conversation

@jaebradley
Copy link
Copy Markdown
Contributor

Summary

Tangentially related to #1018 , the main purpose was to potentially clean up the public interface for some files_* methods as well as expand and clarify my understanding of those API methods.

Based on the public API documentation available (like the API documentation page for the files_info method) I attempted to clean up the arguments for the files_comments_delete, files_delete, and files_info methods.

This is technically a breaking change. To keep this non-breaking, I could keep the kwargs in addition to defining the explicit method arguments.

Category (place an x in each of the [ ])

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs-src (Documents, have you run ./docs.sh?)
  • /docs-src-v2 (Documents, have you run ./docs-v2.sh?)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements (place an x in each [ ])

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

@gitwave gitwave bot added the untriaged label Aug 6, 2021
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Aug 6, 2021

CLA assistant check
All committers have signed the CLA.

return self.api_call("files.delete", json={"file": file})

def files_info(self, *, file: str, **kwargs) -> SlackResponse:
def files_info(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

I was using the above resource to define the optional arguments

return self.api_call("files.comments.delete", json=kwargs)
return self.api_call("files.comments.delete", json={"file": file, "id": id})

def files_delete(self, *, file: str, **kwargs) -> SlackResponse:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kwargs is still needed even if we have all the possible arguments. **kwargs can work as a workaround when developers try beta features and/or the SDK does not support newly added arguments until new version releases. This request is the same for other changes.

@seratch
Copy link
Copy Markdown
Contributor

seratch commented Aug 6, 2021

@jaebradley Thanks for taking the time to make this pull request! Can you check my comments above? Thanks!

@seratch seratch added enhancement M-T: A feature request for new functionality Version: 3x web-client and removed untriaged labels Aug 6, 2021
@seratch seratch added this to the 3.9.0 milestone Aug 6, 2021
jaebradley and others added 2 commits August 5, 2021 23:08
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
@jaebradley jaebradley changed the title Remove unnecessary kwargs for files_comments_delete, files_delete, and files_info Add explicit arguments for files_info Aug 6, 2021
@jaebradley jaebradley requested a review from seratch August 6, 2021 03:32
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 6, 2021

Codecov Report

Merging #1085 (dd0b15c) into main (c2b5c29) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1085   +/-   ##
=======================================
  Coverage   85.62%   85.62%           
=======================================
  Files          99       99           
  Lines        9324     9324           
=======================================
  Hits         7984     7984           
  Misses       1340     1340           
Impacted Files Coverage Δ
slack_sdk/web/async_client.py 92.81% <100.00%> (ø)
slack_sdk/web/client.py 94.21% <100.00%> (ø)
slack_sdk/web/legacy_client.py 93.83% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2b5c29...dd0b15c. Read the comment docs.

Copy link
Copy Markdown
Contributor

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Once the CI builds pass, I'll merge this PR!

@seratch seratch merged commit 8a0c802 into slackapi:main Aug 6, 2021
@seratch
Copy link
Copy Markdown
Contributor

seratch commented Aug 6, 2021

@jaebradley Congrats on your first contribution to this project 🎉 and thanks again for taking the time to work on it!

@jaebradley jaebradley deleted the remove-unnecessary-kwargs-for-some-files-methods branch August 6, 2021 19:11
@jaebradley
Copy link
Copy Markdown
Contributor Author

@seratch thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality Version: 3x web-client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants