api

package
v0.0.0-...-9b0c1e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAccount

func DeleteAccount(w rest.ResponseWriter, r *rest.Request)

*

  • @api {delete} /orgs/:orgId/accounts/:accountId Delete an Account
  • @apiVersion 1.4.0
  • @apiName DeleteAccount
  • @apiGroup Account *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func DeleteApiKey

func DeleteApiKey(w rest.ResponseWriter, r *rest.Request)

*

  • @api {delete} /apikeys/:apiKeyId Delete an API key
  • @apiVersion 1.4.0
  • @apiName DeleteApiKey
  • @apiGroup ApiKey *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func DeleteBudget

func DeleteBudget(w rest.ResponseWriter, r *rest.Request)

*

  • @api {delete} /orgs/:orgId/budget Delete Budget
  • @apiVersion 1.4.0
  • @apiName DeleteBudget
  • @apiGroup Budget *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func DeleteInvite

func DeleteInvite(w rest.ResponseWriter, r *rest.Request)

*

  • @api {delete} /orgs/:orgId/invites/:inviteId Delete Invite
  • @apiVersion 1.4.0
  • @apiName DeleteInvite
  • @apiGroup Org *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func DeletePrice

func DeletePrice(w rest.ResponseWriter, r *rest.Request)

*

  • @api {delete} /orgs/:orgId/prices/:priceId Delete a Price
  • @apiVersion 1.4.0
  • @apiName DeletePrice
  • @apiGroup Price *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func DeleteSession

func DeleteSession(w rest.ResponseWriter, r *rest.Request)

*

  • @api {delete} /sessions/:sessionId Log out of a Session
  • @apiVersion 1.4.0
  • @apiName DeleteSession
  • @apiGroup Session *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func DeleteTransaction

func DeleteTransaction(w rest.ResponseWriter, r *rest.Request)

*

  • @api {delete} /orgs/:orgId/transactions/:transactionId Delete a Transaction
  • @apiVersion 1.4.0
  • @apiName DeleteTransaction
  • @apiGroup Transaction *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetApiKeys

func GetApiKeys(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /apikeys Get API keys
  • @apiVersion 1.4.0
  • @apiName GetApiKeys
  • @apiGroup ApiKey *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} id Id of the ApiKey.
  • @apiSuccess {Date} inserted Date ApiKey was created
  • @apiSuccess {Date} updated Date Last activity for the ApiKey
  • @apiSuccess {String} userId Id of the User
  • @apiSuccess {String} label Label *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • [
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "userId": "22222222222222222222222222222222",
  • "label": "Shopping Cart"
  • }
  • ] *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetBudget

