Logical Labs Rackspace Cloud Files

API Docs for: 1.0.1
Show:

Client Class

Module: Readme

Objects of this class represent a connection to the Rackspace Cloudfiles service.

Methods

authenticate

(
  • params
)
Client

Available since 1.0.0

Authenticates the client. This is an async call that returns the results in a callback.

This function returns the Client object itself, so that you can chain this function to the createClient function.

Parameters:

  • params Object
    • [username] String optional

      The username to be used for the connection. The client remembers the last username specified, either at its creation or at the last call to this function, so this parameter is optional if you'd like to use the previous value.

    • [apiKey] String optional

      The API key to be used for the connection. The client remembers the last API key specified, either at its creation or at the last call to this function, so this parameter is optional if you'd like to use the previous value.

    • [region] String optional

      The region to be used for this client. This parameter is optional; the client remembers the last value specified, either at its creation or at the last call to this function. If this value has never been specified, the account's default region will be used.

    • success Function

      Callback to call in case of success. The function receives a dictionary as parameter, which holds the following keys:

      • token: the authentication token as a string
      • tokenExpiration: the token expiration as a date
      • defaultRegion: the account's default region as a string
      • storageUrl: the storage URL as a string
      • cdnUrl: the CDN URL as a string
      • rawResponse: the complete response as a JSON formatted string
    • error Function

      Callback to call in case of error.

Returns:

createContainer

(
  • params
)
Void

Available since 1.0.0

Creates a container with the given name. This is an async call that returns the results in a callback.

Parameters:

  • params Object
    • name String

      Name of the container.

    • [metadata] Object optional

      Metadata as key/value pairs, to be added to the container.

    • success Function

      Callback to call in case of success.

    • error Function

      Callback to call in case of error.

Returns:

Void:

deleteContainer

(
  • params
)
Void

Available since 1.0.0

Deletes a container. This is an async call that returns the results in a callback.

Parameters:

  • params Object
    • [name] String optional

      Name of the container. Optional, but either this, or the container parameter must be specified.

    • [container] Container optional

      A Container object. Optional, but either this, or the name parameter must be specified.

    • success Function

      Callback to call in case of success.

    • error Function

      Callback to call in case of error.

Returns:

Void:

download

(
  • params
)
Void

Available since 1.0.0

Downloads an object. This function is functionally equivalent to the download function. The difference is that you don't need to have an Object object to use this function as you can specify the object's name as a string.

Parameters:

  • params Object
    • objectName String

      Name of the object to download.

    • file Ti.File

      The file into which to download the content of the object.

    • [containerName] String optional

      Name of the container to download from. Optional, but either this, or the container parameter must be specified.

    • [container] Container optional

      The container to download from. Optional, but either this, or the containerName parameter must be specified.

    • [ifMatch] String optional

      A value for the If-Match header defined by RFC-2616.

    • [ifNoneMatch] String optional

      A value for the If-None-Match header defined by RFC-2616.

    • [ifModifiedSince] String optional

      A value for the If-Modified-Since header defined by RFC-2616.

    • [ifUnmodifiedSince] String optional

      A value for the If-Unmodified-Since header defined by RFC-2616.

    • [range] String optional

      A value for the Range header defined by RFC-2616. Cloud Files does not support the full specification for this header, but basic support is provided. See the Rackspace documentation for more detail.

    • success Function

      Callback to call in case of success.

    • error Function

      Callback to call in case of error.

Returns:

Void:

getAccountMetadata

(
  • params
)
Void

Available since 1.0.0

Retrieves the metadata associated with this account. This is an async call that will report the result via callbacks.

Parameters:

  • params Object
    • success Function

      Callback to call in case of success.

    • error Function

      Callback to call in case of error.

Returns:

Void:

getCdnContainers

(
  • params
)
Void

Available since 1.0.0

Retrieves the CDN-enabled containers associated with this account. This is an async call that returns the results in a callback.

Parameters:

  • params Object
    • success Function

      Callback to call in case of success. The function receives a dictionary as parameter. The dictionary stores an array of Containers under the containers key.

    • error Function

      Callback to call in case of error.

    • [limit] Number optional

      The maximum number of containers to return. By default there is no limit, all the containers will be returned.

    • [pageSize] Number optional

      The maximum number of containers to request from the server in one query. If pageSize is less than limit and the number of available containers, then the module will make multiple calls to the server. The default value is 10,000.

    • [marker] String optional

      The query will return object names greater than the specified marker.

Returns:

Void:

getContainer

(
  • name
)
Container

Available since 1.0.0

Returns a Container object based on name. Note that this function does not verify that the container in fact exists on the server. Use the getContainers function to retrieve the containers from the server.

Parameters:

  • name String

    Name of the container

Returns:

getContainers

(
  • params
)
Void

Available since 1.0.0

Retrieves the containers associated with this account. This is an async call that returns the results in a callback.

Parameters:

  • params Object
    • success Function

      Callback to call in case of success. The function receives a dictionary as parameter. The dictionary stores an array of Containers under the containers key.

    • error Function

      Callback to call in case of error.

    • [limit] Number optional

      The maximum number of containers to return. By default there is no limit, all the containers will be returned.

    • [pageSize] Number optional

      The maximum number of containers to request from the server in one query. If pageSize is less than limit and the number of available containers, then the module will make multiple calls to the server. The default value is 10,000.

    • [marker] String optional

      The query will return object names greater than the specified marker.

Returns:

Void:

updateAccountMetadata

(
  • params
  • metadata
)
Void

Available since 1.0.0

Updates the metadata associated with this account. This is an async call that returns the results in a callback.

Parameters:

  • params Object
    • success Function

      Callback to call in case of success.

    • error Function

      Callback to call in case of error.

  • metadata Object

    A dictionary that holds the metadata as key/value pairs.

Returns:

Void:

Properties

apiKey

String read-only

Available since 1.0.0

The API key used for authentication (if not specified at the next call of the authenticate function).

autoAuth

String

Available since 1.0.0

Defines whether auto-authentication is turned on. Default is true. See the "Automatic (Re)Authentication" section of the Readme for more details.

containerCount

Number read-only

Available since 1.0.0

The number of containers that belong to the account.

Call the getAccountMetadata function to refresh this property.

metadata

Dictionary read-only

Available since 1.0.0

Metadata associated with the account.

Call the getAccountMetadata function to refresh this property.

objectCount

Number read-only

Available since 1.0.0

The number of objects that belong to the account.

Call the getAccountMetadata function to refresh this property.

region

String read-only

Available since 1.0.1

The region used for this connection. If no region was specified with either the authenticate or the createClient function call, this property will return the default region of the account once authentication completes.

totalBytesUsed

Number read-only

Available since 1.0.0

Total bytes used by the account.

Call the getAccountMetadata function to refresh this property.

username

String read-only

Available since 1.0.0

The username used for authentication (if not specified at the next call of the authenticate function).