blocket.js 1.1.0 → 1.1.1

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
@@ -97,25 +97,36 @@ import client from 'blocket.js';
97
97
 
98
98
  ## API Reference
99
99
 
100
- `client.find(query: BlocketQueryParams, fetchOptions?: FetchOptions): Promise<BlocketAd[]>`
100
+ `client.find(query: BlocketQueryConfig, fetchOptions?: FetchOptions<'json', any>): Promise<BlocketAd[]>`
101
101
 
102
102
  Searches for ads on Blocket based on the provided query parameters.
103
103
 
104
104
  - Parameters:
105
- - `query`: An object conforming to the `BlocketQueryParams` interface:
105
+ - `query`: An object conforming to the `BlocketQueryConfig` interface:
106
106
  - `query` (string): The search query (e.g., `'macbook air'`).
107
- - `limit` (number, optional): Maximum number of results to return (default: 60).
107
+ - `limit` (number, optional): Maximum number of results to return (default: 20).
108
108
  - `sort` (string, optional): Sorting order (default: `'rel'`).
109
109
  - `listingType` (string, optional): Listing type; `'s'` for selling, `'b'` for buying (default: `'s'`).
110
110
  - `status` (string, optional): Ad status (`'active'` or `'inactive'`, default: `'active'`).
111
- - `gl` (number, optional): Maximum distance in kilometers.
112
- - `include` (string, optional): Additional filters or fields to include (e.g., 'image,description').
111
+ - `geolocation` (number, optional): Maximum distance in kilometers.
112
+ - `include` (string, optional): Additional filters or fields to include (e.g., 'extend_with_shipping').
113
113
  - `fetchOptions` (optional): Additional options to pass to the underlying fetch request.
114
114
  - Returns: A promise that resolves to an array of `BlocketAd` objects.
115
115
 
116
+ `client.findById(adId: string, fetchOptions?: FetchOptions<'json', any>): Promise<BlocketAd>`
117
+
118
+ Retrieves a specific ad by its ID.
119
+
120
+ - Parameters:
121
+ - `adId`: The ID of the ad to retrieve.
122
+ - `fetchOptions` (optional): Additional options to pass to the underlying fetch request.
123
+ - Returns: A promise that resolves to a `BlocketAd` object or null if not found.
124
+
116
125
  ## License
117
126
 
118
- This project is licensed under a license that allows free use provided that proper credit is given to the original author, Philip Rutberg. See the LICENSE file for details.
127
+ This project is licensed under the [MIT License](https://github.com/rutbergphilip/blocket.js/blob/main/LICENSE) free for personal and commercial use.
128
+
129
+ If you find this project useful, crediting the author is greatly appreciated!
119
130
 
120
131
  ## Star History
121
132
 
@@ -53,7 +53,7 @@ export interface BlocketQueryConfig {
53
53
  * The status of the ad. `active`, `inactive`, or `all`.
54
54
  * @default 'active'
55
55
  */
56
- status?: 'active' | 'inactive' | 'all';
56
+ status?: 'active' | 'deleted' | 'hidden_by_user';
57
57
  /**
58
58
  * The maximum distance in kilometers from the search location.
59
59
  */
@@ -71,7 +71,7 @@ export interface BlocketQueryParamsNative {
71
71
  lim?: number;
72
72
  sort?: 'rel';
73
73
  st?: 's' | 'b' | 'a';
74
- status?: 'active' | 'inactive' | 'all';
74
+ status?: 'active' | 'deleted' | 'hidden_by_user';
75
75
  gl?: number;
76
76
  include?: string;
77
77
  }
@@ -54,7 +54,7 @@ export interface BlocketQueryConfig {
54
54
  * The status of the ad. `active`, `inactive`, or `all`.
55
55
  * @default 'active'
56
56
  */
57
- status?: 'active' | 'inactive' | 'all';
57
+ status?: 'active' | 'deleted' | 'hidden_by_user';
58
58
  /**
59
59
  * The maximum distance in kilometers from the search location.
60
60
  */
@@ -73,7 +73,7 @@ export interface BlocketQueryParamsNative {
73
73
  lim?: number;
74
74
  sort?: 'rel';
75
75
  st?: 's' | 'b' | 'a';
76
- status?: 'active' | 'inactive' | 'all';
76
+ status?: 'active' | 'deleted' | 'hidden_by_user';
77
77
  gl?: number;
78
78
  include?: string;
79
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blocket.js",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A user-friendly js wrapper for blocket.se",
5
5
  "keywords": [
6
6
  "blocket",