StudIPClient constructor

StudIPClient(
  1. String oAuthBaseUrl,
  2. String consumerKey,
  3. String consumerSecret, {
  4. String? accessToken,
  5. String? accessTokenSecret,
  6. 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.

Implementation

StudIPClient(
  String oAuthBaseUrl,
  String consumerKey,
  String consumerSecret, {
  String? accessToken,
  String? accessTokenSecret,
  this.apiBaseUrl,
})  : _clientCredentials =
          oauth1.ClientCredentials(consumerKey, consumerSecret),
      _platform = oauth1.Platform(
        '$oAuthBaseUrl/oauth/request_token',
        '$oAuthBaseUrl/oauth/authorize',
        '$oAuthBaseUrl/oauth/access_token',
        oauth1.SignatureMethods.hmacSha1,
      ) {
  _auth = oauth1.Authorization(_clientCredentials, _platform);
  if (accessToken != null && accessTokenSecret != null) {
    _credentials = oauth1.Credentials(accessToken, accessTokenSecret);
    _client = oauth1.Client(
      _platform.signatureMethod,
      _clientCredentials,
      _credentials,
    );
  }
}