wangmengmeng
2024-12-24 24432a361d5c6bd6f3d8c008693e9f1155d62517
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package com.dji.sdk.cloudapi.wayline.api;
 
import com.dji.sdk.cloudapi.wayline.GetWaylineListRequest;
import com.dji.sdk.cloudapi.wayline.GetWaylineListResponse;
import com.dji.sdk.cloudapi.wayline.WaylineUploadCallbackRequest;
import com.dji.sdk.common.HttpResultResponse;
import com.dji.sdk.common.PaginationData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
 
/**
 * @author sean
 * @version 0.3
 * @date 2021/12/22
 */
@Tag(name = "wayline interface")
public interface IHttpWaylineService {
 
    String PREFIX = "wayline/api/v1";
 
    /**
     * Query the basic data of the wayline file according to the query conditions.
     * The query condition field in pilot is fixed.
     * @param workspaceId workspace id
     * @param request   get waylines params
     * @param req
     * @param rsp
     * @return  wayline list
     */
    @Operation(summary = "get wayline list", description = "Query the basic data of the wayline file according to " +
            "the query conditions. The query condition field in pilot is fixed.",
            parameters = {
                @Parameter(name = "workspace_id", description = "workspace id", schema = @Schema(format = "uuid"))
            })
    @GetMapping(PREFIX + "/workspaces/{workspace_id}/waylines")
    HttpResultResponse<PaginationData<GetWaylineListResponse>> getWaylineListW(
            @Valid @ParameterObject GetWaylineListRequest request,
            @PathVariable(name = "workspace_id") String workspaceId,
            HttpServletRequest req, HttpServletResponse rsp);
    /**
     * Query the basic data of the wayline file according to the query conditions.
     * The query condition field in pilot is fixed.
     * @param request   get waylines params
     * @param req
     * @param rsp
     * @return  wayline list
     */
    @Operation(summary = "get wayline list", description = "Query the basic data of the wayline file according to " +
            "the query conditions. The query condition field in pilot is fixed.",
            parameters = {
            })
    @PostMapping(PREFIX + "/wayline/getList")
    HttpResultResponse<PaginationData<GetWaylineListResponse>> getWaylineList(
            @RequestParam(defaultValue = "1") Long page,
            @RequestParam(name = "page_size", defaultValue = "10") Long pageSize,
            HttpServletRequest req, HttpServletResponse rsp);
 
    /**
     * Query the download address of the file according to the wayline file id,
     * and redirect to this address directly for download.
     * @param workspaceId   workspace id
     * @param waylineId     wayline file id
     * @param req
     * @param rsp
     */
    @Operation(summary = "get wayline file download address", description = "Query the download address of the file " +
            "according to the wayline file id, and redirect to this address directly for download.",
            parameters = {
                @Parameter(name = "workspace_id", description = "workspace id", schema = @Schema(format = "uuid")),
                @Parameter(name = "wayline_id", description = "wayline id", schema = @Schema(format = "uuid"))
            })
    @GetMapping(PREFIX + "/workspaces/{workspace_id}/waylines/{wayline_id}/url")
    void getWaylineFileDownloadAddress(
            @PathVariable(name = "workspace_id") String workspaceId,
            @PathVariable(name = "wayline_id") String waylineId,
            HttpServletRequest req, HttpServletResponse rsp);
 
    /**
     * Checking whether the name already exists according to the wayline name must ensure the uniqueness of the wayline name.
     * This interface will be called when uploading waylines and must be available.
     * @param workspaceId workspace id
     * @param names  wayline file name collection
     * @param req
     * @param rsp
     * @return  already existing wayline name
     */
    @Operation(summary = "get duplicated wayline name", description = "Checking whether the name already exists " +
            "according to the wayline name must ensure the uniqueness of the wayline name. " +
            "This interface will be called when uploading waylines and must be available.",
            parameters = {
                @Parameter(name = "workspace_id", description = "workspace id", required = true),
                @Parameter(name = "name", description = "wayline file name", required = true)
            })
    @GetMapping(PREFIX + "/workspaces/{workspace_id}/waylines/duplicate-names")
    HttpResultResponse<List<String>> getDuplicatedWaylineName(
            @PathVariable(name = "workspace_id") String workspaceId,
            @NotNull @Size(min = 1) @RequestParam(name = "name") List<String> names,
            HttpServletRequest req, HttpServletResponse rsp);
 
    /**
     * When the wayline file is uploaded to the storage server by pilot,
     * the basic information of the file is reported through this interface.
     * @param workspaceId   workspace id
     * @param request   upload callback params
     * @param req
     * @param rsp
     * @return  success
     */
    @Operation(summary = "file upload result report", description = "When the wayline file is uploaded to the " +
            "storage server by pilot, the basic information of the file is reported through this interface.",
            parameters = {
                @Parameter(name = "workspace_id", description = "workspace id", required = true)
            })
    @PostMapping(PREFIX + "/workspaces/{workspace_id}/upload-callback")
    HttpResultResponse fileUploadResultReport(
            @PathVariable(name = "workspace_id") String workspaceId,
            @Valid @RequestBody WaylineUploadCallbackRequest request,
            HttpServletRequest req, HttpServletResponse rsp);
 
    /**
     * Favorite the wayline file according to the wayline file id.
     * @param workspaceId   workspace id
     * @param ids   wayline file id
     * @param req
     * @param rsp
     * @return  success
     */
    @Operation(summary = "batch favorites wayline", description = "Favorite the wayline file according to the wayline file id.",
            parameters = {
                @Parameter(name = "workspace_id", description = "workspace id", required = true),
                @Parameter(name = "id", description = "wayline id", required = true)
            })
    @PostMapping(PREFIX + "/workspaces/{workspace_id}/favorites")
    HttpResultResponse batchFavoritesWayline(
            @PathVariable(name = "workspace_id") String workspaceId,
            @NotNull @Size(min = 1) @RequestParam(name = "id") List<String> ids,
            HttpServletRequest req, HttpServletResponse rsp);
 
    /**
     * Delete the favorites of this wayline file based on the wayline file id.
     * @param workspaceId   workspace id
     * @param ids   wayline file id
     * @param req
     * @param rsp
     * @return  success
     */
    @Operation(summary = "batch unfavorites wayline", description = "Delete the favorites of this wayline file based on the wayline file id.",
            parameters = {
                @Parameter(name = "workspace_id", description = "workspace id", required = true),
                @Parameter(name = "id", description = "wayline id", required = true)
            })
    @DeleteMapping(PREFIX + "/workspaces/{workspace_id}/favorites")
    HttpResultResponse batchUnfavoritesWayline(
            @PathVariable(name = "workspace_id") String workspaceId,
            @NotNull @Size(min = 1) @RequestParam(name = "id") List<String> ids,
            HttpServletRequest req, HttpServletResponse rsp);
}