C# Class Mondo.MondoClient

An authenticated Mondo API client.
Inheritance: IMondoClient
ファイルを表示 Open project: rdingwall/mondo.net Class Usage Examples

Public Methods

Method Description
AnnotateTransactionAsync ( string transactionId, string>.IDictionary metadata, CancellationToken cancellationToken = default(CancellationToken) ) : Task

You may store your own key-value annotations against a transaction in its metadata.

Metadata is private to your application.

CreateAttachmentAsync ( string externalId, string fileUrl, string fileType, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Once you have obtained a URL for an attachment, either by uploading to the upload_url obtained from the upload endpoint above or by hosting a remote image, this URL can then be registered against a transaction. Once an attachment is registered against a transaction this will be displayed on the detail page of a transaction within the Mondo app.

CreateFeedItemAsync ( string accountId, string type, string>.IDictionary @params, string url = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Creates a new feed item on the user’s feed.

CreateWebhookAsync ( string accountId, string url, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Each time a matching event occurs, we will make a POST call to the URL you provide. If the call fails, we will retry up to a maximum of 5 attempts, with exponential backoff.

DeleteAttachmentAsync ( string id, CancellationToken cancellationToken = default(CancellationToken) ) : Task

To remove an attachment, simply deregister this using its id

DeleteWebhookAsync ( string webhookId, CancellationToken cancellationToken = default(CancellationToken) ) : Task

When you delete a web hook, we will no longer send notifications to it.

Dispose ( ) : void

Disposes the underlying HttpClient.

GetAccountsAsync ( ) : Task>

Returns a list of accounts owned by the currently authorised user.

GetBalanceAsync ( string accountId ) : Task

Returns balance information for a specific account.

GetTransactionAsync ( string transactionId, string expand = null ) : Task

Returns an individual transaction, fetched by its id.

GetTransactionsAsync ( string accountId, string expand = null, PaginationOptions paginationOptions = null ) : Task>

Returns a list of transactions on the user’s account.

GetWebhooksAsync ( string accountId ) : Task>

List the web hooks registered on an account.

MondoClient ( string accessToken, string baseUri = "https://api.getmondo.co.uk" ) : System

Initializes a new instance of the MondoClient class.

UploadAttachmentAsync ( string filename, string fileType, string externalId, Stream stream, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Uploads an attachment from a file stream.

Private Methods

Method Description
MondoClient ( HttpClient httpClient, string accessToken ) : System

Method Details

AnnotateTransactionAsync() public method

You may store your own key-value annotations against a transaction in its metadata.
Metadata is private to your application.
public AnnotateTransactionAsync ( string transactionId, string>.IDictionary metadata, CancellationToken cancellationToken = default(CancellationToken) ) : Task
transactionId string
metadata string>.IDictionary Include each key you would like to modify. To delete a key, set its value to an empty string.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task

CreateAttachmentAsync() public method

Once you have obtained a URL for an attachment, either by uploading to the upload_url obtained from the upload endpoint above or by hosting a remote image, this URL can then be registered against a transaction. Once an attachment is registered against a transaction this will be displayed on the detail page of a transaction within the Mondo app.
public CreateAttachmentAsync ( string externalId, string fileUrl, string fileType, CancellationToken cancellationToken = default(CancellationToken) ) : Task
externalId string The id of the transaction to associate the attachment with.
fileUrl string The URL of the uploaded attachment.
fileType string The content type of the attachment.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task

CreateFeedItemAsync() public method

Creates a new feed item on the user’s feed.
public CreateFeedItemAsync ( string accountId, string type, string>.IDictionary @params, string url = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task
accountId string The account to create feed item for.
type string Type of feed item. Currently only basic is supported.
@params string>.IDictionary
url string A URL to open when the feed item is tapped. If no URL is provided, the app will display a fallback view based on the title & body.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task

CreateWebhookAsync() public method

Each time a matching event occurs, we will make a POST call to the URL you provide. If the call fails, we will retry up to a maximum of 5 attempts, with exponential backoff.
public CreateWebhookAsync ( string accountId, string url, CancellationToken cancellationToken = default(CancellationToken) ) : Task
accountId string The account to receive notifications for.
url string The URL we will send notifications to.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task

DeleteAttachmentAsync() public method

To remove an attachment, simply deregister this using its id
public DeleteAttachmentAsync ( string id, CancellationToken cancellationToken = default(CancellationToken) ) : Task
id string The id of the attachment to deregister.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task

DeleteWebhookAsync() public method

When you delete a web hook, we will no longer send notifications to it.
public DeleteWebhookAsync ( string webhookId, CancellationToken cancellationToken = default(CancellationToken) ) : Task
webhookId string The id of the webhook to delete.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task

Dispose() public method

Disposes the underlying HttpClient.
public Dispose ( ) : void
return void

GetAccountsAsync() public method

Returns a list of accounts owned by the currently authorised user.
public GetAccountsAsync ( ) : Task>
return Task>

GetBalanceAsync() public method

Returns balance information for a specific account.
public GetBalanceAsync ( string accountId ) : Task
accountId string The id of the account.
return Task

GetTransactionAsync() public method

Returns an individual transaction, fetched by its id.
public GetTransactionAsync ( string transactionId, string expand = null ) : Task
transactionId string The transaction ID.
expand string Can be merchant.
return Task

GetTransactionsAsync() public method

Returns a list of transactions on the user’s account.
public GetTransactionsAsync ( string accountId, string expand = null, PaginationOptions paginationOptions = null ) : Task>
accountId string The account to retrieve transactions from.
expand string Can be merchant.
paginationOptions PaginationOptions This endpoint can be paginated.
return Task>

GetWebhooksAsync() public method

List the web hooks registered on an account.
public GetWebhooksAsync ( string accountId ) : Task>
accountId string The account to list registered web hooks for.
return Task>

MondoClient() public method

Initializes a new instance of the MondoClient class.
public MondoClient ( string accessToken, string baseUri = "https://api.getmondo.co.uk" ) : System
accessToken string Your access token.
baseUri string URL of the Mondo API to use, defaults to production.
return System

UploadAttachmentAsync() public method

Uploads an attachment from a file stream.
public UploadAttachmentAsync ( string filename, string fileType, string externalId, Stream stream, CancellationToken cancellationToken = default(CancellationToken) ) : Task
filename string The name of the file to be uploaded
fileType string The content type of the file
externalId string The id of the transaction to associate the attachment with.
stream Stream The file stream.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task