studip 2.1.3 copy "studip: ^2.1.3" to clipboard
studip: ^2.1.3 copied to clipboard

A simple-to-use wrapper for Stud.IP's RestAPI service in Dart.

example/studip_example.dart

import 'dart:developer';
import 'dart:io';

import 'package:studip/studip.dart' as studip;

/// How to retrieve data very simply
void main() {
  // Initialize client
  final client = studip.StudIPClient(
    'https://studip.uni-passau.de/studip/dispatch.php/api',
    'CONSUMER_KEY',
    'CONSUMER_SECRET',
    apiBaseUrl: 'https://studip.uni-passau.de/studip/api.php/',
  );
  client
      .getAuthorizationUrl('example://oauth_callback')
      .then((url) {
        // Get verifier by calling the returned link and approve access
        log('Open URL in browser: $url');
        final uri = stdin.readLineSync()!;
        // FlutterWebAuth2.authenticate(url: url, callbackUrlScheme: 'example');

        // Retrieve permanent token
        final verifier = Uri.parse(uri).queryParameters['oauth_verifier'] ?? '';
        return client.retrieveAccessToken(verifier);
      })
      .then((v) => client.apiGetJson('user'))
      .then((dynamic decoded) {
        // Example parsing of response
        log('${decoded['name']['formatted']}');
      });
}
1
likes
160
pub points
44%
popularity

Publisher

verified publisherfemtopedia.de

A simple-to-use wrapper for Stud.IP's RestAPI service in Dart.

Repository (GitHub)
View/report issues

Topics

#rest #studip #web

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

http, oauth1

More

Packages that depend on studip