StudIPClient class

Provides simple-to-use access to Stud.IP's RestAPI over OAuth 1.

Constructors

StudIPClient(String oAuthBaseUrl, String consumerKey, String consumerSecret, {String? accessToken, String? accessTokenSecret, String? apiBaseUrl})
The oAuthBaseUrl points to the OAuth base url. The consumerKey and consumerSecret are the OAuth consumer key and secret. These are the three required arguments. If you already have an access token and access token secret, you can pass them in as the optional arguments accessToken and accessTokenSecret. The API endpoint can be specified using the optional argument apiBaseUrl. This eases requesting data from the API due to enabling the use of the api* methods in this class.

Properties

accessToken String
Returns the retrieved access token.
no setter
accessTokenSecret String
Returns the retrieved access token secret.
no setter
apiBaseUrl String?
The base URL for access to the RestAPI. Optional argument, but it is highly advised to specify due to enabling the proper use of all api* methods in this class.
final
client → Client
Returns the current OAuth client.
no setter
consumerKey String
Returns the set consumer key.
no setter
consumerSecret String
Returns the set consumer secret.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

apiDelete(String endpoint, {Map<String, String>? headers}) Future<String>
Returns the body of the given endpoint in the specified RestAPI after a DELETE request. To proper use, specify apiBaseUrl.
apiDeleteJson(String endpoint, {Map<String, String>? headers}) Future
Returns the body decoded as JSON of the given endpoint in the specified RestAPI after a DELETE request. To proper use, specify apiBaseUrl.
apiGet(String endpoint, {Map<String, String>? headers}) Future<String>
Returns the body of the given endpoint in the specified RestAPI after a GET request. To proper use, specify apiBaseUrl.
apiGetJson(String endpoint, {Map<String, String>? headers}) Future
Returns the body decoded as JSON of the given endpoint in the specified RestAPI after a GET request. To proper use, specify apiBaseUrl.
apiPost(String endpoint, {Map<String, String>? headers}) Future<String>
Returns the body of the given endpoint in the specified RestAPI after a POST request. To proper use, specify apiBaseUrl.
apiPostJson(String endpoint, {Map<String, String>? headers}) Future
Returns the body decoded as JSON of the given endpoint in the specified RestAPI after a POST request. To proper use, specify apiBaseUrl.
apiPut(String endpoint, {Map<String, String>? headers}) Future<String>
Returns the body of the given endpoint in the specified RestAPI after a PUT request. To proper use, specify apiBaseUrl.
apiPutJson(String endpoint, {Map<String, String>? headers}) Future
Returns the body decoded as JSON of the given endpoint in the specified RestAPI after a PUT request. To proper use, specify apiBaseUrl.
delete(String url, {Map<String, String>? headers}) Future<String>
Returns the body of the given url after a DELETE request. This process is async, thus the body is returned as a future String instance.
deleteBody(Uri uri, {Map<String, String>? headers}) Future<String>
Returns the body of the given uri after a DELETE request. This process is async, thus the body is returned as a future String instance.
deleteResponse(Uri uri, {Map<String, String>? headers}) Future<Response>
Returns the response of the given url after a DELETE request. This process is async, thus the response is returned as a future response instance.
get(String url, {Map<String, String>? headers}) Future<String>
Returns the body of the given url after a GET request. This process is async, thus the body is returned as a future String instance.
getAuthorizationUrl([String? callback]) Future<String>
The first step in the OAuth authentication process. Returns the authorization URL after it is generated. This process is async.
getBody(Uri uri, {Map<String, String>? headers}) Future<String>
Returns the body of the given uri after a GET request. This process is async, thus the body is returned as a future String instance.
getResponse(Uri uri, {Map<String, String>? headers}) Future<Response>
Returns the response of the given url after a GET request. This process is async, thus the response is returned as a future response instance.
isErrorCode(int statusCode) bool
Returns whether the given status code should be handled as a error code, thus indicating, that the session is invalid and should be renewed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post(String url, {Map<String, String>? headers}) Future<String>
Returns the body of the given url after a POST request. This process is async, thus the body is returned as a future String instance.
postBody(Uri uri, {Map<String, String>? headers}) Future<String>
Returns the body of the given uri after a POST request. This process is async, thus the body is returned as a future String instance.
postResponse(Uri uri, {Map<String, String>? headers}) Future<Response>
Returns the response of the given url after a POST request. This process is async, thus the response is returned as a future response instance.
put(String url, {Map<String, String>? headers}) Future<String>
Returns the body of the given url after a PUT request. This process is async, thus the body is returned as a future String instance.
putBody(Uri uri, {Map<String, String>? headers}) Future<String>
Returns the body of the given uri after a PUT request. This process is async, thus the body is returned as a future String instance.
putResponse(Uri uri, {Map<String, String>? headers}) Future<Response>
Returns the response of the given url after a PUT request. This process is async, thus the response is returned as a future response instance.
retrieveAccessToken(String verifierToken) Future<void>
The second step in the OAuth authentication process. A permanent access token is retrieved and saved. Requires a verifierToken, which has been generated using the URL, retrieved in getAuthorizationUrl. This process is async. After completion, Stud.IP's RestAPI can be fully accessed.
send(BaseRequest request) Future<StreamedResponse>
Returns the streamed response after executing the given request. This process is async, thus the streamed response is returned as a future streamed response instance.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited