com.pubnub.internal.endpoints.files.GetFileUrlImpl Maven / Gradle / Ivy
package com.pubnub.internal.endpoints.files;
import com.pubnub.api.PubNubException;
import com.pubnub.api.builder.PubNubErrorBuilder;
import com.pubnub.api.endpoints.BuilderSteps;
import com.pubnub.api.endpoints.files.GetFileUrl;
import com.pubnub.api.endpoints.files.requiredparambuilder.FilesBuilderSteps;
import com.pubnub.api.models.consumer.files.PNFileUrlResult;
import com.pubnub.internal.EndpointInterface;
import com.pubnub.internal.PubNubCore;
import com.pubnub.internal.endpoints.IdentityMappingEndpoint;
import com.pubnub.internal.endpoints.files.requiredparambuilder.ChannelFileNameFileIdBuilder;
import org.jetbrains.annotations.NotNull;
public class GetFileUrlImpl extends IdentityMappingEndpoint implements GetFileUrl {
private final String channel;
private final String fileId;
private final String fileName;
public GetFileUrlImpl(String channel, String fileId, String fileName, PubNubCore pubnub) {
super(pubnub);
this.channel = channel;
this.fileId = fileId;
this.fileName = fileName;
}
@Override
@NotNull
protected EndpointInterface createAction() {
return pubnub.getFileUrl(
channel,
fileName,
fileId
);
}
public static class Builder extends ChannelFileNameFileIdBuilder implements GetFileUrl.Builder {
private Builder(BuilderSteps.ChannelStep>> builder) {
super(builder);
}
}
public static GetFileUrlImpl.Builder builder(PubNubCore pubNub) {
return new GetFileUrlImpl.Builder(ChannelFileNameFileIdBuilder.create((channel, fileName, fileId) ->
new GetFileUrlImpl(channel, fileName, fileId, pubNub)));
}
@Override
protected void validateParams() throws PubNubException {
if (channel == null) {
throw new PubNubException(PubNubErrorBuilder.PNERROBJ_CHANNEL_MISSING);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy