{"id":15040005,"url":"https://github.com/gimly/fluentxapi","last_synced_at":"2025-04-10T00:07:35.997Z","repository":{"id":16724038,"uuid":"80507931","full_name":"Gimly/FluentxApi","owner":"Gimly","description":"A fluent .Net Standard library to create xApi statements and communicate with a LRS","archived":false,"fork":false,"pushed_at":"2023-09-05T19:10:00.000Z","size":160,"stargazers_count":14,"open_issues_count":4,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T00:07:27.653Z","etag":null,"topics":["dot-net","e-learning","xapi"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gimly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-01-31T09:44:53.000Z","updated_at":"2025-04-03T15:00:41.000Z","dependencies_parsed_at":"2023-01-11T19:25:28.876Z","dependency_job_id":null,"html_url":"https://github.com/Gimly/FluentxApi","commit_stats":null,"previous_names":["mindonsite/fluentxapi"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gimly%2FFluentxApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gimly%2FFluentxApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gimly%2FFluentxApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gimly%2FFluentxApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gimly","download_url":"https://codeload.github.com/Gimly/FluentxApi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131317,"owners_count":21052819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dot-net","e-learning","xapi"],"created_at":"2024-09-24T20:44:06.125Z","updated_at":"2025-04-10T00:07:35.970Z","avatar_url":"https://github.com/Gimly.png","language":"C#","readme":"# FluentxApi\nA fluent .Net Standard library to create xApi statements and communicate with a LRS\n\n![.NET Core](https://github.com/MindOnSite/FluentxApi/workflows/.NET%20Core/badge.svg)\n[![NuGet](https://img.shields.io/nuget/v/Mos.xApi.svg)](https://www.nuget.org/packages/Mos.xApi)\n\n## Installation\nAdd the NuGet package to your project using the Package Manager Console.\n\n```powershell\nPM\u003e Install-Package Mos.xApi\n```\n\n## Getting started\n\n### Creating a statement\nUse the `Statement.Create` static method to start the Statement building.\nAll the complex objects then have a fluent builder that simplifies the creation of\nthe `Statement` object.\n\n```C#\nvar newStatement =\n    Statement.Create(\n        Actor.CreateAgent(\"Example Learner\").WithMailBox(\"example.learner@adlnet.gov\"),\n        Verb.Create(\"http://adlnet.gov/expapi/verbs/attempted\").AddDisplay(\"en-US\", \"attempted\"),\n        StatementObject.CreateActivity(\"http://example.adlnet.gov/xapi/example/simpleCBT\")\n                        .AddName(\"en-US\", \"simple CBT course\")\n                        .AddDescription(\"en-US\", \"A fictious example CBT course\"))\n        .WithResult(Result.Create()\n                            .WithScore(new Score(0.95))\n                            .WithSuccess(true)\n                            .WithCompletion(true)\n                            .WithDuration(TimeSpan.FromSeconds(1234)))\n        .Build();\n```\n\nOnce the Statement has been created, it can be serialized to json using the `ToJson` method.\nThis method takes a boolean argument setting if it should be pretty printed or not.\n\n```C#\nvar json = statement.ToJson(true);\nConsole.WriteLine(json);\n```\n\n### Communication with a LRS\nAn LRS Client is also implemented in the `Mos.xApi.LrsClient` namespace. It implements an interface\ncalled `ILrsClient` and uses asynchronous methods.\n\n```C#\nusing Mos.xApi.LrsClient;\n...\n\nILrsClient lrsClient = new LrsClient(\"http://www.example.com/mylrs\");\n\nStatement statement = await lrsClient.GetStatementAsync(new Guid(\"d0371e17-4e91-46ba-924f-e78168bf0f02\"));\n\nvar statementResult = await lrsClient.FindStatement(new StatementQuery{ActivityId = new Uri(\"http://adlnet.gov/expapi/verbs/completed\")});\n\nvar statements = statementResult.Statements;\n\nif(statements.More != null){\n    var moreStatementResult = await lrsClient.FindMoreStatements(statements.More);\n}\n\nawait lrsClient.SendStatementAsync(newStatement);\n\n```\n\n### Parsing Statements from json\n\nA static method `Statement.FromJson` allows to deserialize a statement defined as a Json string.\n\n```C#\nstring jsonStatement = \"...\";\n\nvar statement = Statement.FromJson(jsonStatement);\n```\n\n## Contributing\nPlease send your pull requests to the master branch (ideally from a  feature branch in your own fork).\n\nYou can add bugs or feature requests by [creating a new item](https://github.com/MindOnSite/FluentxApi/issues/new) on the [issues page](https://github.com/MindOnSite/FluentxApi/issues/).\n\n## Credits\n\nThis project uses the following open source components\n\n- [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgimly%2Ffluentxapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgimly%2Ffluentxapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgimly%2Ffluentxapi/lists"}