@lunch-money/v2-api-spec 2.8.2
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 +136 -0
- package/README.md.backup +217 -0
- package/lunch-money-api-v2.yaml +8231 -0
- package/package.json +29 -0
- package/update-urls.sh +155 -0
- package/version-history.md +310 -0
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# @lunch-money/v2-api-spec
|
|
2
|
+
|
|
3
|
+
OpenAPI specification and version history for the Lunch Money v2 API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lunch-money/v2-api-spec
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
After installation, the package provides:
|
|
14
|
+
|
|
15
|
+
- **OpenAPI Specification**: `node_modules/@lunch-money/v2-api-spec/lunch-money-api-v2.yaml`
|
|
16
|
+
- **Version History**: `node_modules/@lunch-money/v2-api-spec/version-history.md`
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Accessing the OpenAPI Specification
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
const fs = require('fs');
|
|
24
|
+
const path = require('path');
|
|
25
|
+
|
|
26
|
+
const specPath = path.join(
|
|
27
|
+
__dirname,
|
|
28
|
+
'node_modules/@lunch-money/v2-api-spec/lunch-money-api-v2.yaml'
|
|
29
|
+
);
|
|
30
|
+
const spec = fs.readFileSync(specPath, 'utf8');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Using with OpenAPI Tools
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Generate TypeScript types
|
|
37
|
+
npx @openapitools/openapi-generator-cli generate \
|
|
38
|
+
-i node_modules/@lunch-money/v2-api-spec/lunch-money-api-v2.yaml \
|
|
39
|
+
-g typescript-axios \
|
|
40
|
+
-o ./generated
|
|
41
|
+
|
|
42
|
+
# Validate the spec
|
|
43
|
+
npx swagger-cli validate node_modules/@lunch-money/v2-api-spec/lunch-money-api-v2.yaml
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Updating URLs for Local Development
|
|
47
|
+
|
|
48
|
+
The package includes a script to help switch between local and production URLs in the OpenAPI specification. This is useful when developing against a local server.
|
|
49
|
+
|
|
50
|
+
#### Using the Script
|
|
51
|
+
|
|
52
|
+
The script is located at `node_modules/@lunch-money/v2-api-spec/update-urls.sh`.
|
|
53
|
+
|
|
54
|
+
**Required flags:**
|
|
55
|
+
- `--local` - Switch URLs to local development (default: `http://localhost:3000/v2`)
|
|
56
|
+
- `--production` - Switch URLs to production deployment URLs
|
|
57
|
+
|
|
58
|
+
**Switch to production URLs (using defaults):**
|
|
59
|
+
```bash
|
|
60
|
+
cd node_modules/@lunch-money/v2-api-spec
|
|
61
|
+
./update-urls.sh --production
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Switch to production URLs (with custom URLs):**
|
|
65
|
+
```bash
|
|
66
|
+
cd node_modules/@lunch-money/v2-api-spec
|
|
67
|
+
API_DEPLOY_URL=https://api.lunchmoney.app/v2 \
|
|
68
|
+
DOCS_DEPLOY_URL=https://alpha.lunchmoney.app/v2 \
|
|
69
|
+
./update-urls.sh --production
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Switch to local URLs:**
|
|
73
|
+
```bash
|
|
74
|
+
cd node_modules/@lunch-money/v2-api-spec
|
|
75
|
+
./update-urls.sh --local
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Switch to local URLs (with custom local URL):**
|
|
79
|
+
```bash
|
|
80
|
+
cd node_modules/@lunch-money/v2-api-spec
|
|
81
|
+
LOCAL_URL=http://localhost:4000/v2 ./update-urls.sh --local
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Using environment variables:**
|
|
85
|
+
Create a `.env` file in the package directory:
|
|
86
|
+
```bash
|
|
87
|
+
LOCAL_URL=http://localhost:3000/v2
|
|
88
|
+
API_DEPLOY_URL=https://api.lunchmoney.app/v2
|
|
89
|
+
DOCS_DEPLOY_URL=https://alpha.lunchmoney.app/v2
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Then run:
|
|
93
|
+
```bash
|
|
94
|
+
./update-urls.sh --production
|
|
95
|
+
# or
|
|
96
|
+
./update-urls.sh --local
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### How It Works
|
|
100
|
+
|
|
101
|
+
The script updates the `servers` section in the OpenAPI specification:
|
|
102
|
+
- **Server 1**: Typically the production API server
|
|
103
|
+
- **Server 2**: Typically a mock or staging server
|
|
104
|
+
|
|
105
|
+
It also updates any references to these URLs throughout the specification file.
|
|
106
|
+
|
|
107
|
+
#### Important Notes
|
|
108
|
+
|
|
109
|
+
- The script modifies the spec file in place
|
|
110
|
+
- Changes are not persisted across `npm install` - the package will be restored to its original state
|
|
111
|
+
- For persistent changes, consider copying the spec to your project directory first
|
|
112
|
+
- The script works in both the npm package and the git repository
|
|
113
|
+
|
|
114
|
+
## Versioning
|
|
115
|
+
|
|
116
|
+
This package follows the Lunch Money API versioning scheme:
|
|
117
|
+
- **Major version**: API version (currently 2)
|
|
118
|
+
- **Minor version**: Number of main endpoint groups
|
|
119
|
+
- **Revision**: Number of updates since last endpoint addition
|
|
120
|
+
|
|
121
|
+
For example, version `2.8.2` means:
|
|
122
|
+
- API version 2
|
|
123
|
+
- 8 main endpoint groups
|
|
124
|
+
- 2 updates since the 8th endpoint was added
|
|
125
|
+
|
|
126
|
+
## Resources
|
|
127
|
+
|
|
128
|
+
- [Lunch Money Website](https://lunchmoney.app)
|
|
129
|
+
- [Interactive API Documentation](https://alpha.lunchmoney.dev/v2/docs)
|
|
130
|
+
- [GitHub Repository](https://github.com/lunch-money/api-specs)
|
|
131
|
+
- [API Status](https://status.lunchmoney.app)
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
ISC
|
|
136
|
+
|
package/README.md.backup
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
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)
|