C# Class gdapi.Client

Represents the Client which handles all communication to the API.
显示文件 Open project: godaddy/gdapi-csharp Class Usage Examples

Public Methods

Method Description
Client ( string base_url, string access_key, string secret_key ) : System.Collections.Generic

Creates a new Client.

create ( string collectionType, Resource resource ) : Resource

Creates a new Resource.

delete ( string collectionType, Resource resource ) : Resource

Deletes a Resource

doAction ( string actionUrl ) : Resource

Performs an action from a Resource and returns the resulting Resource.

doAction ( string actionUrl, Resource inputResource ) : Resource

Performs an action from an action url and an input resource and returns the resulting Resource

fetchLinkAsCollection ( Resource resource, string linkName ) : Collection

Fetches a link from the API as a Collection.

fetchLinkAsResource ( Resource resource, string linkName ) : Resource

Fetches a link from the API as a Resource.

getBaseUrl ( ) : string

Gets the base url of the Client

getCollection ( string resourceType ) : Collection

Returns an unfiltered Collection from the API

getCollection ( string resourceType, CollectionFilter collectionFilter ) : Collection

Returns a filtered Collection from the API

getNetworkCredential ( ) : NetworkCredential

Returns the current NetworkCredentials used by the Client

getResourceById ( string collectionType, string resourceId ) : Resource

Returns a Resource by an id.

save ( string collectionType, Resource resource ) : Resource

Saves a Resource

Private Methods

Method Description
getCollectionByRequest ( gdapi webRequest ) : Collection

Returns a Collection from a WebRequest.

getResourceByRequest ( gdapi webRequest ) : Resource

Returns a Resource from a WebRequest

Method Details

Client() public method

Creates a new Client.
public Client ( string base_url, string access_key, string secret_key ) : System.Collections.Generic
base_url string Base Url of the API
access_key string Access Key to the API
secret_key string Secret Key to the API
return System.Collections.Generic

create() public method

Creates a new Resource.
public create ( string collectionType, Resource resource ) : Resource
collectionType string Collection type to add the resource to
resource Resource Resource to add to the Collection
return Resource

delete() public method

Deletes a Resource
public delete ( string collectionType, Resource resource ) : Resource
collectionType string Collection type to delete the resource from
resource Resource Resource to delete
return Resource

doAction() public method

Performs an action from a Resource and returns the resulting Resource.
public doAction ( string actionUrl ) : Resource
actionUrl string Action URL to perform.
return Resource

doAction() public method

Performs an action from an action url and an input resource and returns the resulting Resource
public doAction ( string actionUrl, Resource inputResource ) : Resource
actionUrl string Action URL to perform.
inputResource Resource Input Resource to use send with the action URL.
return Resource

fetchLinkAsCollection() public method

Fetches a link from the API as a Collection.
public fetchLinkAsCollection ( Resource resource, string linkName ) : Collection
resource Resource Resource object which contains links.
linkName string Link name to return.
return Collection

fetchLinkAsResource() public method

Fetches a link from the API as a Resource.
public fetchLinkAsResource ( Resource resource, string linkName ) : Resource
resource Resource Resource object which contains links.
linkName string Link name to return.
return Resource

getBaseUrl() public method

Gets the base url of the Client
public getBaseUrl ( ) : string
return string

getCollection() public method

Returns an unfiltered Collection from the API
public getCollection ( string resourceType ) : Collection
resourceType string Type of the Collection to return.
return Collection

getCollection() public method

Returns a filtered Collection from the API
public getCollection ( string resourceType, CollectionFilter collectionFilter ) : Collection
resourceType string Type of the Collection to return.
collectionFilter CollectionFilter
return Collection

getNetworkCredential() public method

Returns the current NetworkCredentials used by the Client
public getNetworkCredential ( ) : NetworkCredential
return System.Net.NetworkCredential

getResourceById() public method

Returns a Resource by an id.
public getResourceById ( string collectionType, string resourceId ) : Resource
collectionType string Collection to pull the Resource from
resourceId string Id of the Resource to pull
return Resource

save() public method

Saves a Resource
public save ( string collectionType, Resource resource ) : Resource
collectionType string Collection type to save the resource to
resource Resource Resource to save
return Resource