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

Added in functionality for admin.analytics.getFile method #1515

Merged
merged 6 commits into from Jul 21, 2022

Conversation

hello-ashleyintech
Copy link
Contributor

@hello-ashleyintech hello-ashleyintech commented Jul 15, 2022

Summary

Adding in admin.analytics.getFile support as mentioned in: #1191

Link to docs for the method is here: https://api.slack.com/methods/admin.analytics.getFile. This method is a little more unique to other methods -

  • In the event of a successful response, this method returns a binary string for a compressed JSON.gz file. Unlike other methods, there is no ok property to note its success. Due to the successful response being binary, it needs to be sent as an ArrayBuffer response to be able to be parsed properly - this was also added in this PR
  • In the event of a failed response, this method has a similar JSON structure as errors for other methods: { ok: false, error: "error message" }

Tested this functionality + tests locally on my own enterprise grid account.

Requirements (place an x in each [ ])

@hello-ashleyintech hello-ashleyintech added enhancement M-T: A feature request for new functionality pkg:web-api applies to `@slack/web-api` draft labels Jul 15, 2022
@hello-ashleyintech hello-ashleyintech self-assigned this Jul 15, 2022
@hello-ashleyintech hello-ashleyintech marked this pull request as ready for review July 20, 2022 20:42
Copy link
Member

@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.

Great work!

packages/web-api/src/WebClient.ts Outdated Show resolved Hide resolved
@seratch seratch added this to the web-api@6.8.0 milestone Jul 21, 2022
Copy link
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

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

Hey nicely done! Left a few comments and questions, this is looking great though!

…re explicit, updated unzip logic and buildResult to be async, added in interface types for responses, updated code_generator script to skip auto generation of AdminAnalyticsGetFile
Copy link
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

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

Awesome work, looks great to me! Well done

@@ -10,6 +10,7 @@

import { WebAPICallResult } from '../WebClient';
export type AdminAnalyticsGetFileResponse = WebAPICallResult & {
file_data?: Array<MemberDetails|PublicChannelDetails|PublicChannelMetadataDetails>[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Member

@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.

Thanks for the updates. Great progress

packages/web-api/src/response/index.ts Outdated Show resolved Hide resolved
scripts/code_generator.rb Outdated Show resolved Hide resolved
…ated code generation script to account for admin analytics, fixed some spacing, added in a TODO for future improvement for error handling
Copy link
Member

@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.

Great! Two last things..

scripts/code_generator.rb Outdated Show resolved Hide resolved
scripts/code_generator.rb Outdated Show resolved Hide resolved
Copy link
Member

@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.

LGTM! Once the CI builds pass, you can merge this PR (please don't forget squashing the commits into one when clicking the merge button)

@seratch
Copy link
Member

seratch commented Jul 21, 2022

Okay, this PR is ready to merge. Thanks for adding this feature!

@seratch seratch merged commit 57663a5 into slackapi:main Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft enhancement M-T: A feature request for new functionality pkg:web-api applies to `@slack/web-api`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants