@lunch-money/v2-api-spec 2.11.0-preview.7 → 2.11.0
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 +10 -73
- package/lunch-money-api-v2.yaml +490 -372
- package/package.json +11 -5
- package/version-history.md +20 -19
- package/README.md.backup +0 -217
- package/update-urls.sh +0 -135
package/package.json
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunch-money/v2-api-spec",
|
|
3
|
-
"version": "2.11.0
|
|
3
|
+
"version": "2.11.0",
|
|
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",
|
|
14
13
|
"prepublishOnly": "node scripts/prep-for-publish.js",
|
|
15
|
-
"postpublish": "node scripts/restore-readme.js"
|
|
14
|
+
"postpublish": "node scripts/restore-readme.js",
|
|
15
|
+
"publish:docs": "node scripts/publish-docs.js --tag preview",
|
|
16
|
+
"publish:spec": "node scripts/publish-spec.js --tag preview",
|
|
17
|
+
"publish:all": "npm run publish:docs && npm run publish:spec",
|
|
18
|
+
"publish:docs:latest": "node scripts/publish-docs.js",
|
|
19
|
+
"publish:spec:latest": "node scripts/publish-spec.js",
|
|
20
|
+
"publish:all:latest": "npm run publish:docs:latest && npm run publish:spec:latest",
|
|
21
|
+
"pack:docs": "node scripts/pack-docs.js",
|
|
22
|
+
"pack:spec": "node scripts/pack-spec.js"
|
|
16
23
|
},
|
|
17
24
|
"keywords": [
|
|
18
25
|
"lunchmoney",
|
|
@@ -26,4 +33,3 @@
|
|
|
26
33
|
"husky": "^8.0.3"
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
|
-
|
package/version-history.md
CHANGED
|
@@ -5,25 +5,26 @@ The Lunch Money API spec uses a modified version of SEMVER for its versioning me
|
|
|
5
5
|
- The minor version represents the number of main endpoints the current version of the spec supports. For example, a version of the API that supports the /me, /categories, and /transactions endpoints would have a minor version of 3.
|
|
6
6
|
- The revision number represents the number of updates since the last endpoint was added. For example, each time changes are made to one of the existing three APIs as described above, the revision number will be bumped.
|
|
7
7
|
|
|
8
|
-
## v2.11.0 -
|
|
9
|
-
- Add `
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
8
|
+
## v2.11.0 - Jul 31, 2026
|
|
9
|
+
- Add `/balance_history` endpoints:
|
|
10
|
+
- `GET /balance_history`
|
|
11
|
+
- `GET /balance_history/{account_type}/{account_id}`
|
|
12
|
+
- `GET /balance_history/crypto_synced/{account_id}/{symbol}`
|
|
13
|
+
- `PUT /balance_history/{account_type}/{account_id}`
|
|
14
|
+
- `PUT /balance_history/crypto_synced/{account_id}/{symbol}`
|
|
15
|
+
- `DELETE /balance_history/entries/{id}`
|
|
16
|
+
- `DELETE /balance_history/{account_type}/{account_id}`
|
|
17
|
+
- `DELETE /balance_history/crypto_synced/{account_id}/{symbol}`
|
|
18
|
+
- `PUT /balance_history/deleted/{account_id}/details`
|
|
19
|
+
- Remove `rollover_pool` from category objects in the `GET /summary` response
|
|
20
|
+
- Allow setting `external_id` on Plaid-account transactions
|
|
21
|
+
- Allow `null` for `category_id` and `notes` on split children to clear those values instead of inheriting from the parent
|
|
22
|
+
|
|
23
|
+
## v2.10.0 - Jul 31, 2026
|
|
24
|
+
- Add crypto endpoints:
|
|
25
|
+
- `GET /cryptocurrencies`
|
|
26
|
+
- `GET /crypto/manual`, `POST /crypto/manual`, `GET /crypto/manual/{id}`, `PUT /crypto/manual/{id}`, `DELETE /crypto/manual/{id}`
|
|
27
|
+
- `GET /crypto/synced`, `GET /crypto/synced/{id}`, `GET /crypto/synced/{id}/{symbol}`, `POST /crypto/synced/{id}/refresh`
|
|
27
28
|
|
|
28
29
|
## v2.9.4 - May 23, 2026
|
|
29
30
|
- Increase allowable length for transaction `notes`.
|
package/README.md.backup
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
# Lunch Money API Specifications and Documentation
|
|
2
|
-
|
|
3
|
-
This repository contains the official API specifications and documentation for the [Lunch Money](https://lunchmoney.app) API. Lunch Money is a delightfully simple personal finance and budgeting tool with a comprehensive developer API.
|
|
4
|
-
|
|
5
|
-
## Repository Structure
|
|
6
|
-
|
|
7
|
-
This repository is organized in a multi-version structure to support current and future API versions:
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
.
|
|
11
|
-
├── v2/ # Version 2 API specific content
|
|
12
|
-
│ ├── spec/ # OpenAPI specification (YAML)
|
|
13
|
-
│ ├── docs/ # Version-specific documentation guides
|
|
14
|
-
│ └── images/ # Images used in documentation
|
|
15
|
-
├── docs/ # Version-independent documentation
|
|
16
|
-
├── scripts/ # Build and publishing scripts
|
|
17
|
-
└── spec/ # Generated directory (created during npm publish)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Directory Details
|
|
21
|
-
|
|
22
|
-
#### `v2/spec/` - OpenAPI Specification
|
|
23
|
-
The OpenAPI 3.0 specification file (`lunch-money-api-v2.yaml`) defines the complete API contract:
|
|
24
|
-
- All available endpoints
|
|
25
|
-
- Request/response schemas
|
|
26
|
-
- Authentication requirements
|
|
27
|
-
- Error responses
|
|
28
|
-
- Example requests and responses
|
|
29
|
-
|
|
30
|
-
**This is the source of truth for the API.** Changes to the specification automatically update the interactive API documentation.
|
|
31
|
-
|
|
32
|
-
#### `v2/docs/` - Version-Specific Documentation Guides
|
|
33
|
-
Markdown files containing detailed guides and reference material specific to v2:
|
|
34
|
-
- `intro-to-v2.md` - Overview of the v2 API and key features
|
|
35
|
-
- `migration-guide.md` - Guide for migrating from v1 to v2
|
|
36
|
-
- `version-history.md` - Changelog of all API versions
|
|
37
|
-
|
|
38
|
-
These guides are written in Markdown and support custom rendering features (see below).
|
|
39
|
-
|
|
40
|
-
#### `v2/images/` - Documentation Assets
|
|
41
|
-
Images and screenshots used in the documentation guides.
|
|
42
|
-
|
|
43
|
-
#### `docs/` - Version-Independent Documentation
|
|
44
|
-
Shared documentation that applies across all API versions:
|
|
45
|
-
- `getting-started.md` - Quick start guide for new developers (applies to all API versions)
|
|
46
|
-
- `rate-limiting.md` - Rate limiting policies and best practices (applies to all API versions)
|
|
47
|
-
- Additional version-independent guides (e.g., pagination guidelines, general API concepts)
|
|
48
|
-
|
|
49
|
-
## OpenAPI Specification vs Documentation Guides
|
|
50
|
-
|
|
51
|
-
There are two types of content in this repository, each serving a different purpose:
|
|
52
|
-
|
|
53
|
-
### OpenAPI Specification (`v2/spec/lunch-money-api-v2.yaml`)
|
|
54
|
-
- **Purpose**: Machine-readable API contract
|
|
55
|
-
- **Format**: YAML (OpenAPI 3.0)
|
|
56
|
-
- **Used for**:
|
|
57
|
-
- Generating interactive API documentation
|
|
58
|
-
- Code generation for SDKs and client libraries
|
|
59
|
-
- API validation and testing
|
|
60
|
-
- IDE autocomplete and type checking
|
|
61
|
-
- **Editable**: Yes - changes here automatically update the docs
|
|
62
|
-
|
|
63
|
-
The OpenAPI spec is the authoritative source for:
|
|
64
|
-
- Endpoint definitions (paths, methods, parameters)
|
|
65
|
-
- Request/response schemas
|
|
66
|
-
- Authentication requirements
|
|
67
|
-
- Status codes and error formats
|
|
68
|
-
|
|
69
|
-
### Documentation Guides (`v2/docs/*.md`)
|
|
70
|
-
- **Purpose**: Human-readable guides and tutorials
|
|
71
|
-
- **Format**: Markdown with custom extensions
|
|
72
|
-
- **Used for**:
|
|
73
|
-
- Developer onboarding and tutorials
|
|
74
|
-
- Best practices and patterns
|
|
75
|
-
- Migration guides and changelogs
|
|
76
|
-
- Conceptual explanations
|
|
77
|
-
- **Editable**: Yes - written in Markdown with support for custom features
|
|
78
|
-
|
|
79
|
-
The guides provide context, examples, and explanations that complement the technical specification.
|
|
80
|
-
|
|
81
|
-
## Custom Markdown Features
|
|
82
|
-
|
|
83
|
-
The documentation system supports custom rendering features that enhance Markdown files. These features are processed when the documentation is served and can be used in any Markdown file in the `v2/docs/` directory.
|
|
84
|
-
|
|
85
|
-
### Callouts
|
|
86
|
-
|
|
87
|
-
Callouts are styled information boxes for highlighting important information, warnings, or tips.
|
|
88
|
-
|
|
89
|
-
**Syntax:**
|
|
90
|
-
```markdown
|
|
91
|
-
> [!TYPE]
|
|
92
|
-
> Title (optional)
|
|
93
|
-
>
|
|
94
|
-
> Content goes here. This can span multiple lines
|
|
95
|
-
> and include **markdown formatting**.
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**Supported Types:**
|
|
99
|
-
- `[!NOTE]` - General information or notes (blue styling)
|
|
100
|
-
- `[!TIP]` - Helpful tips or best practices (green styling)
|
|
101
|
-
- `[!WARNING]` - Warnings or important cautions (yellow/orange styling)
|
|
102
|
-
|
|
103
|
-
**Example:**
|
|
104
|
-
```markdown
|
|
105
|
-
> [!NOTE]
|
|
106
|
-
> API Rate Limits
|
|
107
|
-
>
|
|
108
|
-
> The API has a rate limit of 1000 requests per 5 minutes per IP address.
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Tabs
|
|
112
|
-
|
|
113
|
-
Tabs organize content into multiple tabbed sections, useful for showing different code examples, API versions, or alternative approaches.
|
|
114
|
-
|
|
115
|
-
**Syntax:**
|
|
116
|
-
```markdown
|
|
117
|
-
:::tabs
|
|
118
|
-
@tab Tab Label 1
|
|
119
|
-
Content for the first tab. This can include **markdown** and code blocks.
|
|
120
|
-
|
|
121
|
-
@tab Tab Label 2
|
|
122
|
-
Content for the second tab. You can have as many tabs as needed.
|
|
123
|
-
:::
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
**Example: Code Examples in Multiple Languages**
|
|
127
|
-
```markdown
|
|
128
|
-
:::tabs
|
|
129
|
-
@tab cURL
|
|
130
|
-
```bash
|
|
131
|
-
curl -X GET "https://api.lunchmoney.app/v2/transactions" \
|
|
132
|
-
-H "Authorization: Bearer YOUR_API_TOKEN"
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
@tab JavaScript
|
|
136
|
-
```javascript
|
|
137
|
-
const response = await fetch('https://api.lunchmoney.app/v2/transactions', {
|
|
138
|
-
headers: {
|
|
139
|
-
'Authorization': 'Bearer YOUR_API_TOKEN'
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
```
|
|
143
|
-
:::
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
**Usage Notes:**
|
|
147
|
-
- Each tab must start with `@tab` followed by the tab label
|
|
148
|
-
- The first tab is active by default when the page loads
|
|
149
|
-
- Tab content can include any markdown, including code blocks, lists, callouts, tables, and links
|
|
150
|
-
- You can combine callouts and tabs in various ways
|
|
151
|
-
|
|
152
|
-
## Versioning
|
|
153
|
-
|
|
154
|
-
The Lunch Money API uses a modified version of SEMVER:
|
|
155
|
-
|
|
156
|
-
- **Major version**: The API version (currently 2)
|
|
157
|
-
- **Minor version**: The number of main endpoints (OpenAPI tags) the spec supports
|
|
158
|
-
- **Revision number**: The number of updates since the last endpoint was added
|
|
159
|
-
|
|
160
|
-
For example, version `2.8.2` means:
|
|
161
|
-
- API version 2
|
|
162
|
-
- 8 main endpoint groups
|
|
163
|
-
- 2 updates since the 8th endpoint was added
|
|
164
|
-
|
|
165
|
-
Details of each version can be found in [`v2/docs/version-history.md`](./v2/docs/version-history.md).
|
|
166
|
-
|
|
167
|
-
### Branch Naming Convention
|
|
168
|
-
|
|
169
|
-
Each API version is maintained on a branch named after the version number (e.g., `v2.8.2`). The `main` branch typically tracks the most recent version.
|
|
170
|
-
|
|
171
|
-
## Using This Repository
|
|
172
|
-
|
|
173
|
-
### As an npm Package
|
|
174
|
-
|
|
175
|
-
This repository is published as `@lunchmoney/v2-api-spec` on npm for lightweight consumption:
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
npm install @lunchmoney/v2-api-spec
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
After installation, you can access:
|
|
182
|
-
- OpenAPI spec: `node_modules/@lunchmoney/v2-api-spec/spec/lunch-money-api-v2.yaml`
|
|
183
|
-
- Version history: `node_modules/@lunchmoney/v2-api-spec/spec/version-history.md`
|
|
184
|
-
|
|
185
|
-
### As a Git Repository
|
|
186
|
-
|
|
187
|
-
You can clone this repository directly:
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
git clone https://github.com/lunch-money/api-specs.git
|
|
191
|
-
cd api-specs
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Or add it as a submodule to your project:
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
git submodule add https://github.com/lunch-money/api-specs.git specs/v2
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
## Contributing
|
|
201
|
-
|
|
202
|
-
We welcome contributions to improve the API documentation! When contributing:
|
|
203
|
-
|
|
204
|
-
1. **For API reference changes**: Update the OpenAPI specification in `v2/spec/lunch-money-api-v2.yaml`
|
|
205
|
-
2. **For documentation**: Update the relevant Markdown files in `v2/docs/`
|
|
206
|
-
3. **Version updates**: Update `v2/docs/version-history.md` with your changes
|
|
207
|
-
4. Create a pull request with a clear description of your changes
|
|
208
|
-
|
|
209
|
-
Please ensure that:
|
|
210
|
-
- OpenAPI spec changes are valid YAML and conform to OpenAPI 3.0
|
|
211
|
-
- Documentation follows the existing style and uses the custom Markdown features appropriately
|
|
212
|
-
|
|
213
|
-
## Resources
|
|
214
|
-
|
|
215
|
-
- [Lunch Money Website](https://lunchmoney.app)
|
|
216
|
-
- [Interactive API Documentation](https://alpha.lunchmoney.dev/v2/docs)
|
|
217
|
-
- [API Status](https://status.lunchmoney.app)
|
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
|
-
|