-
Notifications
You must be signed in to change notification settings - Fork 4
add voidStatement and getStatementIterator to xApiEnhancedClient #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f9d6119
add voidStatement and getStatementIterator to xApiEnhancedClient
Selindek 06e2945
more test, more coverage
Selindek c1bff81
even more test, even more coverage
Selindek d7d0bd3
stuffz
Selindek a4f8ac9
Update xapi-client/src/test/java/dev/learning/xapi/client/XapiClientT…
thomasturrell b473a5f
Remove unused imports
fe6788e
fixup
Selindek bad9f81
fcs
Selindek 3724dca
tip
172746e
Update README.md
thomasturrell 0294839
Update GetStatementIteratorApplication.java
thomasturrell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>dev.learning.xapi.samples</groupId> | ||
| <artifactId>xapi-samples-build</artifactId> | ||
| <version>1.1.5-SNAPSHOT</version> | ||
| </parent> | ||
| <artifactId>get-statement-iterator</artifactId> | ||
| <name>Get xAPI StatementIterator Sample</name> | ||
| <description>Get xAPI StatementIterator</description> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>dev.learning.xapi</groupId> | ||
| <artifactId>xapi-client</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>dev.learning.xapi.samples</groupId> | ||
| <artifactId>core</artifactId> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
51 changes: 51 additions & 0 deletions
51
...rc/main/java/dev/learning/xapi/samples/getstatements/GetStatementIteratorApplication.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright 2016-2023 Berry Cloud Ltd. All rights reserved. | ||
| */ | ||
|
|
||
| package dev.learning.xapi.samples.getstatements; | ||
|
|
||
| import dev.learning.xapi.client.XapiClient; | ||
| import dev.learning.xapi.model.Verb; | ||
| 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 get multiple statements as StatementIterator. | ||
| * | ||
| * @author Thomas Turrell-Croft | ||
| * @author István Rátkai (Selindek) | ||
| */ | ||
| @SpringBootApplication | ||
| public class GetStatementIteratorApplication implements CommandLineRunner { | ||
|
|
||
| /** | ||
| * Default xAPI client. Properties are picked automatically from application.properties. | ||
| */ | ||
| @Autowired | ||
| private XapiClient client; | ||
|
|
||
| public static void main(String[] args) { | ||
| SpringApplication.run(GetStatementIteratorApplication.class, args).close(); | ||
| } | ||
|
|
||
| @Override | ||
| public void run(String... args) throws Exception { | ||
|
|
||
| // Get Statements as StatementIterator | ||
| var statements = client.getStatementIterator().block(); | ||
|
|
||
| // Print the returned statements to the console | ||
| statements.toStream().forEach(s -> System.out.println(s)); | ||
|
|
||
| // Get Statements with Verb filter as StatementIterator | ||
| var filteredStatements = | ||
| client.getStatementIterator(r -> r.verb(Verb.ATTEMPTED)).block(); | ||
|
|
||
| // Print the returned statements to the console | ||
| filteredStatements.toStream().forEach(s -> System.out.println(s)); | ||
|
|
||
| } | ||
|
|
||
| } |
5 changes: 5 additions & 0 deletions
5
samples/get-statement-iterator/src/main/resources/application.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| xapi.client.username = admin | ||
| xapi.client.password = password | ||
| xapi.client.baseUrl = https://example.com/xapi/ | ||
|
|
||
| spring.codec.max-in-memory-size=1MB |
2 changes: 2 additions & 0 deletions
2
samples/get-statement-with-attachment/src/main/resources/application.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| xapi.client.username = admin | ||
| xapi.client.password = password | ||
| xapi.client.baseUrl = https://example.com/xapi/ | ||
|
|
||
| spring.codec.max-in-memory-size=1MB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
samples/get-statements/src/main/resources/application.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| xapi.client.username = admin | ||
| xapi.client.password = password | ||
| xapi.client.baseUrl = https://example.com/xapi/ | ||
|
|
||
| spring.codec.max-in-memory-size=1MB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.