func GetBudget(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /orgs/:orgId/budget Get Budget
  • @apiVersion 1.4.0
  • @apiName GetBudget
  • @apiGroup Budget *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {Date} inserted Date Budget was created
  • @apiSuccess {Object[]} items Array of Budget Items *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • [
  • {
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2020-01-13T20:12:29.720Z",
  • "items": [
  • {
  • "accountId": "11111111111111111111111111111111",
  • "amount": 35000,
  • },
  • {
  • "accountId": "22222222222222222222222222222222",
  • "amount": 55000
  • }
  • ]
  • }
  • ] *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetInvites

func GetInvites(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /orgs/:orgId/invites Get Org invites
  • @apiVersion 1.4.0
  • @apiName GetInvites
  • @apiGroup Org *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} id Id of the Invite
  • @apiSuccess {orgId} id Id of the Org
  • @apiSuccess {Date} inserted Date Invite was created
  • @apiSuccess {Date} updated Date Invite was updated/accepted
  • @apiSuccess {String} email Email address of user
  • @apiSuccess {String} accepted true if user has accepted *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • [
  • {
  • "id": "a1b2c3d4",
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "email": "johndoe@email.com",
  • "accepted": true
  • }
  • ] *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetOrg

func GetOrg(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /org/:orgId Get Org by id
  • @apiVersion 1.4.0
  • @apiName GetOrg
  • @apiGroup Org *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} id Id of the Org.
  • @apiSuccess {Date} inserted Date Org was created
  • @apiSuccess {Date} updated Date Org was updated
  • @apiSuccess {String} name Name of the Org.
  • @apiSuccess {String} currency Three letter currency code.
  • @apiSuccess {Number} precision How many digits the currency goes out to.
  • @apiSuccess {String} timezone Timezone to use for accounting. *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "name": "MyOrg",
  • "currency": "USD",
  • "precision": 2,
  • "timezone": "America/New_York"
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetOrgAccount

func GetOrgAccount(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /orgs/:orgId/accounts/:accountId Get Acount by Org id and Account id
  • @apiVersion 1.4.0
  • @apiName GetOrgAccount
  • @apiGroup Account *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} id Id of the Account.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {Date} inserted Date Account was created
  • @apiSuccess {Date} updated Date Account was updated
  • @apiSuccess {String} name Name of the Account.
  • @apiSuccess {String} parent Id of the parent Account.
  • @apiSuccess {String} currency Three letter currency code.
  • @apiSuccess {Number} precision How many digits the currency goes out to.
  • @apiSuccess {Boolean} debitBalance True if Account has a debit balance.
  • @apiSuccess {Number} balance Current Account balance in this Account's currency
  • @apiSuccess {Number} nativeBalance Current Account balance in the Org's currency *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "22222222222222222222222222222222",
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "name": "Cash",
  • "parent": "11111111111111111111111111111111",
  • "currency": "USD",
  • "precision": 2,
  • "debitBalance": true,
  • "balance": 10000,
  • "nativeBalance": 10000
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetOrgAccounts

func GetOrgAccounts(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /orgs/:orgId/accounts Get Accounts by Org id
  • @apiVersion 1.4.0
  • @apiName GetOrgAccounts
  • @apiGroup Account *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} id Id of the Account.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {Date} inserted Date Account was created
  • @apiSuccess {Date} updated Date Account was updated
  • @apiSuccess {String} name Name of the Account.
  • @apiSuccess {String} parent Id of the parent Account.
  • @apiSuccess {String} currency Three letter currency code.
  • @apiSuccess {Number} precision How many digits the currency goes out to.
  • @apiSuccess {Boolean} debitBalance True if Account has a debit balance.
  • @apiSuccess {Number} balance Current Account balance in this Account's currency
  • @apiSuccess {Number} nativeBalance Current Account balance in the Org's currency *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • [
  • {
  • "id": "22222222222222222222222222222222",
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "name": "Cash",
  • "parent": "11111111111111111111111111111111",
  • "currency": "USD",
  • "precision": 2,
  • "debitBalance": true,
  • "balance": 10000,
  • "nativeBalance": 10000
  • }
  • ] *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetOrgs

func GetOrgs(w rest.ResponseWriter, r *rest.Request)

* * @api {get} /orgs Get a User's Orgs * @apiVersion 1.4.0 * @apiName GetOrgs * @apiGroup Org * * @apiHeader {String} Authorization HTTP Basic Auth * @apiHeader {String} Accept-Version ^1.4.0 semver versioning * * @apiSuccess {String} id Id of the Org. * @apiSuccess {Date} inserted Date Org was created * @apiSuccess {Date} updated Date Org was updated * @apiSuccess {String} name Name of the Org. * @apiSuccess {String} currency Three letter currency code. * @apiSuccess {Number} precision How many digits the currency goes out to. @apiSuccess {String} timezone Timezone to use for accounting. * * @apiSuccessExample Success-Response: * HTTP/1.1 200 OK * [ * { * "id": "11111111111111111111111111111111", * "inserted": "2018-09-11T18:05:04.420Z", * "updated": "2018-09-11T18:05:04.420Z", * "name": "MyOrg", * "currency": "USD", * "precision": 2, * "timezone": "America/New_York" * } * ] * * @apiUse NotAuthorizedError * @apiUse InternalServerError

func GetPrices

