dev.learning.xapi.samples.putactivityprofile.PutActivityProfileApplication Maven / Gradle / Ivy
/*
* Copyright 2016-2023 Berry Cloud Ltd. All rights reserved.
*/
package dev.learning.xapi.samples.putactivityprofile;
import dev.learning.xapi.client.XapiClient;
import dev.learning.xapi.samples.core.ExampleState;
import java.time.Instant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Sample using xAPI client to put an activity profile.
*
* @author Thomas Turrell-Croft
*/
@SpringBootApplication
public class PutActivityProfileApplication implements CommandLineRunner {
/**
* Default xAPI client. Properties are picked automatically from application.properties.
*/
@Autowired
private XapiClient client;
public static void main(String[] args) {
SpringApplication.run(PutActivityProfileApplication.class, args).close();
}
@Override
public void run(String... args) throws Exception {
// Put activity profile
client.putActivityProfile(r -> r
.activityId("https://example.com/activity/1")
.profileId("bookmark")
.activityProfile(new ExampleState("Hello World!", Instant.now())))
.block();
}
}