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 +17 -6
- package/dist/types/config.d.ts +2 -2
- package/lib/types/config.ts +2 -2
- package/package.json +1 -1
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:
|
|
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 `
|
|
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:
|
|
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
|
-
- `
|
|
112
|
-
- `include` (string, optional): Additional filters or fields to include (e.g., '
|
|
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
|
|
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
|
|
package/dist/types/config.d.ts
CHANGED
|
@@ -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' | '
|
|
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' | '
|
|
74
|
+
status?: 'active' | 'deleted' | 'hidden_by_user';
|
|
75
75
|
gl?: number;
|
|
76
76
|
include?: string;
|
|
77
77
|
}
|
package/lib/types/config.ts
CHANGED
|
@@ -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' | '
|
|
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' | '
|
|
76
|
+
status?: 'active' | 'deleted' | 'hidden_by_user';
|
|
77
77
|
gl?: number;
|
|
78
78
|
include?: string;
|
|
79
79
|
}
|