func GetPrices(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /org/:orgId/prices Get prices nearest in time or by currency
  • @apiVersion 1.4.0
  • @apiName GetPrices
  • @apiGroup Price *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {Number} nearestDate Milliseconds since epoch
  • @apiParam {String} currency Currency code *
  • @apiSuccess {String} id Id of the Price.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {String} currency Currency code.
  • @apiSuccess {Date} date Date of the Price.
  • @apiSuccess {Date} inserted Date when Price was posted.
  • @apiSuccess {Date} updated Date when Price was updated.
  • @apiSuccess {Number} price Price of currency measured in native Org currency. *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • [
  • {
  • "id": "11111111111111111111111111111111",
  • "orgId": "11111111111111111111111111111111",
  • "currency": "EUR",
  • "date": "2018-09-11T18:05:04.420Z",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "price": 1.16
  • }
  • ] *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetRouter

func GetRouter(auth *AuthMiddleware, prefix string) (rest.App, error)

func GetSystemHealthStatus

func GetSystemHealthStatus(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /health-check Get system health status
  • @apiVersion 1.4.0
  • @apiName GetSystemHealthStatus
  • @apiGroup SystemHealth * *
  • @apiHeader {String} Accept-Version: 1.4.0 semver versioning *
  • @apiSuccess {String} database Database status: "ok"; "fail"
  • @apiSuccess {String} api API status: "ok" *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "database": "ok",
  • "api": "ok",
  • } *
  • @apiUse InternalServerError

func GetTransactionsByAccount

func GetTransactionsByAccount(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /orgs/:orgId/accounts/:accountId/transactions Get Transactions by Account Id
  • @apiVersion 1.4.0
  • @apiName GetAccountTransactions
  • @apiGroup Transaction *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} id Id of the Transaction.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {String} userId Id of the User who created the Transaction.
  • @apiSuccess {Date} date Date of the Transaction
  • @apiSuccess {Date} inserted Date Transaction was created
  • @apiSuccess {Date} updated Date Transaction was updated
  • @apiSuccess {String} description Description of Transaction
  • @apiSuccess {String} data Extra data field
  • @apiSuccess {Object[]} splits Array of Transaction Splits *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • [
  • {
  • "id": "11111111111111111111111111111111",
  • "orgId": "11111111111111111111111111111111",
  • "userId": "11111111111111111111111111111111",
  • "date": "2018-06-08T20:12:29.720Z",
  • "inserted": "2018-06-08T20:12:29.720Z",
  • "updated": "2018-06-08T20:12:29.720Z",
  • "description": "Treat friend to lunch",
  • "data:": "{\"key\": \"value\"}",
  • "splits": [
  • {
  • "accountId": "11111111111111111111111111111111",
  • "amount": -2000,
  • "nativeAmount": -2000
  • },
  • {
  • "accountId": "22222222222222222222222222222222",
  • "amount": 1000,
  • "nativeAmount": 1000
  • },
  • {
  • "accountId": "33333333333333333333333333333333",
  • "amount": 1000,
  • "nativeAmount": 1000
  • }
  • ]
  • }
  • ] *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetTransactionsByOrg

func GetTransactionsByOrg(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /orgs/:orgId/transactions Get Transactions by Org Id
  • @apiVersion 1.4.0
  • @apiName GetOrgTransactions
  • @apiGroup Transaction *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} id Id of the Transaction.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {String} userId Id of the User who created the Transaction.
  • @apiSuccess {Date} date Date of the Transaction
  • @apiSuccess {Date} inserted Date Transaction was created
  • @apiSuccess {Date} updated Date Transaction was updated
  • @apiSuccess {String} description Description of Transaction
  • @apiSuccess {String} data Extra data field
  • @apiSuccess {Object[]} splits Array of Transaction Splits *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • [
  • {
  • "id": "11111111111111111111111111111111",
  • "orgId": "11111111111111111111111111111111",
  • "userId": "11111111111111111111111111111111",
  • "date": "2018-06-08T20:12:29.720Z",
  • "inserted": "2018-06-08T20:12:29.720Z",
  • "updated": "2018-06-08T20:12:29.720Z",
  • "description": "Treat friend to lunch",
  • "data:": "{\"key\": \"value\"}",
  • "splits": [
  • {
  • "accountId": "11111111111111111111111111111111",
  • "amount": -2000,
  • "nativeAmount": -2000
  • },
  • {
  • "accountId": "22222222222222222222222222222222",
  • "amount": 1000,
  • "nativeAmount": 1000
  • },
  • {
  • "accountId": "33333333333333333333333333333333",
  • "amount": 1000,
  • "nativeAmount": 1000
  • }
  • ]
  • }
  • ] *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func GetUser

func GetUser(w rest.ResponseWriter, r *rest.Request)

*

  • @api {get} /user Get Authenticated User
  • @apiVersion 1.4.0
  • @apiName GetUser
  • @apiGroup User *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiSuccess {String} id Id of the User.
  • @apiSuccess {Date} inserted Date User was created
  • @apiSuccess {Date} updated Date User was updated
  • @apiSuccess {String} firstName First name of the User.
  • @apiSuccess {String} lastName Last name of the User.
  • @apiSuccess {String} email Email of the User.
  • @apiSuccess {Boolean} agreeToTerms Agree to terms
  • @apiSuccess {Boolean} emailVerified True if email has been verified.
  • @apiSuccess {String} signupSource Identify signup source (android, ios, web) *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "firstName": "John",
  • "lastName": "Doe",
  • "email": "johndoe@email.com",
  • "agreeToTerms": true,
  • "emailVerified": true,
  • "signupSource": "web"
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func Init

func Init(prefix string) (*rest.Api, error)

func PostAccount

func PostAccount(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /orgs/:orgId/accounts Create a new Account
  • @apiVersion 1.4.0
  • @apiName PostAccount
  • @apiGroup Account *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} id Id 32 character hex string
  • @apiParam {String} name Name of the Account.
  • @apiParam {String} parent Id of the parent Account.
  • @apiParam {String} currency Three letter currency code.
  • @apiParam {Number} precision How many digits the currency goes out to.
  • @apiParam {Boolean} debitBalance True if account has a debit balance.
  • @apiParam {Number} balance Current Account balance in this Account's currency
  • @apiParam {Number} nativeBalance Current Account balance in the Org's currency *
  • @apiSuccess {String} id Id of the Account.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {Date} inserted Date Account was created
  • @apiSuccess {Date} updated Date Account was updated
  • @apiSuccess {String} name Name of the Account.
  • @apiSuccess {String} parent Id of the parent Account.
  • @apiSuccess {String} currency Three letter currency code.
  • @apiSuccess {Number} precision How many digits the currency goes out to.
  • @apiSuccess {Boolean} debitBalance True if account has a debit balance.
  • @apiSuccess {Number} balance Current Account balance in this Account's currency
  • @apiSuccess {Number} nativeBalance Current Account balance in the Org's currency *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "22222222222222222222222222222222",
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "name": "Cash",
  • "parent": "11111111111111111111111111111111",
  • "currency": "USD",
  • "precision": 2,
  • "debitBalance": true,
  • "balance": 10000,
  • "nativeBalance": 10000
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PostAccounts

func PostAccounts(w rest.ResponseWriter, r *rest.Request, content []byte)

func PostApiKey

func PostApiKey(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /apikeys Create a new API key
  • @apiVersion 1.4.0
  • @apiName PostApiKey
  • @apiGroup ApiKey *
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning
  • @apiHeader {String} Authorization HTTP Basic Auth *
  • @apiParam {String} id 32 character hex string
  • @apiParam {String} label Label *
  • @apiSuccess {String} id Id of the ApiKey.
  • @apiSuccess {Date} inserted Date ApiKey was created
  • @apiSuccess {Date} updated Date Last activity for the ApiKey
  • @apiSuccess {String} userId Id of the User
  • @apiSuccess {String} label Label *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "userId": "22222222222222222222222222222222",
  • "label": "Shopping Cart"
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PostBudget

func PostBudget(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /orgs/:orgId/budget Create a Budget
  • @apiVersion 1.4.0
  • @apiName PostBudget
  • @apiGroup Budget *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {Object[]} items Array of Budget Items.
  • @apiParam {String} items.accountId Id of Expense Account
  • @apiParam {Number} items.amount Amount budgeted *
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {Date} inserted Date Budget was created
  • @apiSuccess {Object[]} items Array of Budget Items *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • [
  • {
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2020-01-13T20:12:29.720Z",
  • "items": [
  • {
  • "accountId": "11111111111111111111111111111111",
  • "amount": 35000,
  • },
  • {
  • "accountId": "22222222222222222222222222222222",
  • "amount": 55000
  • }
  • ]
  • }
  • ] *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PostInvite

func PostInvite(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /orgs/:orgId/invites Invite a user to an Org
  • @apiVersion 1.4.0
  • @apiName PostInvite
  • @apiGroup Org *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} email Email address of user *
  • @apiSuccess {String} id Id of the Invite
  • @apiSuccess {orgId} id Id of the Org
  • @apiSuccess {Date} inserted Date Invite was created
  • @apiSuccess {Date} updated Date Invite was updated/accepted
  • @apiSuccess {String} email Email address of user
  • @apiSuccess {String} accepted true if user has accepted *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "a1b2c3d4",
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "email": "johndoe@email.com",
  • "accepted": false
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PostOrg

func PostOrg(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /orgs Create a new Org
  • @apiVersion 1.4.0
  • @apiName PostOrg
  • @apiGroup Org *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} id Id 32 character hex string
  • @apiParam {String} name Name of the Org.
  • @apiParam {String} currency Three letter currency code.
  • @apiParam {Number} precision How many digits the currency goes out to.
  • @apiParam {String} timezone Timezone to use for accounting. *
  • @apiSuccess {String} id Id of the Org.
  • @apiSuccess {Date} inserted Date Org was created
  • @apiSuccess {Date} updated Date Org was updated
  • @apiSuccess {String} name Name of the Org.
  • @apiSuccess {String} currency Three letter currency code.
  • @apiSuccess {Number} precision How many digits the currency goes out to.
  • @apiSuccess {String} timezone Timezone to use for accounting. *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "name": "MyOrg",
  • "currency": "USD",
  • "precision": 2,
  • "timezone": "America/New_York"
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PostPrice

func PostPrice(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /orgs/:orgId/prices Create a new Price
  • @apiVersion 1.4.0
  • @apiName PostPrice
  • @apiGroup Price *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} id Id 32 character hex string.
  • @apiParam {String} orgId Id of the Org.
  • @apiParam {String} currency Currency code.
  • @apiParam {Date} date Date of the Price.
  • @apiParam {Number} price Price of currency measured in native Org currency. *
  • @apiSuccess {String} id Id of the Price.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {String} currency Currency code.
  • @apiSuccess {Date} date Date of the Price.
  • @apiSuccess {Date} inserted Date when Price was posted.
  • @apiSuccess {Date} updated Date when Price was updated.
  • @apiSuccess {Number} price Price of currency measured in native Org currency. *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "orgId": "11111111111111111111111111111111",
  • "currency": "EUR",
  • "date": "2018-09-11T18:05:04.420Z",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "price": 1.16
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PostSession

func PostSession(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /sessions Create a new Session
  • @apiVersion 1.4.0
  • @apiName PostSession
  • @apiGroup Session *
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning
  • @apiHeader {String} Authorization HTTP Basic Auth *
  • @apiParam {String} id 32 character hex string *
  • @apiSuccess {String} id Id of the Session.
  • @apiSuccess {Date} inserted Date Session was created
  • @apiSuccess {Date} updated Date Last activity for the Session
  • @apiSuccess {String} userId Id of the User *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "userId": "22222222222222222222222222222222"
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PostTransaction

func PostTransaction(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /orgs/:orgId/transactions Create a new Transaction
  • @apiVersion 1.4.0
  • @apiName PostTransaction
  • @apiGroup Transaction *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} id Id 32 character hex string
  • @apiParam {Date} date Date of the Transaction
  • @apiParam {String} description Description of Transaction
  • @apiParam {String} data Extra data field
  • @apiParam {Object[]} splits Array of Transaction Splits. nativeAmounts must add up to 0.
  • @apiParam {String} splits.accountId Id of Account
  • @apiParam {Number} splits.amount Amount of split in Account currency
  • @apiParam {Number} splits.nativeAmount Amount of split in Org currency *
  • @apiSuccess {String} id Id of the Transaction.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {String} userId Id of the User who created the Transaction.
  • @apiSuccess {Date} date Date of the Transaction
  • @apiSuccess {Date} inserted Date Transaction was created
  • @apiSuccess {Date} updated Date Transaction was updated
  • @apiSuccess {String} description Description of Transaction
  • @apiSuccess {String} data Extra data field
  • @apiSuccess {Object[]} splits Array of Transaction Splits *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "orgId": "11111111111111111111111111111111",
  • "userId": "11111111111111111111111111111111",
  • "date": "2018-06-08T20:12:29.720Z",
  • "inserted": "2018-06-08T20:12:29.720Z",
  • "updated": "2018-06-08T20:12:29.720Z",
  • "description": "Treat friend to lunch",
  • "data:": "{\"key\": \"value\"}",
  • "splits": [
  • {
  • "accountId": "11111111111111111111111111111111",
  • "amount": -2000,
  • "nativeAmount": -2000
  • },
  • {
  • "accountId": "22222222222222222222222222222222",
  • "amount": 1000,
  • "nativeAmount": 1000
  • },
  • {
  • "accountId": "33333333333333333333333333333333",
  • "amount": 1000,
  • "nativeAmount": 1000
  • }
  • ]
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PostUser

func PostUser(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /users Create a new User
  • @apiVersion 1.4.0
  • @apiName PostUser
  • @apiGroup User *
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} id 32 character hex string
  • @apiParam {String} firstName First name of the User.
  • @apiParam {String} lastName Last name of the User.
  • @apiParam {String} email Email of the User.
  • @apiParam {String} password Password of the User.
  • @apiParam {Boolean} agreeToTerms True if you agree to terms
  • @apiParam {String} signupSource Identify signup source (android, ios, web) *
  • @apiSuccess {String} id Id of the User.
  • @apiSuccess {Date} inserted Date User was created
  • @apiSuccess {Date} updated Date User was updated
  • @apiSuccess {String} firstName First name of the User.
  • @apiSuccess {String} lastName Last name of the User.
  • @apiSuccess {String} email Email of the User.
  • @apiSuccess {Boolean} emailVerified True if email has been verified.
  • @apiSuccess {String} signupSource Identify signup source (android, ios, web) *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "firstName": "John",
  • "lastName": "Doe",
  • "email": "johndoe@email.com",
  • "agreeToTerms": true,
  • "emailVerified": true,
  • "signupSource": "web"
  • } *
  • @apiUse InternalServerError

func PutAccount

func PutAccount(w rest.ResponseWriter, r *rest.Request)

*

  • @api {put} /orgs/:orgId/accounts/:accountId Modify an Account
  • @apiVersion 1.4.0
  • @apiName PutAccount
  • @apiGroup Account *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} id Id 32 character hex string
  • @apiParam {String} name Name of the Account.
  • @apiParam {String} parent Id of the parent Account.
  • @apiParam {String} currency Three letter currency code.
  • @apiParam {Number} precision How many digits the currency goes out to.
  • @apiParam {Boolean} debitBalance True if Account has a debit balance.
  • @apiParam {Number} balance Current Account balance in this Account's currency
  • @apiParam {Number} nativeBalance Current Account balance in the Org's currency *
  • @apiSuccess {String} id Id of the Account.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {Date} inserted Date Account was created
  • @apiSuccess {Date} updated Date Account was updated
  • @apiSuccess {String} name Name of the Account.
  • @apiSuccess {String} parent Id of the parent Account.
  • @apiSuccess {String} currency Three letter currency code.
  • @apiSuccess {Number} precision How many digits the currency goes out to.
  • @apiSuccess {Boolean} debitBalance True if Account has a debit balance.
  • @apiSuccess {Number} balance Current Account balance in this Account's currency
  • @apiSuccess {Number} nativeBalance Current Account balance in the Org's currency *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "22222222222222222222222222222222",
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "name": "Cash",
  • "parent": "11111111111111111111111111111111",
  • "currency": "USD",
  • "precision": 2,
  • "debitBalance": true,
  • "balance": 10000,
  • "nativeBalance": 10000
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PutApiKey

func PutApiKey(w rest.ResponseWriter, r *rest.Request)

*

  • @api {put} /apikeys Modify an API key
  • @apiVersion 1.4.0
  • @apiName PutApiKey
  • @apiGroup ApiKey *
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning
  • @apiHeader {String} Authorization HTTP Basic Auth *
  • @apiParam {String} id 32 character hex string
  • @apiParam {String} label Label *
  • @apiSuccess {String} id Id of the ApiKey.
  • @apiSuccess {Date} inserted Date ApiKey was created
  • @apiSuccess {Date} updated Date Last activity for the ApiKey
  • @apiSuccess {String} userId Id of the User
  • @apiSuccess {String} label Label *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "userId": "22222222222222222222222222222222",
  • "label": "Shopping Cart"
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PutInvite

func PutInvite(w rest.ResponseWriter, r *rest.Request)

*

  • @api {put} /orgs/:orgId/invites/:inviteId Accept an invitation
  • @apiVersion 1.4.0
  • @apiName PutInvite
  • @apiGroup Org *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} accepted true *
  • @apiSuccess {String} id Id of the Invite
  • @apiSuccess {orgId} id Id of the Org
  • @apiSuccess {Date} inserted Date Invite was created
  • @apiSuccess {Date} updated Date Invite was updated/accepted
  • @apiSuccess {String} email Email address of user
  • @apiSuccess {String} accepted true if user has accepted *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "a1b2c3d4",
  • "orgId": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "email": "johndoe@email.com",
  • "accepted": true
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PutOrg

func PutOrg(w rest.ResponseWriter, r *rest.Request)

*

  • @api {put} /orgs/:orgId Modify an Org
  • @apiVersion 1.4.0
  • @apiName PutOrg
  • @apiGroup Org *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} name Name of the Org. *
  • @apiSuccess {String} id Id of the Org.
  • @apiSuccess {Date} inserted Date Org was created
  • @apiSuccess {Date} updated Date Org was updated
  • @apiSuccess {String} name Name of the Org.
  • @apiSuccess {String} currency Three letter currency code.
  • @apiSuccess {Number} precision How many digits the currency goes out to.
  • @apiSuccess {String} timezone Timezone to use for accounting. *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "name": "MyOrg",
  • "currency": "USD",
  • "precision": 2,
  • "timezone": "America/New_York"
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PutTransaction

