All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nextpls.sdk.request.NextPlsAddAttachmentRequest Maven / Gradle / Ivy

package com.nextpls.sdk.request;

import com.alibaba.fastjson.JSONObject;
import com.nextpls.sdk.NextPlsRequest;
import com.nextpls.sdk.constants.ApiNameConst;
import com.nextpls.sdk.pojo.request.NextPlsAddAttachmentDto;
import com.nextpls.sdk.pojo.request.NextPlsBaseRequest;
import com.nextpls.sdk.pojo.response.NextPlsAddAttachmentResponse;
import org.apache.http.client.methods.HttpPost;

/**
 * 上传文件接口请求
 */
public class NextPlsAddAttachmentRequest implements NextPlsRequest {

    private static final String API_METHOD_NAME = ApiNameConst.ADD_ATTACHMENT;

    private final NextPlsBaseRequest baseRequest = new NextPlsBaseRequest<>();

    private String bizContents;

    @Override
    public String getApiMethodName() {
        return API_METHOD_NAME;
    }

    @Override
    public String getRequestMethod() {
        return HttpPost.METHOD_NAME;
    }

    @Override
    public boolean isNeedEncrypt() {
        return true;
    }

    @Override
    public String getBizContents() {
        return this.bizContents;
    }

    @Override
    public Class getResponseClass() {
        return NextPlsAddAttachmentResponse.class;
    }

    public void setRequestDto(NextPlsAddAttachmentDto requestDto) {
        this.baseRequest.setEntity(requestDto);
        this.baseRequest.setApiName(API_METHOD_NAME);
        this.bizContents = JSONObject.toJSONString(this.baseRequest);
    }

    public static NextPlsAddAttachmentRequest build(NextPlsAddAttachmentDto requestDto) {
        NextPlsAddAttachmentRequest request = new NextPlsAddAttachmentRequest();
        request.setRequestDto(requestDto);
        return request;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy