b5-api-client 0.0.35 → 0.0.37

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.
@@ -1,5 +1,5 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
- import { CreateOrderRequest, CreateUserRequest, Order, OrderResponse, TakeOrderRequest, TestEventParams, UpdateOrderRequest, TransactionStatusResponse, RateUserRequest, OrderEventsResponse, PushNotificationsRegisterRequest, ConfigResponse, DashboardMetricsResponse, UsersResponse, GetOrdersParams, CreateDisputeRequest, DisputesResponse, OrderOffersResponse, TransactionRequest, KioscoinOperationResponse, UpdateUserSettingsRequest, NotificationsResponse, VerifyEmailRequest, CreateSessionRequest, CreateSessionResponse, SaveOpsLogRequest, SaveOpsLogResponse } from './types';
2
+ import { CreateOrderRequest, CreateUserRequest, Order, OrderResponse, OrderEscrowSecretsResponse, OrderSecretResponse, TakeOrderRequest, TestEventParams, UpdateOrderRequest, TransactionStatusResponse, RateUserRequest, OrderEventsResponse, PushNotificationsRegisterRequest, ConfigResponse, DashboardMetricsResponse, UsersResponse, GetOrdersParams, CreateDisputeRequest, DisputesResponse, OrderOffersResponse, TransactionRequest, KioscoinOperationResponse, UpdateUserSettingsRequest, NotificationsResponse, VerifyEmailRequest, CreateSessionRequest, CreateSessionResponse, SaveOpsLogRequest, SaveOpsLogResponse } from './types';
3
3
  import { AuthTokenProvider } from './auth/AuthTokenProvider';
4
4
  export interface RequestConfigWithRetry extends AxiosRequestConfig {
5
5
  _retry?: boolean;
@@ -18,6 +18,8 @@ declare class P2PMarketplaceAPIClient {
18
18
  post<T>(url: string, data: any, headers?: Record<string, string>): Promise<T>;
19
19
  getOrders(props: GetOrdersParams, headers?: Record<string, string>): Promise<OrderResponse>;
20
20
  getOrderById(id: string, headers?: Record<string, string>): Promise<OrderResponse>;
21
+ getOrderSecret(orderId: string, headers?: Record<string, string>): Promise<OrderSecretResponse>;
22
+ getEscrowSecretsForSeller(orderId: string, headers?: Record<string, string>): Promise<OrderEscrowSecretsResponse>;
21
23
  createOrder(order: CreateOrderRequest, headers?: Record<string, string>): Promise<OrderResponse>;
22
24
  takeOrder(order: TakeOrderRequest, headers?: Record<string, string>): Promise<OrderResponse>;
23
25
  updateOrder(updateRequest: UpdateOrderRequest, headers?: Record<string, string>): Promise<OrderResponse>;
@@ -175,6 +175,18 @@ class P2PMarketplaceAPIClient {
175
175
  return this.get(url, headers);
176
176
  });
177
177
  }
