Skip to content

Commit

Permalink
Merge pull request #342 from HubSpot/add-new-files-get-upload-url-ext…
Browse files Browse the repository at this point in the history
…ernal

Add files.getUploadURLExternal method
  • Loading branch information
jaredstehler authored May 15, 2024
2 parents 1bbc6cc + 6a73e74 commit 7f0725b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ public enum SlackMethods implements SlackMethod {
),

files_delete(MethodWriteMode.WRITE, RateLimitingTiers.TIER_3, JsonStatus.ACCEPTS_JSON),
files_getUploadURLExternal(
MethodWriteMode.WRITE,
RateLimitingTiers.TIER_4,
JsonStatus.FORM_ENCODING_ONLY
),
files_info(
MethodWriteMode.READ,
RateLimitingTiers.TIER_4,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.hubspot.slack.client.methods.params.files;

import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.hubspot.immutables.style.HubSpotStyle;
import java.util.Optional;
import org.immutables.value.Value.Immutable;

@Immutable
@HubSpotStyle
@JsonNaming(SnakeCaseStrategy.class)
public interface GetUploadUrlExternalParamsIF {
String getFilename();
Long getLength();
Optional<String> getAltText();
Optional<String> getSnippetType();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.hubspot.slack.client.models.response.files;

import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.hubspot.immutables.style.HubSpotStyle;
import com.hubspot.slack.client.models.response.SlackResponse;
import org.immutables.value.Value.Immutable;

@Immutable
@HubSpotStyle
@JsonNaming(SnakeCaseStrategy.class)
public interface GetUploadUrlExternalResponseIF extends SlackResponse {
String getUploadUrl();
String getFileId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.hubspot.slack.client.methods.params.dnd.DndSetSnoozeParams;
import com.hubspot.slack.client.methods.params.files.FilesSharedPublicUrlParams;
import com.hubspot.slack.client.methods.params.files.FilesUploadParams;
import com.hubspot.slack.client.methods.params.files.GetUploadUrlExternalParams;
import com.hubspot.slack.client.methods.params.group.GroupsKickParams;
import com.hubspot.slack.client.methods.params.group.GroupsListParams;
import com.hubspot.slack.client.methods.params.im.ImOpenParams;
Expand Down Expand Up @@ -119,6 +120,7 @@
import com.hubspot.slack.client.models.response.emoji.EmojiListResponse;
import com.hubspot.slack.client.models.response.files.FilesSharedPublicUrlResponse;
import com.hubspot.slack.client.models.response.files.FilesUploadResponse;
import com.hubspot.slack.client.models.response.files.GetUploadUrlExternalResponse;
import com.hubspot.slack.client.models.response.group.GroupsKickResponse;
import com.hubspot.slack.client.models.response.im.ImOpenResponse;
import com.hubspot.slack.client.models.response.migration.MigrationExchangeResponse;
Expand Down Expand Up @@ -390,6 +392,10 @@ CompletableFuture<Result<AddReactionResponse, SlackError>> addReaction(
CompletableFuture<Result<FilesUploadResponse, SlackError>> uploadFile(
FilesUploadParams params
);

CompletableFuture<Result<GetUploadUrlExternalResponse, SlackError>> getUploadURLExternal(
GetUploadUrlExternalParams params
);
CompletableFuture<Result<FilesSharedPublicUrlResponse, SlackError>> shareFilePublically(
FilesSharedPublicUrlParams params
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import com.hubspot.slack.client.methods.params.dnd.DndSetSnoozeParams;
import com.hubspot.slack.client.methods.params.files.FilesSharedPublicUrlParams;
import com.hubspot.slack.client.methods.params.files.FilesUploadParams;
import com.hubspot.slack.client.methods.params.files.GetUploadUrlExternalParams;
import com.hubspot.slack.client.methods.params.group.GroupsKickParams;
import com.hubspot.slack.client.methods.params.group.GroupsListParams;
import com.hubspot.slack.client.methods.params.im.ImOpenParams;
Expand Down Expand Up @@ -156,6 +157,7 @@
import com.hubspot.slack.client.models.response.emoji.EmojiListResponse;
import com.hubspot.slack.client.models.response.files.FilesSharedPublicUrlResponse;
import com.hubspot.slack.client.models.response.files.FilesUploadResponse;
import com.hubspot.slack.client.models.response.files.GetUploadUrlExternalResponse;
import com.hubspot.slack.client.models.response.group.GroupsKickResponse;
import com.hubspot.slack.client.models.response.group.GroupsListResponse;
import com.hubspot.slack.client.models.response.im.ImOpenResponse;
Expand Down Expand Up @@ -1399,6 +1401,17 @@ public CompletableFuture<Result<FilesUploadResponse, SlackError>> uploadFile(
);
}

@Override
public CompletableFuture<Result<GetUploadUrlExternalResponse, SlackError>> getUploadURLExternal(
GetUploadUrlExternalParams params
) {
return postSlackCommand(
SlackMethods.files_getUploadURLExternal,
params,
GetUploadUrlExternalResponse.class
);
}

@Override
public CompletableFuture<Result<FilesSharedPublicUrlResponse, SlackError>> shareFilePublically(
FilesSharedPublicUrlParams params
Expand Down

0 comments on commit 7f0725b

Please sign in to comment.