UNPKG

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

63 lines (62 loc) 3.09 kB
/* 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 * * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ import { TransactionFlagColorFromJSON, TransactionFlagColorToJSON, } from './TransactionFlagColor'; import { TransactionClearedStatusFromJSON, TransactionClearedStatusToJSON, } from './TransactionClearedStatus'; import { SaveSubTransactionFromJSON, SaveSubTransactionToJSON, } from './SaveSubTransaction'; /** * Check if a given object implements the NewTransaction interface. */ export function instanceOfNewTransaction(value) { return true; } export function NewTransactionFromJSON(json) { return NewTransactionFromJSONTyped(json, false); } export function NewTransactionFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'account_id': json['account_id'] == null ? undefined : json['account_id'], 'date': json['date'] == null ? undefined : json['date'], 'amount': json['amount'] == null ? undefined : json['amount'], 'payee_id': json['payee_id'] == null ? undefined : json['payee_id'], 'payee_name': json['payee_name'] == null ? undefined : json['payee_name'], 'category_id': json['category_id'] == null ? undefined : json['category_id'], 'memo': json['memo'] == null ? undefined : json['memo'], 'cleared': json['cleared'] == null ? undefined : TransactionClearedStatusFromJSON(json['cleared']), 'approved': json['approved'] == null ? undefined : json['approved'], 'flag_color': json['flag_color'] == null ? undefined : TransactionFlagColorFromJSON(json['flag_color']), 'subtransactions': json['subtransactions'] == null ? undefined : (json['subtransactions'].map(SaveSubTransactionFromJSON)), 'import_id': json['import_id'] == null ? undefined : json['import_id'], }; } export function NewTransactionToJSON(json) { return NewTransactionToJSONTyped(json, false); } export function NewTransactionToJSONTyped(value, ignoreDiscriminator) { if (ignoreDiscriminator === void 0) { ignoreDiscriminator = false; } if (value == null) { return value; } return { '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']), 'subtransactions': value['subtransactions'] == null ? undefined : (value['subtransactions'].map(SaveSubTransactionToJSON)), 'import_id': value['import_id'], }; }