func PutTransaction(w rest.ResponseWriter, r *rest.Request)

*

  • @api {put} /orgs/:orgId/transactions/:transactionId Modify a Transaction
  • @apiVersion 1.4.0
  • @apiName PutTransaction
  • @apiGroup Transaction *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} id 32 character hex string
  • @apiParam {Date} date Date of the Transaction
  • @apiParam {String} description Description of Transaction
  • @apiParam {String} data Extra data field
  • @apiParam {Object[]} splits Array of Transaction Splits. nativeAmounts must add up to 0.
  • @apiParam {String} splits.accountId Id of Account
  • @apiParam {Number} splits.amount Amount of split in Account currency
  • @apiParam {Number} splits.nativeAmount Amount of split in Org currency *
  • @apiSuccess {String} id Id of the Transaction.
  • @apiSuccess {String} orgId Id of the Org.
  • @apiSuccess {String} userId Id of the User who created the Transaction.
  • @apiSuccess {Date} date Date of the Transaction
  • @apiSuccess {Date} inserted Date Transaction was created
  • @apiSuccess {Date} updated Date Transaction was updated
  • @apiSuccess {String} description Description of Transaction
  • @apiSuccess {String} data Extra data field
  • @apiSuccess {Object[]} splits Array of Transaction Splits *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "orgId": "11111111111111111111111111111111",
  • "userId": "11111111111111111111111111111111",
  • "date": "2018-06-08T20:12:29.720Z",
  • "inserted": "2018-06-08T20:12:29.720Z",
  • "updated": "2018-06-08T20:12:29.720Z",
  • "description": "Treat friend to lunch",
  • "data:": "{\"key\": \"value\"}",
  • "splits": [
  • {
  • "accountId": "11111111111111111111111111111111",
  • "amount": -2000,
  • "nativeAmount": -2000
  • },
  • {
  • "accountId": "22222222222222222222222222222222",
  • "amount": 1000,
  • "nativeAmount": 1000
  • },
  • {
  • "accountId": "33333333333333333333333333333333",
  • "amount": 1000,
  • "nativeAmount": 1000
  • }
  • ]
  • } *
  • @apiUse NotAuthorizedError
  • @apiUse InternalServerError

