-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGetStatementRequest.java
More file actions
92 lines (73 loc) · 1.94 KB
/
GetStatementRequest.java
File metadata and controls
92 lines (73 loc) · 1.94 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* Copyright 2016-2025 Berry Cloud Ltd. All rights reserved.
*/
package dev.learning.xapi.client;
import dev.learning.xapi.model.StatementFormat;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import lombok.Getter;
import lombok.NonNull;
import lombok.experimental.SuperBuilder;
import org.springframework.http.HttpMethod;
import org.springframework.web.util.UriBuilder;
/**
* Request for getting a Statement.
*
* @see <a href=
* "https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#213-get-statements">GET
* Statements</a>
*
* @author Thomas Turrell-Croft
*/
@SuperBuilder
@Getter
public class GetStatementRequest implements Request {
@NonNull
protected final UUID id;
protected final StatementFormat format;
protected final Boolean attachments;
@Override
public HttpMethod getMethod() {
return HttpMethod.GET;
}
@Override
public UriBuilder url(UriBuilder uriBuilder, Map<String, Object> queryParams) {
return uriBuilder.path("/statements")
.queryParam("statementId", id)
.queryParamIfPresent("format", Optional.ofNullable(format))
.queryParamIfPresent("attachments", Optional.ofNullable(attachments));
}
/**
* Builder for GetStatementRequest.
*/
public abstract static class Builder<C extends GetStatementRequest, B extends Builder<C, B>> {
/**
* Sets the id.
*
* @param id The id of the GetStatementRequest.
*
* @return This builder
*
* @see GetStatementRequest#id
*/
public Builder<C, B> id(UUID id) {
this.id = id;
return self();
}
/**
* Sets the id.
*
* @param id The id of the GetStatementRequest.
*
* @return This builder
*
* @see GetStatementRequest#id
*/
public Builder<C, B> id(String id) {
this.id = UUID.fromString(id);
return self();
}
// This static class extends the lombok builder.
}
}