From d01b3c8e49251c85cfa9c426064b841233c6c8e4 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sun, 21 Sep 2014 15:01:40 -0700 Subject: Adding Support for Assigning Attributes in F1. Adding a new interface, F1API for F1 APIs which require a valid access token. This is now used by AssessmentResultsPage to assign an attribute each time someone completes the assessment. Also adding an AttributeTool to list all attributes and assign attributes to users. --- src/com/p4square/f1oauth/F1API.java | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/com/p4square/f1oauth/F1API.java (limited to 'src/com/p4square/f1oauth/F1API.java') diff --git a/src/com/p4square/f1oauth/F1API.java b/src/com/p4square/f1oauth/F1API.java new file mode 100644 index 0000000..88801db --- /dev/null +++ b/src/com/p4square/f1oauth/F1API.java @@ -0,0 +1,44 @@ +/* + * Copyright 2014 Jesse Morgan + */ + +package com.p4square.f1oauth; + +import java.io.IOException; +import java.util.Map; + +import com.p4square.restlet.oauth.OAuthException; +import com.p4square.restlet.oauth.OAuthUser; + +/** + * F1 API methods which require an authenticated user. + * + * @author Jesse Morgan + */ +public interface F1API { + /** + * Fetch information about a user. + * + * @param user The user to fetch information about. + * @return An F1User object. + */ + F1User getF1User(OAuthUser user) throws OAuthException, IOException; + + /** + * Fetch a list of all attributes ids and names. + * + * @return A Map of attribute name to attribute id. + */ + Map getAttributeList() throws F1Exception; + + /** + * Add an attribute to the user. + * + * @param user The user to add the attribute to. + * @param attributeName The attribute to add. + * @param attribute The attribute to add. + */ + boolean addAttribute(String userId, String attributeName, Attribute attribute) + throws F1Exception; + +} -- cgit v1.2.3