func PutUser

func PutUser(w rest.ResponseWriter, r *rest.Request)

*

  • @api {put} /user Modify User
  • @apiVersion 1.4.0
  • @apiName PutUser
  • @apiGroup User *
  • @apiHeader {String} Authorization HTTP Basic Auth
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} password New password
  • @apiParam {String} code Password reset code. (Instead of Authorization header) *
  • @apiSuccess {String} id Id of the User.
  • @apiSuccess {Date} inserted Date User was created
  • @apiSuccess {Date} updated Date User was updated
  • @apiSuccess {String} firstName First name of the User.
  • @apiSuccess {String} lastName Last name of the User.
  • @apiSuccess {String} email Email of the User.
  • @apiSuccess {Boolean} emailVerified True if email has been verified.
  • @apiSuccess {String} signupSource Identify signup source (android, ios, web) *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK
  • {
  • "id": "11111111111111111111111111111111",
  • "inserted": "2018-09-11T18:05:04.420Z",
  • "updated": "2018-09-11T18:05:04.420Z",
  • "firstName": "John",
  • "lastName": "Doe",
  • "email": "johndoe@email.com",
  • "agreeToTerms": true,
  • "emailVerified": true,
  • "signupSource": "web"
  • } *
  • @apiUse InternalServerError

func ResetPassword

