Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
88 changes: 88 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,91 @@ target/

#Ipython Notebook
.ipynb_checkpoints

# Created by https://www.gitignore.io/api/IntelliJ
# Edit at https://www.gitignore.io/?templates=IntelliJ

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# JetBrains templates
**___jb_tmp___

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

# End of https://www.gitignore.io/api/IntelliJ
n
4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/ynab-python.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
3.0.34
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# ref: https://docs.travis-ci.com/user/languages/python
language: python
python:
- "2.7"
- "3.2"
- "3.3"
- "3.4"
Expand Down
132 changes: 92 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# ynab-python

**No gaurentees this works as expected. It's just a place for me to play around to see if I can get something usable with the YNAB API. Other implementations so far don't seem to have optional fields.**

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.youneedabudget.com

This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 1.0.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.PythonClientCodegen
- Package version: 1.0.1
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

## Requirements.

Expand Down Expand Up @@ -56,14 +53,32 @@ from pprint import pprint

# Configure API key authorization: bearer
configuration = ynab.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = ynab.AccountsApi(ynab.ApiClient(configuration))
body = ynab.SaveAccountWrapper() # SaveAccountWrapper | The account to create.
budget_id = 'budget_id_example' # str | The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)

try:
# Create a new account
api_response = api_instance.create_account(body, budget_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling AccountsApi->create_account: %s\n" % e)

# Configure API key authorization: bearer
configuration = ynab.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = ynab.AccountsApi()
budget_id = 'budget_id_example' # str | The ID of the Budget.
account_id = 'account_id_example' # str | The ID of the Account.
api_instance = ynab.AccountsApi(ynab.ApiClient(configuration))
budget_id = 'budget_id_example' # str | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget).
account_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | The id of the account

try:
# Single account
Expand All @@ -72,6 +87,23 @@ try:
except ApiException as e:
print("Exception when calling AccountsApi->get_account_by_id: %s\n" % e)

# Configure API key authorization: bearer
configuration = ynab.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = ynab.AccountsApi(ynab.ApiClient(configuration))
budget_id = 'budget_id_example' # str | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget).
last_knowledge_of_server = 789 # int | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. (optional)

try:
# Account list
api_response = api_instance.get_accounts(budget_id, last_knowledge_of_server=last_knowledge_of_server)
pprint(api_response)
except ApiException as e:
print("Exception when calling AccountsApi->get_accounts: %s\n" % e)
```

## Documentation for API Endpoints
Expand All @@ -80,12 +112,17 @@ All URIs are relative to *https://api.youneedabudget.com/v1*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccountsApi* | [**create_account**](docs/AccountsApi.md#create_account) | **POST** /budgets/{budget_id}/accounts | Create a new account
*AccountsApi* | [**get_account_by_id**](docs/AccountsApi.md#get_account_by_id) | **GET** /budgets/{budget_id}/accounts/{account_id} | Single account
*AccountsApi* | [**get_accounts**](docs/AccountsApi.md#get_accounts) | **GET** /budgets/{budget_id}/accounts | Account list
*BudgetsApi* | [**get_budget_by_id**](docs/BudgetsApi.md#get_budget_by_id) | **GET** /budgets/{budget_id} | Single budget
*BudgetsApi* | [**get_budget_settings_by_id**](docs/BudgetsApi.md#get_budget_settings_by_id) | **GET** /budgets/{budget_id}/settings | Budget Settings
*BudgetsApi* | [**get_budgets**](docs/BudgetsApi.md#get_budgets) | **GET** /budgets | List budgets
*CategoriesApi* | [**get_categories**](docs/CategoriesApi.md#get_categories) | **GET** /budgets/{budget_id}/categories | List categories
*CategoriesApi* | [**get_category_by_id**](docs/CategoriesApi.md#get_category_by_id) | **GET** /budgets/{budget_id}/categories/{category_id} | Single category
*CategoriesApi* | [**get_month_category_by_id**](docs/CategoriesApi.md#get_month_category_by_id) | **GET** /budgets/{budget_id}/months/{month}/categories/{category_id} | Single category for a specific budget month
*CategoriesApi* | [**update_month_category**](docs/CategoriesApi.md#update_month_category) | **PATCH** /budgets/{budget_id}/months/{month}/categories/{category_id} | Update a category for a specific month
*DeprecatedApi* | [**bulk_create_transactions**](docs/DeprecatedApi.md#bulk_create_transactions) | **POST** /budgets/{budget_id}/transactions/bulk | Bulk create transactions
*MonthsApi* | [**get_budget_month**](docs/MonthsApi.md#get_budget_month) | **GET** /budgets/{budget_id}/months/{month} | Single budget month
*MonthsApi* | [**get_budget_months**](docs/MonthsApi.md#get_budget_months) | **GET** /budgets/{budget_id}/months | List budget months
*PayeeLocationsApi* | [**get_payee_location_by_id**](docs/PayeeLocationsApi.md#get_payee_location_by_id) | **GET** /budgets/{budget_id}/payee_locations/{payee_location_id} | Single payee location
Expand All @@ -95,84 +132,100 @@ Class | Method | HTTP request | Description
*PayeesApi* | [**get_payees**](docs/PayeesApi.md#get_payees) | **GET** /budgets/{budget_id}/payees | List payees
*ScheduledTransactionsApi* | [**get_scheduled_transaction_by_id**](docs/ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | **GET** /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} | Single scheduled transaction
*ScheduledTransactionsApi* | [**get_scheduled_transactions**](docs/ScheduledTransactionsApi.md#get_scheduled_transactions) | **GET** /budgets/{budget_id}/scheduled_transactions | List scheduled transactions
*TransactionsApi* | [**bulk_create_transactions**](docs/TransactionsApi.md#bulk_create_transactions) | **POST** /budgets/{budget_id}/transactions/bulk | Bulk create transactions
*TransactionsApi* | [**create_transaction**](docs/TransactionsApi.md#create_transaction) | **POST** /budgets/{budget_id}/transactions | Create new transaction
*TransactionsApi* | [**create_transaction**](docs/TransactionsApi.md#create_transaction) | **POST** /budgets/{budget_id}/transactions | Create a single transaction or multiple transactions
*TransactionsApi* | [**get_transaction_by_id**](docs/TransactionsApi.md#get_transaction_by_id) | **GET** /budgets/{budget_id}/transactions/{transaction_id} | Single transaction
*TransactionsApi* | [**get_transactions**](docs/TransactionsApi.md#get_transactions) | **GET** /budgets/{budget_id}/transactions | List transactions
*TransactionsApi* | [**get_transactions_by_account**](docs/TransactionsApi.md#get_transactions_by_account) | **GET** /budgets/{budget_id}/accounts/{account_id}/transactions | List account transactions
*TransactionsApi* | [**get_transactions_by_category**](docs/TransactionsApi.md#get_transactions_by_category) | **GET** /budgets/{budget_id}/categories/{category_id}/transactions | List category transactions
*TransactionsApi* | [**get_transactions_by_id**](docs/TransactionsApi.md#get_transactions_by_id) | **GET** /budgets/{budget_id}/transactions/{transaction_id} | Single transaction
*TransactionsApi* | [**get_transactions_by_payee**](docs/TransactionsApi.md#get_transactions_by_payee) | **GET** /budgets/{budget_id}/payees/{payee_id}/transactions | List payee transactions
*TransactionsApi* | [**import_transactions**](docs/TransactionsApi.md#import_transactions) | **POST** /budgets/{budget_id}/transactions/import | Import transactions
*TransactionsApi* | [**update_transaction**](docs/TransactionsApi.md#update_transaction) | **PUT** /budgets/{budget_id}/transactions/{transaction_id} | Updates an existing transaction
*TransactionsApi* | [**update_transactions**](docs/TransactionsApi.md#update_transactions) | **PATCH** /budgets/{budget_id}/transactions | Update multiple transactions
*UserApi* | [**get_user**](docs/UserApi.md#get_user) | **GET** /user | User info


## Documentation For Models

- [Account](docs/Account.md)
- [AccountResponse](docs/AccountResponse.md)
- [AccountWrapper](docs/AccountWrapper.md)
- [AccountResponseData](docs/AccountResponseData.md)
- [AccountsResponse](docs/AccountsResponse.md)
- [AccountsWrapper](docs/AccountsWrapper.md)
- [AccountsResponseData](docs/AccountsResponseData.md)
- [BudgetDetail](docs/BudgetDetail.md)
- [BudgetDetailResponse](docs/BudgetDetailResponse.md)
- [BudgetDetailWrapper](docs/BudgetDetailWrapper.md)
- [BudgetDetailResponseData](docs/BudgetDetailResponseData.md)
- [BudgetSettings](docs/BudgetSettings.md)
- [BudgetSettingsResponse](docs/BudgetSettingsResponse.md)
- [BudgetSettingsResponseData](docs/BudgetSettingsResponseData.md)
- [BudgetSummary](docs/BudgetSummary.md)
- [BudgetSummaryResponse](docs/BudgetSummaryResponse.md)
- [BudgetSummaryWrapper](docs/BudgetSummaryWrapper.md)
- [BulkIdWrapper](docs/BulkIdWrapper.md)
- [BulkIds](docs/BulkIds.md)
- [BudgetSummaryResponseData](docs/BudgetSummaryResponseData.md)
- [BulkResponse](docs/BulkResponse.md)
- [BulkResponseData](docs/BulkResponseData.md)
- [BulkResponseDataBulk](docs/BulkResponseDataBulk.md)
- [BulkTransactions](docs/BulkTransactions.md)
- [CategoriesResponse](docs/CategoriesResponse.md)
- [CategoriesResponseData](docs/CategoriesResponseData.md)
- [Category](docs/Category.md)
- [CategoryGroup](docs/CategoryGroup.md)
- [CategoryGroupsWrapper](docs/CategoryGroupsWrapper.md)
- [CategoryGroupWithCategories](docs/CategoryGroupWithCategories.md)
- [CategoryResponse](docs/CategoryResponse.md)
- [CategoryWrapper](docs/CategoryWrapper.md)
- [CategoryResponseData](docs/CategoryResponseData.md)
- [CurrencyFormat](docs/CurrencyFormat.md)
- [DateFormat](docs/DateFormat.md)
- [ErrorDetail](docs/ErrorDetail.md)
- [ErrorResponse](docs/ErrorResponse.md)
- [HybridTransaction](docs/HybridTransaction.md)
- [HybridTransactionsResponse](docs/HybridTransactionsResponse.md)
- [HybridTransactionsWrapper](docs/HybridTransactionsWrapper.md)
- [HybridTransactionsResponseData](docs/HybridTransactionsResponseData.md)
- [MonthDetail](docs/MonthDetail.md)
- [MonthDetailResponse](docs/MonthDetailResponse.md)
- [MonthDetailWrapper](docs/MonthDetailWrapper.md)
- [MonthDetailResponseData](docs/MonthDetailResponseData.md)
- [MonthSummariesResponse](docs/MonthSummariesResponse.md)
- [MonthSummariesWrapper](docs/MonthSummariesWrapper.md)
- [MonthSummariesResponseData](docs/MonthSummariesResponseData.md)
- [MonthSummary](docs/MonthSummary.md)
- [Payee](docs/Payee.md)
- [PayeeLocation](docs/PayeeLocation.md)
- [PayeeLocationResponse](docs/PayeeLocationResponse.md)
- [PayeeLocationWrapper](docs/PayeeLocationWrapper.md)
- [PayeeLocationResponseData](docs/PayeeLocationResponseData.md)
- [PayeeLocationsResponse](docs/PayeeLocationsResponse.md)
- [PayeeLocationsWrapper](docs/PayeeLocationsWrapper.md)
- [PayeeLocationsResponseData](docs/PayeeLocationsResponseData.md)
- [PayeeResponse](docs/PayeeResponse.md)
- [PayeeWrapper](docs/PayeeWrapper.md)
- [PayeeResponseData](docs/PayeeResponseData.md)
- [PayeesResponse](docs/PayeesResponse.md)
- [PayeesWrapper](docs/PayeesWrapper.md)
- [PayeesResponseData](docs/PayeesResponseData.md)
- [SaveAccount](docs/SaveAccount.md)
- [SaveAccountWrapper](docs/SaveAccountWrapper.md)
- [SaveCategoryResponse](docs/SaveCategoryResponse.md)
- [SaveCategoryResponseData](docs/SaveCategoryResponseData.md)
- [SaveMonthCategory](docs/SaveMonthCategory.md)
- [SaveMonthCategoryWrapper](docs/SaveMonthCategoryWrapper.md)
- [SaveSubTransaction](docs/SaveSubTransaction.md)
- [SaveTransaction](docs/SaveTransaction.md)
- [SaveTransactionWrapper](docs/SaveTransactionWrapper.md)
- [SaveTransactionsResponse](docs/SaveTransactionsResponse.md)
- [SaveTransactionsResponseData](docs/SaveTransactionsResponseData.md)
- [SaveTransactionsWrapper](docs/SaveTransactionsWrapper.md)
- [ScheduledSubTransaction](docs/ScheduledSubTransaction.md)
- [ScheduledTransactionDetail](docs/ScheduledTransactionDetail.md)
- [ScheduledTransactionResponse](docs/ScheduledTransactionResponse.md)
- [ScheduledTransactionResponseData](docs/ScheduledTransactionResponseData.md)
- [ScheduledTransactionSummary](docs/ScheduledTransactionSummary.md)
- [ScheduledTransactionWrapper](docs/ScheduledTransactionWrapper.md)
- [ScheduledTransactionsResponse](docs/ScheduledTransactionsResponse.md)
- [ScheduledTransactionsWrapper](docs/ScheduledTransactionsWrapper.md)
- [ScheduledTransactionsResponseData](docs/ScheduledTransactionsResponseData.md)
- [SubTransaction](docs/SubTransaction.md)
- [TransactionDetail](docs/TransactionDetail.md)
- [TransactionResponse](docs/TransactionResponse.md)
- [TransactionResponseData](docs/TransactionResponseData.md)
- [TransactionSummary](docs/TransactionSummary.md)
- [TransactionWrapper](docs/TransactionWrapper.md)
- [TransactionsImportResponse](docs/TransactionsImportResponse.md)
- [TransactionsImportResponseData](docs/TransactionsImportResponseData.md)
- [TransactionsResponse](docs/TransactionsResponse.md)
- [TransactionsWrapper](docs/TransactionsWrapper.md)
- [TransactionsResponseData](docs/TransactionsResponseData.md)
- [UpdateTransaction](docs/UpdateTransaction.md)
- [UpdateTransactionsWrapper](docs/UpdateTransactionsWrapper.md)
- [User](docs/User.md)
- [UserResponse](docs/UserResponse.md)
- [UserWrapper](docs/UserWrapper.md)
- [BudgetDetail](docs/BudgetDetail.md)
- [CategoryGroupWithCategories](docs/CategoryGroupWithCategories.md)
- [HybridTransaction](docs/HybridTransaction.md)
- [MonthDetail](docs/MonthDetail.md)
- [ScheduledTransactionDetail](docs/ScheduledTransactionDetail.md)
- [TransactionDetail](docs/TransactionDetail.md)

- [UserResponseData](docs/UserResponseData.md)

## Documentation For Authorization

Expand All @@ -187,4 +240,3 @@ Class | Method | HTTP request | Description
## Author



10 changes: 10 additions & 0 deletions README_GENERATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SWAGGER GENERATION INSTRUCTIONS

1. Install swagger-codegen
1. Change into the ynab-python directory
1. Remove all the test files with `rm -r test/`
1. Bump the version in swagger-codegen-python-config.js
1. Generate new fixtures with `swagger-codegen generate -i https://api.youneedabudget.com/papi/spec-v1-swagger.json -l python -o . --config swagger-codegen-python-config.json --git-user-id deanmcgregor --git-repo-id ynab-python`
1. Manually fix up the tests to call `ynab.api` and `ynab.models` for imports
1. Install the test requirements with `pip install -r test-requirements.txt`
1. Run the tests with `nosetests`
Loading