substack-feed-api 1.0.2 → 1.0.3

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 CHANGED
@@ -29,7 +29,7 @@ npm install substack-feed-api
29
29
  2. Import the API into your project:
30
30
 
31
31
  ```typescript
32
- import { SubstackFeedApi } from 'substack-feed-api';
32
+ import { getSubstackFeed } from 'substack-feed-api';
33
33
  ```
34
34
 
35
35
  ### Usage
@@ -37,15 +37,28 @@ import { SubstackFeedApi } from 'substack-feed-api';
37
37
  Here's a quick example to get you started:
38
38
 
39
39
  ```typescript
40
- const api = new SubstackFeedApi();
40
+ getSubstackFeed('your-substack-newsletter-name')
41
+ .then((feed) => {
42
+ console.log(feed);
43
+ })
44
+ .catch((error) => {
45
+ console.error(error);
46
+ });
47
+ ```
48
+
49
+ There is also a possibility to pass your own callback function to the `getSubstackFeed` function.
50
+ This function will be called with the parsed feed data as an argument:
41
51
 
42
- api.fetchNewsletter('your-substack-newsletter-name').then(feed => {
43
- console.info(feed);
44
- }).catch(error => {
45
- console.error('Error fetching newsletter:', error);
52
+ ```typescript
53
+ getSubstackFeed('your-substack-newsletter-name', (err, result) => {
54
+ console.log(result);
46
55
  });
47
56
  ```
48
57
 
58
+ You can also use the other exported functions from the package:
59
+ - `getFeedByLink`: Fetch a specific feed by its link.
60
+ - `getPosts`: Get all posts from a feed.
61
+
49
62
  Replace `'your-substack-newsletter-name'` with the name of the Substack newsletter you wish to fetch.
50
63
 
51
64
  ## Development
@@ -87,4 +100,4 @@ Contributions are welcome! Feel free to open an issue or submit a pull request i
87
100
  ## License
88
101
 
89
102
  This project is licensed under the MIT License.
90
- ```
103
+ ```