@lunch-money/v2-api-spec 2.11.1-preview.2 → 2.11.1-preview.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -66
- package/lunch-money-api-v2.yaml +17 -15
- package/package.json +2 -3
- package/update-urls.sh +0 -135
package/README.md
CHANGED
|
@@ -39,73 +39,11 @@ npx @openapitools/openapi-generator-cli generate \
|
|
|
39
39
|
npx swagger-cli validate node_modules/@lunch-money/v2-api-spec/lunch-money-api-v2.yaml
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
###
|
|
42
|
+
### Spec URLs
|
|
43
43
|
|
|
44
|
-
The
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
The script is located at `node_modules/@lunch-money/v2-api-spec/update-urls.sh`.
|
|
49
|
-
|
|
50
|
-
**Required flags:**
|
|
51
|
-
- `--local` - Switch URLs to local development (default: `http://localhost:3000/v2`)
|
|
52
|
-
- `--production` - Switch URLs to production deployment URLs
|
|
53
|
-
|
|
54
|
-
**Switch to production URLs (using defaults):**
|
|
55
|
-
```bash
|
|
56
|
-
cd node_modules/@lunch-money/v2-api-spec
|
|
57
|
-
./update-urls.sh --production
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**Switch to production URLs (with custom URLs):**
|
|
61
|
-
```bash
|
|
62
|
-
cd node_modules/@lunch-money/v2-api-spec
|
|
63
|
-
API_DEPLOY_URL=https://api.lunchmoney.app/v2 \
|
|
64
|
-
DOCS_DEPLOY_URL=https://alpha.lunchmoney.app/v2 \
|
|
65
|
-
./update-urls.sh --production
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Switch to local URLs:**
|
|
69
|
-
```bash
|
|
70
|
-
cd node_modules/@lunch-money/v2-api-spec
|
|
71
|
-
./update-urls.sh --local
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**Switch to local URLs (with custom local URL):**
|
|
75
|
-
```bash
|
|
76
|
-
cd node_modules/@lunch-money/v2-api-spec
|
|
77
|
-
LOCAL_URL=http://localhost:4000/v2 ./update-urls.sh --local
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**Using environment variables:**
|
|
81
|
-
Create a `.env` file in the package directory:
|
|
82
|
-
```bash
|
|
83
|
-
LOCAL_URL=http://localhost:3000/v2
|
|
84
|
-
API_DEPLOY_URL=https://api.lunchmoney.app/v2
|
|
85
|
-
DOCS_DEPLOY_URL=https://alpha.lunchmoney.app/v2
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Then run:
|
|
89
|
-
```bash
|
|
90
|
-
./update-urls.sh --production
|
|
91
|
-
# or
|
|
92
|
-
./update-urls.sh --local
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### How It Works
|
|
96
|
-
|
|
97
|
-
The script updates the `servers` section in the OpenAPI specification:
|
|
98
|
-
- **Server 1**: Typically the production API server
|
|
99
|
-
- **Server 2**: Typically a mock or staging server
|
|
100
|
-
|
|
101
|
-
It also updates any references to these URLs throughout the specification file.
|
|
102
|
-
|
|
103
|
-
#### Important Notes
|
|
104
|
-
|
|
105
|
-
- The script modifies the spec file in place
|
|
106
|
-
- Changes are not persisted across `npm install` - the package will be restored to its original state
|
|
107
|
-
- For persistent changes, consider copying the spec to your project directory first
|
|
108
|
-
- The script works in both the npm package and the git repository
|
|
44
|
+
The published YAML uses public production docs/API URLs. Do not rewrite them in this
|
|
45
|
+
package for local or deploy environments — consuming apps (for example the Lunch Money
|
|
46
|
+
docs/mock server) should rewrite an installed copy when needed.
|
|
109
47
|
|
|
110
48
|
## Versioning
|
|
111
49
|
|
package/lunch-money-api-v2.yaml
CHANGED
|
@@ -2,11 +2,13 @@ openapi: 3.0.2
|
|
|
2
2
|
info:
|
|
3
3
|
title: Lunch Money API - v2
|
|
4
4
|
description: |-
|
|
5
|
+
Welcome to the Lunch Money v2 API reference. This is the **v2.11.1** spec.
|
|
6
|
+
|
|
5
7
|
### Introduction
|
|
6
8
|
|
|
7
|
-
The API is available at `https://
|
|
9
|
+
The API is available at `https://lunchmoney.dev/v2`. Get your access token from the [Lunch Money developers page](https://my.lunchmoney.app/developers).
|
|
8
10
|
|
|
9
|
-
<span class="red-text"><strong>
|
|
11
|
+
API calls can <span class="red-text"><strong>change or delete</strong></span> your data. Any changes you make are <span class="red-text"><strong>permanent</strong></span>, just like they would be if you made changes using the web or mobile app. Please refer to the [Getting Started Guide](https://lunchmoney.dev/v2/getting-started) before using the API.
|
|
10
12
|
|
|
11
13
|
**Static Mock Server**
|
|
12
14
|
|
|
@@ -18,15 +20,15 @@ info:
|
|
|
18
20
|
|
|
19
21
|
**Migrating from v1**
|
|
20
22
|
|
|
21
|
-
The v2 API is not backwards compatible with v1. See the [Migration Guide](https://
|
|
23
|
+
The v2 API is not backwards compatible with v1. See the [Migration Guide](https://lunchmoney.dev/v2/migration-guide) for details.
|
|
22
24
|
|
|
23
25
|
**Useful links**
|
|
24
|
-
- [Developer Portal](https://
|
|
25
|
-
- [Getting Started Guide](https://
|
|
26
|
-
- [v2 API Overview](https://
|
|
27
|
-
- [Version History](https://
|
|
28
|
-
- [Migration Guide](https://
|
|
29
|
-
- [Rate Limits](https://
|
|
26
|
+
- [Developer Portal](https://lunchmoney.dev/v2/introduction)
|
|
27
|
+
- [Getting Started Guide](https://lunchmoney.dev/v2/getting-started)
|
|
28
|
+
- [v2 API Overview](https://lunchmoney.dev/v2/overview)
|
|
29
|
+
- [Version History](https://lunchmoney.dev/v2/version-history)
|
|
30
|
+
- [Migration Guide](https://lunchmoney.dev/v2/migration-guide)
|
|
31
|
+
- [Rate Limits](https://lunchmoney.dev/v2/rate-limits)
|
|
30
32
|
termsOfService: https://lunchmoney.dev/#current-status
|
|
31
33
|
contact:
|
|
32
34
|
email: devsupport@lunchmoney.app
|
|
@@ -38,8 +40,8 @@ info:
|
|
|
38
40
|
servers:
|
|
39
41
|
- url: https://api.lunchmoney.dev/v2
|
|
40
42
|
description: v2 Lunch Money API Server - changes will affect real data!
|
|
41
|
-
# - url: https://
|
|
42
|
-
- url: https://
|
|
43
|
+
# - url: https://lunchmoney.dev/v2
|
|
44
|
+
- url: https://lunchmoney.dev/v2
|
|
43
45
|
description: Static mock version of the v2 Lunch Money API Server
|
|
44
46
|
|
|
45
47
|
tags:
|
|
@@ -2940,7 +2942,7 @@ components:
|
|
|
2940
2942
|
currency:
|
|
2941
2943
|
description: Three-letter lowercase currency code of the transaction
|
|
2942
2944
|
in ISO 4217 format. Must match one of the [supported
|
|
2943
|
-
currencies](https://
|
|
2945
|
+
currencies](https://lunchmoney.dev/v2/currencies). If not set
|
|
2944
2946
|
defaults to the user account's primary currency.
|
|
2945
2947
|
allOf:
|
|
2946
2948
|
- $ref: "#/components/schemas/currencyEnum"
|
|
@@ -9097,19 +9099,19 @@ paths:
|
|
|
9097
9099
|
description: Sets the maximum number of transactions to return. If
|
|
9098
9100
|
more match the filter criteria, the response will include a
|
|
9099
9101
|
`has_more` attribute set to `true`. See
|
|
9100
|
-
[Pagination](https://
|
|
9102
|
+
[Pagination](https://lunchmoney.dev/v2/pagination)
|
|
9101
9103
|
- name: offset
|
|
9102
9104
|
in: query
|
|
9103
9105
|
schema:
|
|
9104
9106
|
type: integer
|
|
9105
9107
|
description: Sets the offset for the records returned. This is
|
|
9106
9108
|
typically set automatically in the header. See
|
|
9107
|
-
[Pagination](https://
|
|
9109
|
+
[Pagination](https://lunchmoney.dev/v2/pagination)
|
|
9108
9110
|
responses:
|
|
9109
9111
|
"200":
|
|
9110
9112
|
description: Returns an array of transactions. <br><br>The `has_more`
|
|
9111
9113
|
property is set to `true` if more transactions are available. See
|
|
9112
|
-
[Pagination](https://
|
|
9114
|
+
[Pagination](https://lunchmoney.dev/v2/pagination)
|
|
9113
9115
|
content:
|
|
9114
9116
|
application/json:
|
|
9115
9117
|
schema:
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunch-money/v2-api-spec",
|
|
3
|
-
"version": "2.11.1-preview.
|
|
3
|
+
"version": "2.11.1-preview.4",
|
|
4
4
|
"description": "OpenAPI specification and version history for the Lunch Money v2 API",
|
|
5
5
|
"main": "lunch-money-api-v2.yaml",
|
|
6
6
|
"files": [
|
|
7
7
|
"lunch-money-api-v2.yaml",
|
|
8
8
|
"version-history.md",
|
|
9
|
-
"README.md"
|
|
10
|
-
"update-urls.sh"
|
|
9
|
+
"README.md"
|
|
11
10
|
],
|
|
12
11
|
"scripts": {
|
|
13
12
|
"prepare": "husky install",
|
package/update-urls.sh
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Script to update URLs in the OpenAPI specification file
|
|
4
|
-
# This is useful for switching the docs/mock server URL between local development and production
|
|
5
|
-
# Note: All references to DOCS_DEPLOY_URL throughout the file are toggled; the API server URL remains unchanged
|
|
6
|
-
#
|
|
7
|
-
# Usage:
|
|
8
|
-
# # In git repo:
|
|
9
|
-
# ./scripts/update-urls.sh --local|--production
|
|
10
|
-
#
|
|
11
|
-
# # In npm package:
|
|
12
|
-
# ./update-urls.sh --local|--production
|
|
13
|
-
#
|
|
14
|
-
# Flags:
|
|
15
|
-
# --local Switch docs/mock server URL to local development (http://localhost:3000/v2)
|
|
16
|
-
# --production Switch docs/mock server URL to production deployment URL
|
|
17
|
-
#
|
|
18
|
-
# Environment variables (optional, with defaults):
|
|
19
|
-
# LOCAL_URL - Local development URL (default: http://localhost:3000/v2)
|
|
20
|
-
# DOCS_DEPLOY_URL - Docs/mock deployment URL (default: https://alpha.lunchmoney.dev/v2)
|
|
21
|
-
#
|
|
22
|
-
# Examples:
|
|
23
|
-
# # Switch to production URL (using defaults)
|
|
24
|
-
# ./update-urls.sh --production
|
|
25
|
-
#
|
|
26
|
-
# # Switch to production URL (with custom URL)
|
|
27
|
-
# DOCS_DEPLOY_URL=https://alpha.lunchmoney.dev/v2 ./update-urls.sh --production
|
|
28
|
-
#
|
|
29
|
-
# # Switch to local URL
|
|
30
|
-
# ./update-urls.sh --local
|
|
31
|
-
#
|
|
32
|
-
# # Switch to local URL (with custom local URL)
|
|
33
|
-
# LOCAL_URL=http://localhost:4000/v2 ./update-urls.sh --local
|
|
34
|
-
|
|
35
|
-
set -e
|
|
36
|
-
|
|
37
|
-
# Get the directory where the script is located
|
|
38
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
39
|
-
|
|
40
|
-
# Determine if we're in the git repo or npm package
|
|
41
|
-
# In git repo: script is in scripts/ subdirectory, spec is in v2/spec/
|
|
42
|
-
# In npm package: script is at root, spec is at root
|
|
43
|
-
if [ -f "$SCRIPT_DIR/../v2/spec/lunch-money-api-v2.yaml" ]; then
|
|
44
|
-
# In the git repo (script is in scripts/ subdirectory)
|
|
45
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
46
|
-
SPEC_FILE="$REPO_ROOT/v2/spec/lunch-money-api-v2.yaml"
|
|
47
|
-
elif [ -f "$SCRIPT_DIR/lunch-money-api-v2.yaml" ]; then
|
|
48
|
-
# In the npm package (script is at root, spec is in same directory)
|
|
49
|
-
REPO_ROOT="$SCRIPT_DIR"
|
|
50
|
-
SPEC_FILE="$REPO_ROOT/lunch-money-api-v2.yaml"
|
|
51
|
-
else
|
|
52
|
-
echo "Error: Could not find lunch-money-api-v2.yaml"
|
|
53
|
-
echo " Looked in: $SCRIPT_DIR/v2/spec/"
|
|
54
|
-
echo " Looked in: $SCRIPT_DIR/"
|
|
55
|
-
exit 1
|
|
56
|
-
fi
|
|
57
|
-
|
|
58
|
-
# Load environment variables from .env file if it exists and variables are not already set
|
|
59
|
-
if [ -f "$REPO_ROOT/.env" ]; then
|
|
60
|
-
export $(grep -v '^#' "$REPO_ROOT/.env" | xargs)
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
|
-
# Set default values for the URLs if not provided
|
|
64
|
-
LOCAL_URL=${LOCAL_URL:-"http://localhost:3000/v2"}
|
|
65
|
-
DOCS_DEPLOY_URL=${DOCS_DEPLOY_URL:-"https://alpha.lunchmoney.dev/v2"}
|
|
66
|
-
|
|
67
|
-
# Function to show help and exit
|
|
68
|
-
show_help() {
|
|
69
|
-
echo "Usage: $0 --local|--production"
|
|
70
|
-
echo ""
|
|
71
|
-
echo "Flags (required):"
|
|
72
|
-
echo " --local Switch docs/mock server URL to local development"
|
|
73
|
-
echo " --production Switch docs/mock server URL to production deployment"
|
|
74
|
-
echo ""
|
|
75
|
-
echo "Environment variables (optional, with defaults):"
|
|
76
|
-
echo " LOCAL_URL Local development URL (default: http://localhost:3000/v2)"
|
|
77
|
-
echo " DOCS_DEPLOY_URL Docs/mock deployment URL (default: https://alpha.lunchmoney.dev/v2)"
|
|
78
|
-
echo ""
|
|
79
|
-
echo "Examples:"
|
|
80
|
-
echo " # Switch to production URL (using defaults)"
|
|
81
|
-
echo " $0 --production"
|
|
82
|
-
echo ""
|
|
83
|
-
echo " # Switch to production URL (with custom URL)"
|
|
84
|
-
echo " DOCS_DEPLOY_URL=https://alpha.lunchmoney.dev/v2 $0 --production"
|
|
85
|
-
echo ""
|
|
86
|
-
echo " # Switch to local URL"
|
|
87
|
-
echo " $0 --local"
|
|
88
|
-
echo ""
|
|
89
|
-
echo " # Switch to local URL (with custom local URL)"
|
|
90
|
-
echo " LOCAL_URL=http://localhost:4000/v2 $0 --local"
|
|
91
|
-
echo ""
|
|
92
|
-
echo "Note: Environment variables can also be set in a .env file in the repository root."
|
|
93
|
-
echo "Note: All references to DOCS_DEPLOY_URL throughout the file are updated; the API server URL remains unchanged."
|
|
94
|
-
exit 1
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
# Function to replace all occurrences of the docs/mock server URL in the spec file
|
|
98
|
-
replace_docs_url() {
|
|
99
|
-
local from_url=$1
|
|
100
|
-
local to_url=$2
|
|
101
|
-
|
|
102
|
-
if [ ! -f "$SPEC_FILE" ]; then
|
|
103
|
-
echo "Error: Spec file not found at $SPEC_FILE"
|
|
104
|
-
exit 1
|
|
105
|
-
fi
|
|
106
|
-
|
|
107
|
-
echo "Updating all references to docs/mock server URL in $SPEC_FILE..."
|
|
108
|
-
echo " From: $from_url"
|
|
109
|
-
echo " To: $to_url"
|
|
110
|
-
|
|
111
|
-
# Replace all occurrences of the URL throughout the entire file
|
|
112
|
-
# Using sed with proper escaping for URLs
|
|
113
|
-
# Escape special regex characters in from_url
|
|
114
|
-
escaped_from_url=$(echo "$from_url" | sed 's/[[\.*^$()+?{|]/\\&/g')
|
|
115
|
-
# Use a temporary file for cross-platform compatibility
|
|
116
|
-
sed "s|$escaped_from_url|$to_url|g" "$SPEC_FILE" > "$SPEC_FILE.tmp" && mv "$SPEC_FILE.tmp" "$SPEC_FILE"
|
|
117
|
-
|
|
118
|
-
echo "✓ URLs updated successfully"
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
# Check for required flag
|
|
122
|
-
if [ "$1" == "--local" ]; then
|
|
123
|
-
echo "Switching docs/mock server URL to local development..."
|
|
124
|
-
echo " Using LOCAL_URL: $LOCAL_URL"
|
|
125
|
-
replace_docs_url "$DOCS_DEPLOY_URL" "$LOCAL_URL"
|
|
126
|
-
elif [ "$1" == "--production" ]; then
|
|
127
|
-
echo "Switching docs/mock server URL to production..."
|
|
128
|
-
echo " Using DOCS_DEPLOY_URL: $DOCS_DEPLOY_URL"
|
|
129
|
-
replace_docs_url "$LOCAL_URL" "$DOCS_DEPLOY_URL"
|
|
130
|
-
else
|
|
131
|
-
echo "Error: A flag is required (--local or --production)"
|
|
132
|
-
echo ""
|
|
133
|
-
show_help
|
|
134
|
-
fi
|
|
135
|
-
|