-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPostStatementsRequest.java
More file actions
72 lines (60 loc) · 1.74 KB
/
Copy pathPostStatementsRequest.java
File metadata and controls
72 lines (60 loc) · 1.74 KB
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
/*
* Copyright 2016-2025 Berry Cloud Ltd. All rights reserved.
*/
package dev.learning.xapi.client;
import static dev.learning.xapi.client.XapiClientConstants.STATEMENTS_PATH;
import dev.learning.xapi.model.Statement;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import lombok.Builder;
import lombok.Getter;
import org.springframework.http.HttpMethod;
import org.springframework.web.util.UriBuilder;
/**
* Request for posting multiple Statements.
*
* @see <a href=
* "https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#212-post-statements">POST
* Statements</a>
* @author Thomas Turrell-Croft
*/
@Builder
@Getter
public class PostStatementsRequest implements Request {
private final List<Statement> statements;
@Override
public HttpMethod getMethod() {
return HttpMethod.POST;
}
@Override
public UriBuilder url(UriBuilder uriBuilder, Map<String, Object> queryParams) {
return uriBuilder.path(STATEMENTS_PATH);
}
/** Builder for PostStatementsRequest. */
public static class Builder {
// This static class extends the lombok builder.
/**
* Sets the statements.
*
* @param statements The statements of the PostStatementsRequest.
* @return This builder
* @see PostStatementsRequest#statements
*/
public Builder statements(List<Statement> statements) {
this.statements = statements;
return this;
}
/**
* Sets the statements.
*
* @param statements The statements of the PostStatementsRequest.
* @return This builder
* @see PostStatementsRequest#statements
*/
public Builder statements(Statement... statements) {
this.statements = Arrays.asList(statements);
return this;
}
}
}