dart_domainrobot_sdk 0.5.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

Dart Domainrobot API #

A dart package for easy integration of the Domainrobot API powered by InterNetX GmbH.

Table of Contents #

  1. Preamble
  2. Install And Import
  3. Usage
  4. Changelog
  5. Copyright and license

Preamble #

As this sdk is written in pure Dart, it can be used on all platforms on which dart is currently running. This includes the use of frameworks like Flutter, Angular Dart and many more. This package can also be used for command line tools or rest services compiled with dart2native.

Note: Feel free to contribute by creating pull requests or file an issue for bugs, questions and feature requests.

Install And Import #

pubspec.yaml #

Update pubspec.yaml and add the following line to your dependencies.

dependencies:
  dart_domainrobot_sdk: ^0.5.1

Import #

Import the package with:

import 'package:dart_domainrobot_sdk/dart_domainrobot_sdk.dart';

Usage #

Provider #

The package contains a DomainRobot class that is the main access to the api. Instantiate the class with your api credentials and the matching baseUrl of the api.

String userName = 'USER';
String password = 'PASSWORD';
String context = 'CONTEXT';
String baseUrl = 'URL';
var provider = DomainRobot(userName,password,context,baseUrl);

Supported API calls #

Domain tasks #

Future<Job> create(domainrobot.Domain payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<Job> update(domainrobot.Domain payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<domainrobot.Domain> info(String name, {Map<String, String> headers, Map<String, String> queryParameters});
Future<List<domainrobot.Domain>> list(Query payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<domainrobot.Domain> createAuthinfo1(String domain, {Map<String, String> headers, Map<String, String> queryParameters});
Future<void> deleteAuthinfo1(String name, {Map<String, String> headers, Map<String, String> queryParameters});
Future<void> createAuthinfo2(String domain, {Map<String, String> headers, Map<String, String> queryParameters});
Future<Job> renew(domainrobot.Domain payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<Job> transfer(domainrobot.Domain payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<void> updateStatus(domainrobot.Domain payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<List<DomainRestore>> restoreList(Query payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<Job> restore(DomainRestore payload, {Map<String, String> headers, Map<String, String> queryParameters});

Domain cancelation tasks #

Future<DomainCancelation> create(DomainCancelation payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<void> update(DomainCancelation payload, {Map<String, String> headers});
Future<void> delete(String domain, {Map<String, String> headers});
Future<DomainCancelation> info(String domain, {Map<String, String> headers});
Future<List<DomainCancelation>> list({Query payload, Map<String, String> headers, Map<String, String> queryParameters});

Contact tasks #

Future<Contact> create(Contact payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<void> update(Contact payload, {Map<String, String> headers});
Future<void> delete(int id, {Map<String, String> headers});
Future<Contact> info(int id, {Map<String, String> headers});
Future<List<Contact>> list({Query payload, Map<String, String> headers, Map<String, String> queryParameters});

Zone tasks #

Future<Zone> create(Zone payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<void> update(Zone payload, {Map<String, String> headers});
Future<void> delete(String origin, String virtualNameServer, {Map<String, String> headers});
Future<Zone> info(String origin, String virtualNameServer, {Map<String, String> headers});
Future<List<Zone>> list({Query payload, Map<String, String> headers, Map<String, String> queryParameters});
Future<Zone> import(Zone payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<void> stream(String origin, ZoneStream payload, {Map<String, String> headers, Map<String, String> queryParameters});

Certificate tasks #

Future<Certificate> realtime(Certificate payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<CertificateData> prepareOrder(CertificateData payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<Job> create(Certificate payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<Job> reissue(int id, {Certificate payload, Map<String, String> headers, Map<String, String> queryParameters});
Future<Job> delete(int id, {Map<String, String> headers});
Future<Certificate> info(int id, {Map<String, String> headers});
Future<Job> renew(int id, {Certificate payload, Map<String, String> headers, Map<String, String> queryParameters});
Future<void> commentUpdate(int id, String comment, {Map<String, String> headers,Map<String, String> queryParameters});

SslContact tasks #

Future<SslContact> create(SslContact payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<void> update(SslContact payload, {Map<String, String> headers});
Future<void> delete(int id, {Map<String, String> headers});
Future<SslContact> info(int id, {Map<String, String> headers});
Future<List<SslContact>> list({Query payload, Map<String, String> headers, Map<String, String> queryParameters});

TrustedApplication tasks #

Future<TrustedApplication> create(TrustedApplication payload, {Map<String, String> headers, Map<String, String> queryParameters});
Future<TrustedApplication> update(TrustedApplication payload, {Map<String, String> headers});
Future<void> delete(String uuid,{Map<String, String> headers});
Future<TrustedApplication> info(String uuid, {Map<String, String> headers})
Future<List<TrustedApplication>> list({Query payload, Map<String, String> headers, Map<String, String> queryParameters});

Domainstudio tasks #

Future<List<DomainEnvelope>> search(DomainEnvelopeSearchRequest payload,{Map<String, String> headers, Map<String, String> queryParameters});

Poll tasks #

Future<PollMessage> info({Map<String, String> headers});
Future<void> confirm(int id, {Map<String, String> headers});

Transferout tasks #

Future<List<TransferOut>> list({Query payload,Map<String, String> headers, Map<String, String> queryParameters});
Future<Contact> answer(String domain, TransferAnswer answer, {Map<String, String> headers, Map<String, String> queryParameters});

Models #

The package contains many classes that represent entities from the Domainrobot API. All Models can be used inside of your own project.

Handling exceptions #

If there is any error response from the API. The DomainRobotprovider will throw a DomainRobotApiException, which contains information about the error.

try {
  List<DomainEnvelope> domains = await provider.domainStudio.search(search);
} on DomainRobotApiException catch (e) {
    // Handle error from the API
    print(e.toString());
} on Exception catch (e){
    // Handle any other exception
}

Changelog #

For a detailed changelog, see the CHANGELOG.md file

MIT License

Copyright (c) 2020 InterNetX GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Changelog #

[0.5.1] - 2020-01-14

  • Update documentation

[0.5.0] - 2020-01-13

  • Add new transfer out routes
  • Add new domain routes

[0.4.0] - 2020-01-13

  • Add new certificate routes
  • Add new poll routes
  • Add new domain cancelation routes
  • Add new zone routes

[0.3.0] - 2020-01-13

  • Rename DomainRobotProvider to DomainRobot
  • Add new certificate routes
  • Add new ssl contact routes

[0.2.0] - 2020-01-10

  • Rewrite to match the Java / JS / PHP Sdk
  • Added auto generated models
  • Add CertificateClient with routes POST /_realtime and POST /_prepareOrder

[0.1.4] - 2020-01-02

  • Fix all linter problems

[0.1.3] - 2019-12-16

  • Update dependencies
  • Update README.md
  • Improve example

[0.1.2] - 2019-12-03

  • Update code doc
  • Fix bug in DomainStudioClient

[0.1.1] - 2019-11-21

  • Fix health/maintenance suggestions

[0.1.0] - 2019-11-20

  • Initial release

example/main.dart

import 'package:dart_domainrobot_sdk/dart_domainrobot_sdk.dart';
import 'package:dart_domainrobot_sdk/src/model/generated/DomainEnvelopeSearchRequest.dart';
import 'package:dart_domainrobot_sdk/src/model/generated/DomainStudioSourceInitial.dart';
import 'package:dart_domainrobot_sdk/src/model/generated/DomainStudioSources.dart';

void main(List<String> args) async {
  // The domainrobot credentials and the baseUrl
  var userName = 'USER';
  var password = 'PASSWORD';
  var context = 'CONTEXT';
  var baseUrl = 'URL';

  // Setup the provider
  var provider = DomainRobot(userName, password, context, baseUrl);

  var ctid = 'Some UUID';
  // Define the custom headers
  var headers = {
    DOMAINROBOT_HEADER_WEBSOCKET: 'SYNC',
    DOMAINROBOT_HEADER_CTID: ctid,
  };
  var search = DomainEnvelopeSearchRequest(
    searchToken: 'treehouse',
    sources: DomainStudioSources(
      initial: DomainStudioSourceInitial(
        tlds: ['com', 'net', 'de'],
      ),
    ),
  );
  try {
    var domains = await provider.domainStudio.search(search, headers: headers);
    if (domains != null && domains.isNotEmpty) {
      print('Result from the DomainStudio:');
      for (var domain in domains) {
        print(domain.domain);
      }
    }
  } on DomainRobotApiException catch (e) {
    // Handle error from the API
    print('Got http status > 299');
    print(e.toString());
  } on Exception catch (e) {
    // Handle any other exception
    print('Unexpected error while communicating with the api.');
    print(e.toString());
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dart_domainrobot_sdk: ^0.5.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dart_domainrobot_sdk/dart_domainrobot_sdk.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
30
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
basic_utils ^2.4.7 2.4.8
http ^0.12.0+2 0.12.0+4
json_annotation >=2.0.0 <=3.0.1 3.0.1
logging ^0.11.3+2 0.11.4
Transitive dependencies
asn1lib 0.6.0
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.4
http_parser 3.1.3
intl 0.16.1
meta 1.1.8
path 1.6.4
pointycastle 1.0.2
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner ^1.6.0
json_serializable ^3.2.2
pedantic ^1.9.0 1.9.0
test ^1.6.0