C# Class Socrata.Dataset

A Socrata dataset and associated rows/columns/metadata
Inheritance: ApiBase
Mostrar archivo Open project: socrata-archive/socrata-csharp-deprecated Class Usage Examples

Public Methods

Method Description
addColumn ( String name ) : bool
addColumn ( String name, String description ) : bool
addColumn ( String name, String description, String type ) : bool
addColumn ( String name, String description, String type, int width ) : bool
addColumn ( String name, String description, String type, int width, bool hidden ) : bool

Adds a column to the dataset

addRow ( string>.Dictionary row ) : bool

Add a row to the dataset

append ( String filename ) : bool

Append the data in the given file to an existing dataset

append ( String filename, bool skipHeaders ) : bool

Replaces the data in the existing attached dataset with the contents of the file

attach ( string id ) : void

Attach to a given UID for a dataset that already exists

attached ( ) : bool

Check to see if the dataset is associated with a valid UID.

columns ( ) : Newtonsoft.Json.Linq.JArray

Gets a JSON representation of the columns

copy ( ) : String

Make a working copy of a published dataset, with all row data copied.

copySchema ( ) : String

Make a working copy of only the schema of a published dataset, with all row data omitted.

create ( String name ) : bool

Creates a new, blank dataset with only a name.

create ( String name, String description ) : bool

Creates a new, blank dataset.

delayAddRow ( string>.Dictionary row ) : void

Like addRow, but doesn't immediately send the data away. Instead, it stores it in a queue, which can be flushed with sendBatchRequest

delete ( ) : bool

Deletes (irreversibly) the current dataset

importFile ( String filename ) : bool

Creates a new dataset by importing a file

metadata ( ) : Newtonsoft.Json.Linq.JObject

Gets the metadata associated with the dataset

publish ( ) : bool

Performs a publish operation on a working copy dataset, to commit the changes you've made to the working copy to the published copy. Note that this should be called on the working copy, not the published version.

refresh ( String filename ) : bool

Replaces the data in the existing attached dataset with the contents of the file

refresh ( String filename, bool skipHeaders ) : bool

Replaces the data in the existing attached dataset with the contents of the file

rows ( ) : Newtonsoft.Json.Linq.JArray

Gets a JSON Array of the rows in the dataset

setAttribution ( String attribution, String url ) : void

Sets the dataset's attribution, e.g. "provided by"

setDescription ( String description ) : void

Sets the dataset's description

setPublic ( bool isPublic ) : bool

Sets the dataset's visibility

shortUrl ( ) : String

Gets an href to the dataset, shortened.

uploadFile ( String filename ) : String

Upload a file to the dataset for use in a cell (e.g. image)

Private Methods

Method Description
copyWithMethod ( String method ) : String
isValidId ( String id ) : bool

Checks if the given string represents a valid 4-4 Socrata UID

multipartAppendOrRefresh ( String filename, String method ) : bool
multipartUpload ( String url, String filename ) : Newtonsoft.Json.Linq.JObject

Multipart upload a file

putRequest ( String body ) : void

Method Details

addColumn() public method

public addColumn ( String name ) : bool
name String
return bool

addColumn() public method

public addColumn ( String name, String description ) : bool
name String
description String
return bool

addColumn() public method

public addColumn ( String name, String description, String type ) : bool
name String
description String
type String
return bool

addColumn() public method

public addColumn ( String name, String description, String type, int width ) : bool
name String
description String
type String
width int
return bool

addColumn() public method

Adds a column to the dataset
public addColumn ( String name, String description, String type, int width, bool hidden ) : bool
name String The name of the column
description String An optional description
type String The column type. See API docs vor valid types
width int How many pixels wide to make the column
hidden bool If true, don't show the column in views, just store the data
return bool

addRow() public method

Add a row to the dataset
public addRow ( string>.Dictionary row ) : bool
row string>.Dictionary A dictionary of column/celldata values
return bool

append() public method

Append the data in the given file to an existing dataset
public append ( String filename ) : bool
filename String The location of the file on disk
return bool

append() public method

Replaces the data in the existing attached dataset with the contents of the file
public append ( String filename, bool skipHeaders ) : bool
filename String The location of the file to add to the dataset
skipHeaders bool Whether to skip the first row of your import file
return bool

attach() public method

Attach to a given UID for a dataset that already exists
public attach ( string id ) : void
id string The Socrata UID
return void

attached() public method

Check to see if the dataset is associated with a valid UID.
public attached ( ) : bool
return bool

columns() public method

Gets a JSON representation of the columns
public columns ( ) : Newtonsoft.Json.Linq.JArray
return Newtonsoft.Json.Linq.JArray

copy() public method

Make a working copy of a published dataset, with all row data copied.
public copy ( ) : String
return String

copySchema() public method

Make a working copy of only the schema of a published dataset, with all row data omitted.
public copySchema ( ) : String
return String

create() public method

Creates a new, blank dataset with only a name.
public create ( String name ) : bool
name String The title of the dataset
return bool

create() public method

Creates a new, blank dataset.
public create ( String name, String description ) : bool
name String The name of the dataset (must be unique)
description String On optional description
return bool

delayAddRow() public method

Like addRow, but doesn't immediately send the data away. Instead, it stores it in a queue, which can be flushed with sendBatchRequest
public delayAddRow ( string>.Dictionary row ) : void
row string>.Dictionary A dictionary of column/celldata values
return void

delete() public method

Deletes (irreversibly) the current dataset
public delete ( ) : bool
return bool

importFile() public method

Creates a new dataset by importing a file
public importFile ( String filename ) : bool
filename String The location of the file on disk
return bool

metadata() public method

Gets the metadata associated with the dataset
public metadata ( ) : Newtonsoft.Json.Linq.JObject
return Newtonsoft.Json.Linq.JObject

publish() public method

Performs a publish operation on a working copy dataset, to commit the changes you've made to the working copy to the published copy. Note that this should be called on the working copy, not the published version.
public publish ( ) : bool
return bool

refresh() public method

Replaces the data in the existing attached dataset with the contents of the file
public refresh ( String filename ) : bool
filename String The location of the file to overwrite the dataset with
return bool

refresh() public method

Replaces the data in the existing attached dataset with the contents of the file
public refresh ( String filename, bool skipHeaders ) : bool
filename String The location of the file to overwrite the dataset with
skipHeaders bool Whether to skip the first row of your import file
return bool

rows() public method

Gets a JSON Array of the rows in the dataset
public rows ( ) : Newtonsoft.Json.Linq.JArray
return Newtonsoft.Json.Linq.JArray

setAttribution() public method

Sets the dataset's attribution, e.g. "provided by"
public setAttribution ( String attribution, String url ) : void
attribution String Name of the data source/organization
url String An optional link to the data source
return void

setDescription() public method

Sets the dataset's description
public setDescription ( String description ) : void
description String The description
return void

setPublic() public method

Sets the dataset's visibility
public setPublic ( bool isPublic ) : bool
isPublic bool Whether or not it should be publicly viewable
return bool

shortUrl() public method

Gets an href to the dataset, shortened.
public shortUrl ( ) : String
return String

uploadFile() public method

Upload a file to the dataset for use in a cell (e.g. image)
public uploadFile ( String filename ) : String
filename String Where the file is located on disk
return String