Skip to content

Commit

Permalink
Update docs and files to distribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis committed May 15, 2014
1 parent e73f1a3 commit c4f340d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
33 changes: 16 additions & 17 deletions familysearch-javascript-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -3130,6 +3130,13 @@ define('discussions',[
* @return {String} Discussion URL
*/

/**
* @ngdoc property
* @name discussions.types:constructor.DiscussionRef#attribution
* @propertyOf discussions.types:constructor.DiscussionRef
* @returns {Attribution} {@link attribution.types:constructor.Attribution Attribution} object
*/

/**
* @ngdoc property
* @name discussions.types:constructor.DiscussionRef#$personId
Expand All @@ -3145,12 +3152,9 @@ define('discussions',[
* @return {String} URL of this discussion reference; _NOTE_ however, that individual discussion references cannot be read
*/
$getDiscussionRefUrl: function() {
// TODO change this once links is an associative array (last checked 4/2/14)
return helpers.removeAccessToken(maybe(helpers.find(this.links, {title: 'Discussion Reference'})).href);
return helpers.removeAccessToken(maybe(maybe(this.links)['discussion-reference']).href);
},

// TODO add attribution when that is available (last checked 4/2/14)

/**
* @ngdoc function
* @name discussions.types:constructor.DiscussionRef#$getDiscussionUrl
Expand All @@ -3171,13 +3175,12 @@ define('discussions',[
* @return {Object} promise for the {@link discussions.functions:getDiscussion getDiscussion} response
*/
$getDiscussion: function() {
// TODO remove this.resourceId if resourceId ends up being discussion reference id
return exports.getDiscussion(this.$getDiscussionUrl() || this.resourceId);
},

/**
* @ngdoc function
* @name discussions.types:constructor.DiscussionRef#$setDiscussionUrl
* @name discussions.types:constructor.DiscussionRef#$setDiscussion
* @methodOf discussions.types:constructor.DiscussionRef
* @function
* @param {Discussion|string} discussion Discussion object or discussion url or discussion id
Expand All @@ -3192,7 +3195,6 @@ define('discussions',[
this.resource = helpers.removeAccessToken(discussion);
}
else {
// TODO if resourceId is a discussion ref id instead of a discussion id, we'll need to set a $discussionId variable
this.resourceId = discussion;
}
//noinspection JSValidateTypes
Expand Down Expand Up @@ -3222,16 +3224,14 @@ define('discussions',[
return helpers.chainHttpPromises(
plumbing.getUrl('person-discussion-references-template', null, {pid: self.$personId}),
function(url) {
// TODO if resourceId is a discussion ref id instead of a discussion id, we need to use $discussionId
if (!self.resource && self.resourceId) {
// the discovery resource is guaranteed to be set due to the getUrl statement
self.resource = helpers.getUrlFromDiscoveryResource(globals.discoveryResource, 'discussion-template', {did: self.resourceId});
}
// TODO save discussion references in new json serialization format when that works
var payload = {
persons: [{
id: self.$personId,
'discussion-references' : [ self.resource ]
'discussion-references' : [ { resource: self.resource } ]
}]
};
if (changeMessage) {
Expand All @@ -3240,12 +3240,12 @@ define('discussions',[
var headers = {'Content-Type': 'application/x-fs-v1+json', 'X-FS-Feature-Tag': 'discussion-reference-json-fix'};
return plumbing.post(url, payload, headers, opts, function(data, promise) {
if (!self.$getDiscussionRefUrl()) {
// TODO change this once links is an associative array
// TODO also set id when that field has been added
self.links = [{
href: promise.getResponseHeader('Location'),
title: 'Discussion Reference'
}];
self.links = {
'discussion-reference': {
href: promise.getResponseHeader('Location'),
title: 'Discussion Reference'
}
};
}
return self.$getDiscussionRefUrl();
});
Expand Down Expand Up @@ -3391,7 +3391,6 @@ define('discussions',[
function(url) {
var payload = {discussions: [{ comments: [ self ] }] };
return plumbing.post(url, payload, {'Content-Type' : 'application/x-fs-v1+json'}, opts, function(data, promise) {
// TODO currently when creating discussion comments, X-ENTITY-ID and Location headers aren't returned (last checked 4/2/14)
if (!self.id) {
self.id = promise.getResponseHeader('X-ENTITY-ID');
}
Expand Down
2 changes: 1 addition & 1 deletion familysearch-javascript-sdk.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/docs-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ NG_DOCS={
"type": "function",
"moduleName": "discussions",
"shortDescription": "Reference to a discussion on a person.",
"keywords": "$delete $getdiscussion $getdiscussionrefurl $getdiscussionurl $personid $save $setdiscussionurl _discussion_ _note_ _refresh_ access api attached attributes change changemessage create created creating data delete deleted deletediscussionref details discussion discussionref discussions editable example function functions getdiscussion http individual init message net note object optional options opts parameter pass person promise property read reference references resource resourceid response set token types updated url"
"keywords": "$delete $getdiscussion $getdiscussionrefurl $getdiscussionurl $personid $save $setdiscussion _discussion_ _note_ _refresh_ access api attached attributes attribution change changemessage create created creating data delete deleted deletediscussionref details discussion discussionref discussions editable example function functions getdiscussion http individual init message net note object optional options opts parameter pass person promise property read reference references resource resourceid response set token types updated url"
},
{
"section": "api",
Expand Down
10 changes: 7 additions & 3 deletions partials/api/discussions.types.constructor.DiscussionRef.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ <h4 id="usage_parameters">Parameters</h4><table class="variables-matrix table ta
(note however that individual discussion references cannot be read).</p>
</div></td></tr></table></div>
</li>
<li><h3 id="methods_$setdiscussionurl">$setDiscussionUrl(discussion)</h3>
<div class="$setdiscussionurl"><h5 id="methods_$setdiscussionurl_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>discussion</td><td><a href="" class="label type-hint type-hint-discussion">Discussion</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="discussions-types-page discussions-types-constructor-discussionref-setdiscussionurl-page"><p>Discussion object or discussion url or discussion id</p>
</div></td></tr></tbody></table><h5 id="methods_$setdiscussionurl_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-discussionref">DiscussionRef</a></td><td><div class="discussions-types-page discussions-types-constructor-discussionref-setdiscussionurl-page"><p>this discussion ref</p>
<li><h3 id="methods_$setdiscussion">$setDiscussion(discussion)</h3>
<div class="$setdiscussion"><h5 id="methods_$setdiscussion_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>discussion</td><td><a href="" class="label type-hint type-hint-discussion">Discussion</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="discussions-types-page discussions-types-constructor-discussionref-setdiscussion-page"><p>Discussion object or discussion url or discussion id</p>
</div></td></tr></tbody></table><h5 id="methods_$setdiscussion_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-discussionref">DiscussionRef</a></td><td><div class="discussions-types-page discussions-types-constructor-discussionref-setdiscussion-page"><p>this discussion ref</p>
</div></td></tr></table></div>
</li>
</ul>
Expand All @@ -57,6 +57,10 @@ <h4 id="usage_parameters">Parameters</h4><table class="variables-matrix table ta
<div class="$personid"><h5 id="properties_$personid_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">String</a></td><td><div class="discussions-types-page discussions-types-constructor-discussionref-personid-page"><p>Id of the person to whom this discussion is attached</p>
</div></td></tr></table></div>
</li>
<li><h3 id="properties_attribution">attribution</h3>
<div class="attribution"><h5 id="properties_attribution_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-attribution">Attribution</a></td><td><div class="discussions-types-page discussions-types-constructor-discussionref-attribution-page"><p><a href="#/api/attribution.types:constructor.Attribution">Attribution</a> object</p>
</div></td></tr></table></div>
</li>
<li><h3 id="properties_resource">resource</h3>
<div class="resource"><h5 id="properties_resource_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">String</a></td><td><div class="discussions-types-page discussions-types-constructor-discussionref-resource-page"><p>Discussion URL</p>
</div></td></tr></table></div>
Expand Down

0 comments on commit c4f340d

Please sign in to comment.