marketplace-hub-client 0.0.1 → 0.0.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 +75 -41
- package/fesm2022/marketplace-hub-client.mjs +7 -11
- package/fesm2022/marketplace-hub-client.mjs.map +1 -1
- package/package.json +3 -6
- package/types/marketplace-hub-client.d.ts +104 -94
- package/fesm2022/marketplace-hub-client-src-lib.mjs +0 -1224
- package/fesm2022/marketplace-hub-client-src-lib.mjs.map +0 -1
- package/src/lib/README.md +0 -213
- package/types/marketplace-hub-client-src-lib.d.ts +0 -1040
package/README.md
CHANGED
|
@@ -1,63 +1,97 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Marketplace Hub Client Library
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
A professional, enterprise-grade Angular client library for interacting with the Marketplace Hub API. This library features built-in security, standard response wrapping, and a developer-friendly interface.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **Standardized API Responses**: All endpoints return a consistent `ApiResponse<T>` wrapper.
|
|
8
|
+
- **Automated Authentication**: Built-in interceptor for `HMAC-SHA256` request signing and `API-KEY` management.
|
|
9
|
+
- **Type Safety**: Fully typed models generated for all API entities.
|
|
10
|
+
- **Idempotency**: Automatic `Idempotency-Key` generation for safe mutating requests (`POST`, `PUT`, `PATCH`).
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
ng generate component component-name
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
12
|
+
## Installation
|
|
14
13
|
|
|
15
14
|
```bash
|
|
16
|
-
|
|
15
|
+
npm install marketplace-hub-client
|
|
17
16
|
```
|
|
18
17
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
To build the library, run:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
ng build marketplace-hub-client
|
|
25
|
-
```
|
|
18
|
+
## Quick Start
|
|
26
19
|
|
|
27
|
-
|
|
20
|
+
### 1. Provide the API in your app
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
In your `app.config.ts`:
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
```typescript
|
|
25
|
+
import { ApplicationConfig } from '@angular/core';
|
|
26
|
+
import { provideApi } from 'marketplace-hub-client';
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
export const appConfig: ApplicationConfig = {
|
|
29
|
+
providers: [
|
|
30
|
+
provideApi({
|
|
31
|
+
basePath: 'https://api.marketplace-hub.com',
|
|
32
|
+
api_key: 'YOUR_API_KEY',
|
|
33
|
+
apiSecret: 'YOUR_API_SECRET' // Used for HMAC signature
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
};
|
|
37
|
+
```
|
|
37
38
|
|
|
38
|
-
2.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
### 2. Inject and use Services
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
43
|
+
import { ContentService, ProductResponse, ApiResponse } from 'marketplace-hub-client';
|
|
44
|
+
|
|
45
|
+
@Component({
|
|
46
|
+
selector: 'app-product-list',
|
|
47
|
+
standalone: true,
|
|
48
|
+
template: `
|
|
49
|
+
<div *ngIf="products">
|
|
50
|
+
<h3>{{ products.message.detail }}</h3>
|
|
51
|
+
<ul>
|
|
52
|
+
<li *ngFor="let product of products.data.content">
|
|
53
|
+
{{ product.name }} - {{ product.price }}
|
|
54
|
+
</li>
|
|
55
|
+
</ul>
|
|
56
|
+
</div>
|
|
57
|
+
`
|
|
58
|
+
})
|
|
59
|
+
export class ProductListComponent implements OnInit {
|
|
60
|
+
private contentService = inject(ContentService);
|
|
61
|
+
products?: ApiResponse<any>;
|
|
62
|
+
|
|
63
|
+
ngOnInit() {
|
|
64
|
+
this.contentService.getProducts({ page: 0, size: 10 }).subscribe(response => {
|
|
65
|
+
this.products = response;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
42
70
|
|
|
43
|
-
##
|
|
71
|
+
## API Response Structure
|
|
44
72
|
|
|
45
|
-
|
|
73
|
+
Every response from the library follows this structure:
|
|
46
74
|
|
|
47
|
-
```
|
|
48
|
-
|
|
75
|
+
```typescript
|
|
76
|
+
export interface ApiResponse<T> {
|
|
77
|
+
timestamp: number;
|
|
78
|
+
status: number;
|
|
79
|
+
message: {
|
|
80
|
+
detail: string;
|
|
81
|
+
};
|
|
82
|
+
data: T;
|
|
83
|
+
}
|
|
49
84
|
```
|
|
50
85
|
|
|
51
|
-
##
|
|
86
|
+
## Authentication Headers
|
|
52
87
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
ng e2e
|
|
57
|
-
```
|
|
88
|
+
The library automatically injects the following headers for every request when configured:
|
|
58
89
|
|
|
59
|
-
|
|
90
|
+
- `X-API-KEY`: Your provided API Key.
|
|
91
|
+
- `X-TIMESTAMP`: Current epoch timestamp.
|
|
92
|
+
- `X-SIGNATURE`: `HMAC-SHA256(body + timestamp, secret)` encoded in Base64.
|
|
93
|
+
- `Idempotency-Key`: A unique UUID for mutating requests.
|
|
60
94
|
|
|
61
|
-
##
|
|
95
|
+
## License
|
|
62
96
|
|
|
63
|
-
|
|
97
|
+
MIT © ITWays
|
|
@@ -405,14 +405,10 @@ class BaseService {
|
|
|
405
405
|
/**
|
|
406
406
|
* Marketplace Hub API
|
|
407
407
|
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
411
|
-
* https://openapi-generator.tech
|
|
412
|
-
* Do not edit the class manually.
|
|
408
|
+
* This client library provides a professional interface for interacting with the Marketplace Hub API.
|
|
413
409
|
*/
|
|
414
410
|
/* tslint:disable:no-unused-variable member-ordering */
|
|
415
|
-
class
|
|
411
|
+
class ContentService extends BaseService {
|
|
416
412
|
httpClient;
|
|
417
413
|
constructor(httpClient, basePath, configuration) {
|
|
418
414
|
super(basePath, configuration);
|
|
@@ -922,10 +918,10 @@ class ContentAPIService extends BaseService {
|
|
|
922
918
|
reportProgress: reportProgress
|
|
923
919
|
});
|
|
924
920
|
}
|
|
925
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type:
|
|
926
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type:
|
|
921
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ContentService, deps: [{ token: i1.HttpClient }, { token: BASE_PATH, optional: true }, { token: Configuration, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
922
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ContentService, providedIn: 'root' });
|
|
927
923
|
}
|
|
928
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type:
|
|
924
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ContentService, decorators: [{
|
|
929
925
|
type: Injectable,
|
|
930
926
|
args: [{
|
|
931
927
|
providedIn: 'root'
|
|
@@ -939,7 +935,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
939
935
|
type: Optional
|
|
940
936
|
}] }] });
|
|
941
937
|
|
|
942
|
-
const APIS = [
|
|
938
|
+
const APIS = [ContentService];
|
|
943
939
|
|
|
944
940
|
/**
|
|
945
941
|
* Marketplace Hub API
|
|
@@ -1220,5 +1216,5 @@ function provideApi(configOrBasePath) {
|
|
|
1220
1216
|
* Generated bundle index. Do not edit.
|
|
1221
1217
|
*/
|
|
1222
1218
|
|
|
1223
|
-
export { APIS, ApiModule, BASE_PATH, COLLECTION_FORMATS, CategoryResponse, Configuration,
|
|
1219
|
+
export { APIS, ApiModule, BASE_PATH, COLLECTION_FORMATS, CategoryResponse, Configuration, ContentService, ProductResponse, PublicPaymentMethodResponse, apiAuthenticationInterceptor, provideApi };
|
|
1224
1220
|
//# sourceMappingURL=marketplace-hub-client.mjs.map
|