ynab
Version:
Official JavaScript client for the YNAB API. API documentation available at https://api.ynab.com. Generated from server specification version 1.76.0
71 lines (70 loc) • 3.3 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/**
* YNAB API Endpoints
* Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists } from '../runtime';
import { SaveSubTransactionFromJSON, SaveSubTransactionToJSON, } from './SaveSubTransaction';
import { TransactionClearedStatusFromJSON, TransactionClearedStatusToJSON, } from './TransactionClearedStatus';
import { TransactionFlagColorFromJSON, TransactionFlagColorToJSON, } from './TransactionFlagColor';
/**
* Check if a given object implements the SaveTransactionWithId interface.
*/
export function instanceOfSaveTransactionWithId(value) {
var isInstance = true;
return isInstance;
}
export function SaveTransactionWithIdFromJSON(json) {
return SaveTransactionWithIdFromJSONTyped(json, false);
}
export function SaveTransactionWithIdFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'account_id': !exists(json, 'account_id') ? undefined : json['account_id'],
'date': !exists(json, 'date') ? undefined : json['date'],
'amount': !exists(json, 'amount') ? undefined : json['amount'],
'payee_id': !exists(json, 'payee_id') ? undefined : json['payee_id'],
'payee_name': !exists(json, 'payee_name') ? undefined : json['payee_name'],
'category_id': !exists(json, 'category_id') ? undefined : json['category_id'],
'memo': !exists(json, 'memo') ? undefined : json['memo'],
'cleared': !exists(json, 'cleared') ? undefined : TransactionClearedStatusFromJSON(json['cleared']),
'approved': !exists(json, 'approved') ? undefined : json['approved'],
'flag_color': !exists(json, 'flag_color') ? undefined : TransactionFlagColorFromJSON(json['flag_color']),
'import_id': !exists(json, 'import_id') ? undefined : json['import_id'],
'subtransactions': !exists(json, 'subtransactions') ? undefined : (json['subtransactions'].map(SaveSubTransactionFromJSON)),
};
}
export function SaveTransactionWithIdToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'account_id': value.account_id,
'date': value.date,
'amount': value.amount,
'payee_id': value.payee_id,
'payee_name': value.payee_name,
'category_id': value.category_id,
'memo': value.memo,
'cleared': TransactionClearedStatusToJSON(value.cleared),
'approved': value.approved,
'flag_color': TransactionFlagColorToJSON(value.flag_color),
'import_id': value.import_id,
'subtransactions': value.subtransactions === undefined ? undefined : (value.subtransactions.map(SaveSubTransactionToJSON)),
};
}