178
+ getOrderSecret(orderId, headers) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ const url = `/api/orders/${orderId}/secret`;
181
+ return this.get(url, headers);
182
+ });
183
+ }
184
+ getEscrowSecretsForSeller(orderId, headers) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ const url = `/api/orders/${orderId}/escrow-secrets`;
187
+ return this.get(url, headers);
188
+ });
189
+ }
178
190
  createOrder(order, headers) {
179
191
  return __awaiter(this, void 0, void 0, function* () {
180
192
  const url = '/api/orders';
package/dist/types.d.ts CHANGED
@@ -49,6 +49,17 @@ export interface Order {
49
49
  export interface OrderResponse {
50
50
  orders: Order[];
51
51
  }
52
+ export type OrderSecretRole = 'BUYER' | 'SELLER';
53
+ export interface OrderSecretResponse {
54
+ orderId: string;
55
+ role: OrderSecretRole;
56
+ secret: string;
57
+ }
58
+ export interface OrderEscrowSecretsResponse {
59
+ orderId: string;
60
+ buyerSecret: string;
61
+ sellerSecret: string;
62
+ }
52
63
  export interface UsersResponse {
53
64
  users: KioscoinUser[];
54
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b5-api-client",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "Escrow Backend API client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import axios, { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios';
2
- import { CreateOrderRequest, CreateUserRequest, Order, OrderResponse, TakeOrderRequest, TestEventParams, UpdateOrderRequest, TransactionStatusResponse, RateUserRequest, OrderEventsResponse, PushNotificationsRegisterRequest, ConfigResponse, DashboardMetricsResponse, UsersResponse, GetOrdersParams, CreateDisputeRequest, DisputesResponse, OrderOffersResponse, TransactionRequest, KioscoinOperationResponse, UpdateUserSettingsRequest, NotificationsResponse, VerifyEmailRequest, CreateSessionRequest, CreateSessionResponse, SaveOpsLogRequest, SaveOpsLogResponse } from './types';
2
+ import { CreateOrderRequest, CreateUserRequest, Order, OrderResponse, OrderEscrowSecretsResponse, OrderSecretResponse, TakeOrderRequest, TestEventParams, UpdateOrderRequest, TransactionStatusResponse, RateUserRequest, OrderEventsResponse, PushNotificationsRegisterRequest, ConfigResponse, DashboardMetricsResponse, UsersResponse, GetOrdersParams, CreateDisputeRequest, DisputesResponse, OrderOffersResponse, TransactionRequest, KioscoinOperationResponse, UpdateUserSettingsRequest, NotificationsResponse, VerifyEmailRequest, CreateSessionRequest, CreateSessionResponse, SaveOpsLogRequest, SaveOpsLogResponse } from './types';
3
3
  import { AuthTokenProvider } from './auth/AuthTokenProvider';
4
4
  import { isPlainObject, camelCase, snakeCase, transform } from 'lodash';
5
5
 
@@ -180,6 +180,16 @@ class P2PMarketplaceAPIClient {
180
180
  return this.get<OrderResponse>(url, headers);
181
181
  }
182
182
 
183
+ public async getOrderSecret(orderId: string, headers?: Record<string, string>): Promise<OrderSecretResponse> {
184
+ const url = `/api/orders/${orderId}/secret`;
185
+ return this.get<OrderSecretResponse>(url, headers);
186
+ }
187
+
188
+ public async getEscrowSecretsForSeller(orderId: string, headers?: Record<string, string>): Promise<OrderEscrowSecretsResponse> {
189
+ const url = `/api/orders/${orderId}/escrow-secrets`;
190
+ return this.get<OrderEscrowSecretsResponse>(url, headers);
191
+ }
192
+
183
193
  public async createOrder(order: CreateOrderRequest, headers?: Record<string, string>): Promise<OrderResponse> {
184
194
  const url = '/api/orders';
185
195
  return this.post<OrderResponse>(url, order, headers);
package/src/types.ts CHANGED
@@ -47,6 +47,7 @@ export interface Order {
47
47
  fiatCode: string;
48
48
  paymentMethods?: PaymentMethod[];
49
49
  createdAt?: string; // ISO 8601 string
50
+ updatedAt?: string; // ISO 8601 string
50
51
  transaction?: string;
51
52
  buyerHash?: string;
52
53
  sellerHash?: string;
@@ -73,6 +74,20 @@ export interface OrderResponse {
73
74
  orders: Order[]
74
75
  }
75
76
 
77
+ export type OrderSecretRole = 'BUYER' | 'SELLER';
78
+
79
+ export interface OrderSecretResponse {
80
+ orderId: string;
81
+ role: OrderSecretRole;
82
+ secret: string;
83
+ }
84
+
85
+ export interface OrderEscrowSecretsResponse {
86
+ orderId: string;
87
+ buyerSecret: string;
88
+ sellerSecret: string;
89
+ }
90
+
76
91
  export interface UsersResponse {
77
92
  users: KioscoinUser[]
78
93
  }