func ResetPassword(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /user/reset-password Send reset password email
  • @apiVersion 1.4.0
  • @apiName ResetPassword
  • @apiGroup User *
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} email Email address for user *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse InternalServerError

func VerifyUser

func VerifyUser(w rest.ResponseWriter, r *rest.Request)

*

  • @api {post} /user/verify Verify user email address
  • @apiVersion 1.4.0
  • @apiName VerifyUser
  • @apiGroup User *
  • @apiHeader {String} Accept-Version ^1.4.0 semver versioning *
  • @apiParam {String} code Email verification code *
  • @apiSuccessExample Success-Response:
  • HTTP/1.1 200 OK *
  • @apiUse InternalServerError

Types

type AuthMiddleware

type AuthMiddleware struct {

	// Realm name to display to the user. Required.
	Realm string
}

func (*AuthMiddleware) MiddlewareFunc

func (mw *AuthMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc

MiddlewareFunc makes AuthMiddleware implement the Middleware interface.

func (*AuthMiddleware) RequireAuth

func (mw *AuthMiddleware) RequireAuth(handler rest.HandlerFunc) rest.HandlerFunc

type ConfirmResetPasswordParams

type ConfirmResetPasswordParams struct {
	Code     string `json:"code"`
	Password string `json:"password"`
}

type LoggerMiddleware

type LoggerMiddleware struct {
	Logger *log.Logger
}

func (*LoggerMiddleware) MiddlewareFunc

func (mw *LoggerMiddleware) MiddlewareFunc(h rest.HandlerFunc) rest.HandlerFunc

type ResetPasswordParams

type ResetPasswordParams struct {
	Email string `json:"email"`
}

type VerifyUserParams

type VerifyUserParams struct {
	Code string `json:"code"`
}

type VersionMiddleware

type VersionMiddleware struct {
}

func (*VersionMiddleware) MiddlewareFunc

func (mw *VersionMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc

MiddlewareFunc makes AuthMiddleware implement the Middleware interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL