getLink() public method

Gets the current link if it exists.
public getLink ( string name ) : string
name string Link to fetch
return string
Example #1
0
 /// <summary>
 /// Fetches a link from the API as a Collection.
 /// </summary>
 /// <param name="resource">Resource object which contains links.</param>
 /// <param name="linkName">Link name to return.</param>
 /// <exception cref="NotFoundException"/>
 /// <returns>Collection from Resource</returns>
 public Collection fetchLinkAsCollection(Resource resource, string linkName)
 {
     if (resource.hasLink(linkName))
     {
         gdapi.WebRequest rRequestor = new gdapi.WebRequest(this);
         rRequestor.setType("GET");
         rRequestor.setUrl(resource.getLink(linkName));
         return(getCollectionByRequest(rRequestor));
     }
     else
     {
         return(null);
     }
 }
Example #2
0
 /// <summary>
 /// Fetches a link from the API as a Resource.
 /// </summary>
 /// <param name="resource">Resource object which contains links.</param>
 /// <param name="linkName">Link name to return.</param>
 /// <exception cref="NotFoundException"/>
 /// <returns>Resource from Resource</returns>
 public Resource fetchLinkAsResource(Resource resource, string linkName)
 {
     if (resource.hasLink(linkName))
     {
         gdapi.WebRequest rRequestor = new gdapi.WebRequest(this);
         rRequestor.setType("GET");
         rRequestor.setUrl(resource.getLink(linkName));
         return getResourceByRequest(rRequestor);
     }
     else
     {
         return null;
     }
 }