GithubHelp home page GithubHelp logo

dyn-java's Introduction

Dyn SDK for Java

NOTE: This SDK is brand new - we welcome your feedback! Please reach out via pull request or GitHub issue.

Using the library is super-easy with Maven:

<dependency>
    <groupId>com.dyn</groupId>
    <artifactId>dyn-client</artifactId>
    <version>1.0.0</version>
</dependency>

Making DNS Updates as easy as:

// Configure/Authenticate the Dyn Java client instance
ProviderMetadata meta = Providers.withId("dyn-traffic");
ContextBuilder ctx = ContextBuilder.newBuilder(meta);
ctx.credentials("yourcustomer:youruser", "yourpass");
DynTrafficApi dyn = ctx.buildApi(DynTrafficApi.class);

// obtain Record and Zone API instances to make changes
ZoneApi zone = dyn.getZoneApi();
RecordApi records = dyn.getRecordApiForZone("example.com");

// submit the changes
records.scheduleCreate(CreateRecord.<CNAMEData> builder().type("CNAME")
.fqdn("myapp.example.com.")
.rdata(CNAMEData.cname("example.herokuapp.com.")).build());

// publish the changes
zone.publish("example.com");

Working with the Message API is as easy as:

// Configure/Authenticate the Dyn Java Messaging client instance
ProviderMetadata meta = Providers.withId("dyn-messaging");
ContextBuilder ctx = ContextBuilder.newBuilder(meta);

ctx.credentials(/* intentionally blank -> */"", "yourapikey");
DynMessagingApi dyn = ctx.buildApi(DynMessagingApi.class);

SendMailApi send = dyn.getSendMailApi();
System.out.println("send : "
		+ send.sendMessage("[email protected]",
				"[email protected]", "the subject", "hi text",
				"<p>hi html</p>", "[email protected]",
				"[email protected]", null));

AccountsApi accounts = dyn.getAccountsApi();

System.out.println("accounts list : " + accounts.list(0));
System.out.println("accounts xheaders : " + accounts.getXHeaders());

RecipientsApi recipients = dyn.getRecipientsApi();

System.out.println("recipient status : "
		+ recipients.status("[email protected]"));
System.out.println("recipient activate : "
		+ recipients.activate("[email protected]"));

Map<String, ReportApi> apis = ImmutableMap
		.<String, ReportApi> builder()
		.put("bounces", dyn.getBounceReportApi())
		.put("clicks", dyn.getClicksReportApi())
		.put("complaints", dyn.getComplaintsReportApi())
		.put("delivered", dyn.getDeliveredReportApi())
		.put("issues", dyn.getIssuesReportApi())
		.put("opens", dyn.getOpensReportApi())
		.put("sent", dyn.getSentReportApi()).build();

// test the regular report functionality
for (Map.Entry<String, ReportApi> entry : apis.entrySet()) {
	String name = entry.getKey();
	ReportApi api = entry.getValue();

	System.out.println(name + " list : "
			+ api.list("2014-01-01", "2014-11-01", 0));
	System.out.println(name + " count : "
			+ api.count("2014-01-01", "2014-11-01"));
}

Map<String, UniqueReportApi> unique = ImmutableMap
		.<String, UniqueReportApi> builder()
		.put("clicks", dyn.getClicksReportApi())
		.put("opens", dyn.getOpensReportApi()).build();

// unique report functionality
for (Map.Entry<String, UniqueReportApi> entry : unique.entrySet()) {
	String name = entry.getKey();
	UniqueReportApi api = entry.getValue();

	System.out.println(name + " list unique : "
			+ api.listUnique("2014-01-01", "2014-11-01", 0));
	System.out.println(name + " count unique : "
			+ api.countUnique("2014-01-01", "2014-11-01"));
}

API Endpoints Supported

  • Traffic - Session API: create/destroy
  • Traffic - Record API: AAAA A CNAME DNSKEY DS KEY LOC MX NS PTR RP SOA SRV TXT
  • Traffic - Zone API: list/create/get/update/delete/publish/freeze/thaw
  • Traffic - Geo/GeoRegion API: get/list
  • Messaging - All Endpoints Supported

Known Issues

  • None yet

License

  • Apache 2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.