Skip to content

Commit

Permalink
Improve JSDocs. (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry authored and stephenplusplus committed Dec 11, 2017
1 parent 04d81f2 commit c4f472c
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 52 deletions.
35 changes: 28 additions & 7 deletions packages/google-cloud-dns/src/change.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ var util = require('util');
* @param {string} id ID of the change.
*
* @example
* var zone = dns.zone('zone-id');
* var change = zone.change('change-id');
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
* const zone = dns.zone('zone-id');
* const change = zone.change('change-id');
*/
function Change(zone, id) {
var methods = {
Expand All @@ -48,6 +50,11 @@ function Change(zone, id) {
* @returns {Promise<ChangeExistsResponse>}
*
* @example
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
* const zone = dns.zone('zone-id');
* const change = zone.change('change-id');
*
* change.exists(function(err, exists) {});
*
* //-
Expand Down Expand Up @@ -86,6 +93,11 @@ function Change(zone, id) {
* @returns {Promise<GetChangeResponse>}
*
* @example
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
* const zone = dns.zone('zone-id');
* const change = zone.change('change-id');
*
* change.get(function(err, change, apiResponse) {
* // `change.metadata` has been populated.
* });
Expand Down Expand Up @@ -114,13 +126,18 @@ function Change(zone, id) {
/**
* Get the metadata for the change in the zone.
*
* @resource [Changes: get API Documentation]{@link https://cloud.google.com/dns/api/v1/changes/get}
* @see [Changes: get API Documentation]{@link https://cloud.google.com/dns/api/v1/changes/get}
*
* @method Change#getMetadata
* @param {GetChangeMetadataCallback} [callback] Callback function.
* @returns {Promise<GetChangeMetadataResponse>}
*
* @example
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
* const zone = dns.zone('zone-id');
* const change = zone.change('change-id');
*
* change.getMetadata(function(err, metadata, apiResponse) {
* if (!err) {
* // metadata = {
Expand Down Expand Up @@ -180,7 +197,12 @@ util.inherits(Change, common.ServiceObject);
* @returns {Promise<CreateChangeResponse>}
*
* @example
* var config = {
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
* const zone = dns.zone('zone-id');
* const change = zone.change('change-id');
*
* const config = {
* add: {
* // ...
* }
Expand All @@ -192,13 +214,12 @@ util.inherits(Change, common.ServiceObject);
* }
* });
*
*
* //-
* // If the callback is omitted, we'll return a Promise.
* //-
* change.create(config).then(function(data) {
* var change = data[0];
* var apiResponse = data[1];
* const change = data[0];
* const apiResponse = data[1];
* });
*/
Change.prototype.create = function(config, callback) {
Expand Down
22 changes: 17 additions & 5 deletions packages/google-cloud-dns/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ util.inherits(DNS, common.Service);
* @see Zone#create
*
* @example
* var config = {
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
*
* const config = {
* dnsName: 'example.com.', // note the period at the end of the domain.
* description: 'This zone is awesome!'
* };
Expand All @@ -147,8 +150,8 @@ util.inherits(DNS, common.Service);
* // If the callback is omitted, we'll return a Promise.
* //-
* dns.createZone('my-awesome-zone', config).then(function(data) {
* var zone = data[0];
* var apiResponse = data[1];
* const zone = data[0];
* const apiResponse = data[1];
* });
*/
DNS.prototype.createZone = function(name, config, callback) {
Expand Down Expand Up @@ -220,13 +223,16 @@ DNS.prototype.createZone = function(name, config, callback) {
* @returns {Promise<GetZonesResponse>}
*
* @example
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
*
* dns.getZones(function(err, zones, apiResponse) {});
*
* //-
* // If the callback is omitted, we'll return a Promise.
* //-
* dns.getZones().then(function(data) {
* var zones = data[0];
* const zones = data[0];
* });
*/
DNS.prototype.getZones = function(query, callback) {
Expand Down Expand Up @@ -276,6 +282,9 @@ DNS.prototype.getZones = function(query, callback) {
* @returns {ReadableStream} A readable stream that emits {@link Zone} instances.
*
* @example
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
*
* dns.getZonesStream()
* .on('error', console.error)
* .on('data', function(zone) {
Expand Down Expand Up @@ -306,7 +315,10 @@ DNS.prototype.getZonesStream = common.paginator.streamify('getZones');
* @throws {error} If a zone name is not provided.
*
* @example
* var zone = dns.zone('my-zone');
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
*
* const zone = dns.zone('my-zone');
*/
DNS.prototype.zone = function(name) {
if (!name) {
Expand Down
15 changes: 13 additions & 2 deletions packages/google-cloud-dns/src/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ var format = require('string-format-obj');
* resolvers.
*
* @example
* var zone = dns.zone('my-awesome-zone');
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
* const zone = dns.zone('my-awesome-zone');
*
* var record = zone.record('a', {
* const record = zone.record('a', {
* name: 'example.com.',
* ttl: 86400,
* data: '1.2.3.4'
Expand Down Expand Up @@ -133,6 +135,15 @@ Record.fromZoneRecord_ = function(zone, type, bindData) {
* @returns {Promise<DeleteRecordResponse>}
*
* @example
* const DNS = require('@google-cloud/dns');
* const dns = new DNS();
* const zone = dns.zone('zone-id');
* const record = zone.record('a', {
* name: 'example.com.',
* ttl: 86400,
* data: '1.2.3.4'
* });
*
* record.delete(function(err, change, apiResponse) {
* if (!err) {
* // Delete change modification was created.
Expand Down

0 comments on commit c4f472c

Please sign in to comment.