GithubHelp home page GithubHelp logo

andrewdavey / assembly-client-dotnet Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 230 KB

A .NET client for the Assembly Platform

Home Page: http://developers.assembly.education

License: MIT License

C# 100.00%

assembly-client-dotnet's Introduction

Assembly Client

Assembly .NET Client supports .NET 4.5 and above.

Installation

If using Visual Studio NuGet, ensure prerelease is checked in your NuGet Client.

Install the NuGet package into your Project:

Install-Package assembly-client-dotnet
Install-Package Newtonsoft.Json

Usage

Some examples of how to pull information from the Assembly Platform API using the client.

var config = new ApiConfiguration()
{
    Token = "my_oauth_access_token",
    RefreshToken = "my_oauth_refresh_token",
    ClientId = "my_client_id",
    ClientSecret = "my_client_secret"
};

// To connect to the live Platform, rather than the Sandbox environment, use simply: new ApiClient();
var client = new ApiClient(AssemblyEnvironment.Sandbox);
client.Configure(config);


// -----------------------------------------------------------------

// Registration Groups

// Fetch registration groups, filtered by a year group.
var regGroups = await client.RegistrationGroups.List(yearCode: "7");

foreach (var group in regGroups)
{
    Console.WriteLine($"Group Name: {group.Name}");
}

// -----------------------------------------------------------------

// Teaching Groups

// Fetch all teaching groups (you may know these as classes) for the mathematics subject code.
var mathsGroups = await client.TeachingGroups.List(subjectCode: "MA");

foreach (var group in mathsGroups)
{
    Console.WriteLine($"Group Name: {group.Name}");
}

// You can also apply a date filter to get, say, teaching groups from last academic year or for another specific range of time.
var mathsGroupsFiltered = await client.TeachingGroups.List(startDate: DateTime.Parse("2016-09-01"), endDate: DateTime.Parse("2017-07-31"));

// Fetch all the students for this teaching group.
var mathsStudents = await mathsGroups.First().Students();

foreach (var student in mathsStudents)
{
    Console.WriteLine($"{student.LastName}, {student.FirstName} ({student.YearCode})");
}

// -----------------------------------------------------------------

// Students

// Fetch all students filtered by year code/year group
var year7Students = await client.Students.List(yearCode: "7", demographics: true);

foreach (var student in year7Students)
{
    Console.WriteLine($"{student.LastName}, {student.FirstName} ({student.YearCode})");
}

// -----------------------------------------------------------------

// Year Groups

// Fetch all the year groups.
var yearGroups = await client.YearGroups.List();

foreach (var yearGroup in yearGroups)
{
    Console.WriteLine($"{yearGroup.Code} {yearGroup.Name}");
}

// Fetch the students for this particular year group.
var yearGroupStudents = await yearGroups.First().Students();

// -----------------------------------------------------------------

// Academic Years

// Fetch all the academic years
var academicYears = await client.AcademicYears.List();

// View the terms for this academic year
var firstYearTerms = academicYears.First().Terms;

// -----------------------------------------------------------------

// Staff Members

var staffMembers = await client.StaffMembers.All();

foreach (var staffMember in staffMembers)
{
    Console.WriteLine($"{staffMember.LastName}, {staffMember.FirstName} ({staffMember.IsTeachingStaff})");
}

// -----------------------------------------------------------------

// Subjects

// Fetch all the subjects
var subjects = await client.Subjects.List();

// -----------------------------------------------------------------

// Aspects

// Fetch all the aspects
var aspects = await client.Aspects.List();

// -----------------------------------------------------------------

// Assessment Points

// Fetch all the assessment points
var assessmentPoints = await client.AssessmentPoints.List();

// -----------------------------------------------------------------

// Assessments

// Fetch all the assessments
var assessments = await client.Assessments.List();

// -----------------------------------------------------------------

// Grade Sets

// Fetch all the grade sets
var gradeSets = await client.GradeSets.List();

// -----------------------------------------------------------------

// Results

// Write a set of results in one batch (maximum of 50 results at one time)
var resultsBatch = new ResultsBatch
{
    AspectId = 1,
    AssessmentId = 1,
    AssessmentPointRank = 1,
    SubjectId = 1
};
resultsBatch.AddResult(studentId: 1, gradeId: 1);
resultsBatch.AddResult(studentId: 2, gradeId: 1);

var response = await client.Results.WriteResults(resultsBatch);

// Fetch all the results for a given list of students
var studentIds = new List<int> {1, 2, 3};
var results = await client.Results.List(studentIds);

// -----------------------------------------------------------------

// School Details

// Fetch the school details
var schoolDetails = await client.School.Details();

Development

Install dotnet core: https://www.microsoft.com/net/core

Restore the packages dotnet restore

To run the tests dotnet test

If on OSX run dotnet test -f netstandard1.1

To run the tests continuously dotnet watch test

Build and Release are automatically run on commits to master (and accepted Pull Requests).

Branch commits and pull requests are automatically released under pre release versions to: https://www.myget.org/F/assembly-client-dotnet/api/v3/index.json

If you want to test before releasing then you can use this feed to access development versions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.