Skip to content

feat: add highlight_type to files.completeUploadExternal and filesUploadV2#1589

Merged
zimeg merged 5 commits into
mainfrom
feat/highlight-type
May 18, 2026
Merged

feat: add highlight_type to files.completeUploadExternal and filesUploadV2#1589
zimeg merged 5 commits into
mainfrom
feat/highlight-type

Conversation

@zimeg
Copy link
Copy Markdown
Member

@zimeg zimeg commented May 15, 2026

This pull request adds highlight_type support to files.completeUploadExternal and the filesUploadV2 method.

The highlight_type parameter allows specifying the file type hint for uploads (e.g. png, jpg, gif), enabling optimistic rendering before the async upload processing job completes.

📚 https://docs.slack.dev/reference/methods/files.completeUploadExternal

Changes

  • Added highlightType to FilesCompleteUploadExternalRequest.FileDetails (per-file in the files array)
  • Added highlightType to FilesUploadV2Request (top-level for single-file uploads) and FilesUploadV2Request.UploadFile (for multi-file uploads)
  • Updated MethodsClientImpl.filesUploadV2 to pass highlightType through to each FileDetails object in the completion step

Usage

import com.slack.api.Slack;
import com.slack.api.methods.response.files.FilesUploadV2Response;

Slack slack = Slack.getInstance();

// Single file upload with highlight_type
FilesUploadV2Response response = slack.methods(token).filesUploadV2(r -> r
    .channel("C0123456789")
    .file(new File("./image.png"))
    .filename("image.png")
    .title("Image Upload")
    .highlightType("png")
    .initialComment("Uploaded with highlight_type for optimistic rendering")
);

// Multiple file uploads with highlight_type
FilesUploadV2Response response = slack.methods(token).filesUploadV2(r -> r
    .channel("C0123456789")
    .uploadFiles(Arrays.asList(
        FilesUploadV2Request.UploadFile.builder()
            .file(new File("./photo.jpg"))
            .filename("photo.jpg")
            .title("Photo")
            .highlightType("jpg")
            .build(),
        FilesUploadV2Request.UploadFile.builder()
            .file(new File("./diagram.png"))
            .filename("diagram.png")
            .title("Diagram")
            .highlightType("png")
            .build()
    ))
    .initialComment("Multiple files with highlight_type")
);

Related PRs

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

  • bolt (Bolt for Java)
  • bolt-{sub modules} (Bolt for Java - optional modules)
  • slack-api-client (Slack API Clients)
  • slack-api-model (Slack API Data Models)
  • slack-api-*-kotlin-extension (Kotlin Extensions for Slack API Clients)
  • slack-app-backend (The primitive layer of Bolt for Java)

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

…oadV2

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.25%. Comparing base (fc11ab4) to head (aa896a4).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../com/slack/api/methods/impl/MethodsClientImpl.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1589      +/-   ##
============================================
- Coverage     73.29%   73.25%   -0.04%     
+ Complexity     4519     4516       -3     
============================================
  Files           478      478              
  Lines         14298    14300       +2     
  Branches       1490     1490              
============================================
- Hits          10480    10476       -4     
- Misses         2930     2935       +5     
- Partials        888      889       +1     
Flag Coverage Δ
jdk-14 73.25% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zimeg zimeg self-assigned this May 15, 2026
@zimeg zimeg added enhancement M-T: A feature request for new functionality project:slack-api-client project:slack-api-client semver:minor labels May 15, 2026
@zimeg zimeg added this to the 1.48.2 milestone May 15, 2026
zimeg and others added 3 commits May 15, 2026 14:59
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…file path

highlight_type is only needed at the completion step, not during upload.
Read directly from the request object instead of round-tripping through uploadFile.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg marked this pull request as ready for review May 15, 2026 22:13
@zimeg zimeg requested a review from a team as a code owner May 15, 2026 22:13
Copy link
Copy Markdown
Contributor

@srtaalej srtaalej left a comment

Choose a reason for hiding this comment

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

⭐ ⭐ ⭐

@zimeg
Copy link
Copy Markdown
Member Author

zimeg commented May 18, 2026

@srtaalej Kind thanks 📠 Let's get this merged? Let's!

@zimeg zimeg merged commit a6e7f83 into main May 18, 2026
6 of 7 checks passed
@zimeg zimeg deleted the feat/highlight-type branch May 18, 2026 17:28
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 project:slack-api-client project:slack-api-client semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants