Skip to content
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ public class ExampleState {
private String message;
private Instant timestamp;

/**
* Constructor for ExampleState.
*/
/** Constructor for ExampleState. */
public ExampleState(String message, Instant timestamp) {
super();
this.message = message;
Expand All @@ -45,5 +43,4 @@ public void setTimestamp(Instant timestamp) {
public String toString() {
return "ExampleState [message=" + message + ", timestamp=" + timestamp + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
@SpringBootApplication
public class DeleteActivityProfileApplication implements CommandLineRunner {

/**
* Default xAPI client. Properties are picked automatically from application.properties.
*/
@Autowired
private XapiClient client;
/** Default xAPI client. Properties are picked automatically from application.properties. */
@Autowired private XapiClient client;

public static void main(String[] args) {
SpringApplication.run(DeleteActivityProfileApplication.class, args).close();
Expand All @@ -37,25 +34,21 @@ public void run(String... args) {
postActivityProfile();

// Delete activity profile
client.deleteActivityProfile(r -> r.activityId("https://example.com/activity/1")

.profileId("bookmark"))

client
.deleteActivityProfile(
r -> r.activityId("https://example.com/activity/1").profileId("bookmark"))
.block();

}

private void postActivityProfile() {

// Post activity profile
client.postActivityProfile(r -> r.activityId("https://example.com/activity/1")

.profileId("bookmark")

.activityProfile(new ExampleState("Hello World!", Instant.now())))

client
.postActivityProfile(
r ->
r.activityId("https://example.com/activity/1")
.profileId("bookmark")
.activityProfile(new ExampleState("Hello World!", Instant.now())))
.block();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
@SpringBootApplication
public class DeleteAgentProfileApplication implements CommandLineRunner {

/**
* Default xAPI client. Properties are picked automatically from application.properties.
*/
@Autowired
private XapiClient client;
/** Default xAPI client. Properties are picked automatically from application.properties. */
@Autowired private XapiClient client;

public static void main(String[] args) {
SpringApplication.run(DeleteAgentProfileApplication.class, args).close();
Expand All @@ -39,25 +36,21 @@ public void run(String... args) {
// Delete Agent Profile
client
.deleteAgentProfile(
r -> r.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))

.profileId("bookmark"))

r ->
r.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))
.profileId("bookmark"))
.block();
}

private void postAgentProfile() {

// Post Profile
client
.postAgentProfile(r -> r.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))

.profileId("bookmark")

.profile(new ExampleState("Hello World!", Instant.now())))

.postAgentProfile(
r ->
r.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))
.profileId("bookmark")
.profile(new ExampleState("Hello World!", Instant.now())))
.block();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
@SpringBootApplication
public class DeleteStateApplication implements CommandLineRunner {

/**
* Default xAPI client. Properties are picked automatically from application.properties.
*/
@Autowired
private XapiClient client;
/** Default xAPI client. Properties are picked automatically from application.properties. */
@Autowired private XapiClient client;

public static void main(String[] args) {
SpringApplication.run(DeleteStateApplication.class, args).close();
Expand All @@ -37,33 +34,27 @@ public void run(String... args) {
postState();

// Delete State
client.deleteState(r -> r.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")

.stateId("bookmark"))

client
.deleteState(
r ->
r.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")
.stateId("bookmark"))
.block();

}

private void postState() {

// Post State
client.postState(r -> r.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")

.stateId("bookmark")

.state(new ExampleState("Hello World!", Instant.now())))

client
.postState(
r ->
r.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")
.stateId("bookmark")
.state(new ExampleState("Hello World!", Instant.now())))
.block();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
@SpringBootApplication
public class DeleteStatesApplication implements CommandLineRunner {

/**
* Default xAPI client. Properties are picked automatically from application.properties.
*/
@Autowired
private XapiClient client;
/** Default xAPI client. Properties are picked automatically from application.properties. */
@Autowired private XapiClient client;

public static void main(String[] args) {
SpringApplication.run(DeleteStatesApplication.class, args).close();
Expand All @@ -37,31 +34,26 @@ public void run(String... args) {
postState();

// Delete states
client.deleteStates(r -> r.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6"))

client
.deleteStates(
r ->
r.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6"))
.block();

}

private void postState() {

// Post State
client.postState(r -> r.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")

.stateId("bookmark")

.state(new ExampleState("Hello World!", Instant.now())))

client
.postState(
r ->
r.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")
.stateId("bookmark")
.state(new ExampleState("Hello World!", Instant.now())))
.block();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
@SpringBootApplication
public class GetAboutApplication implements CommandLineRunner {

/**
* Default xAPI client. Properties are picked automatically from application.properties.
*/
@Autowired
private XapiClient client;
/** Default xAPI client. Properties are picked automatically from application.properties. */
@Autowired private XapiClient client;

public static void main(String[] args) {
SpringApplication.run(GetAboutApplication.class, args).close();
Expand All @@ -39,5 +36,4 @@ public void run(String... args) {
// Print the returned activity to the console
System.out.println(response.getBody());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@
@SpringBootApplication
public class GetActivityProfileApplication implements CommandLineRunner {

/**
* Default xAPI client. Properties are picked automatically from application.properties.
*/
@Autowired
private XapiClient client;
/** Default xAPI client. Properties are picked automatically from application.properties. */
@Autowired private XapiClient client;

public static void main(String[] args) {
SpringApplication.run(GetActivityProfileApplication.class, args).close();
Expand All @@ -38,29 +35,26 @@ public void run(String... args) {
postActivityProfile();

// Get activity profile
ResponseEntity<ExampleState> response = client
.getActivityProfile(r -> r.activityId("https://example.com/activity/1")

.profileId("bookmark"), ExampleState.class)

.block();
ResponseEntity<ExampleState> response =
client
.getActivityProfile(
r -> r.activityId("https://example.com/activity/1").profileId("bookmark"),
ExampleState.class)
.block();

// Print the returned activity profile to the console
System.out.println(response.getBody());

}

private void postActivityProfile() {

// Post Profile
client.postActivityProfile(r -> r.activityId("https://example.com/activity/1")

.profileId("bookmark")

.activityProfile(new ExampleState("Hello World!", Instant.now())))

client
.postActivityProfile(
r ->
r.activityId("https://example.com/activity/1")
.profileId("bookmark")
.activityProfile(new ExampleState("Hello World!", Instant.now())))
.block();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
@SpringBootApplication
public class GetActivityProfilesApplication implements CommandLineRunner {

/**
* Default xAPI client. Properties are picked automatically from application.properties.
*/
@Autowired
private XapiClient client;
/** Default xAPI client. Properties are picked automatically from application.properties. */
@Autowired private XapiClient client;

public static void main(String[] args) {
SpringApplication.run(GetActivityProfilesApplication.class, args).close();
Expand All @@ -40,9 +37,7 @@ public void run(String... args) {

// Get Activity Profiles
ResponseEntity<List<String>> response =
client.getActivityProfiles(r -> r.activityId("https://example.com/activity/1"))

.block();
client.getActivityProfiles(r -> r.activityId("https://example.com/activity/1")).block();

// Print the each returned activity profile id to the console
response.getBody().stream().forEach(System.out::println);
Expand All @@ -51,14 +46,12 @@ public void run(String... args) {
private void postActivityProfile() {

// Post Profile
client.postActivityProfile(r -> r.activityId("https://example.com/activity/1")

.profileId("bookmark")

.activityProfile(new ExampleState("Hello World!", Instant.now())))

client
.postActivityProfile(
r ->
r.activityId("https://example.com/activity/1")
.profileId("bookmark")
.activityProfile(new ExampleState("Hello World!", Instant.now())))
.block();

}

}
Loading
Loading