Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Commit dc13b6f

Browse files
committed
added descriptions to all NFT methods and renamed two of them
1 parent c12666d commit dc13b6f

File tree

4 files changed

+63
-14
lines changed

4 files changed

+63
-14
lines changed

index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -956,9 +956,9 @@ export interface GetExchangeRatesResponse {
956956
rates: ExchangeRate[];
957957
}
958958

959-
export type GetMyNFTsResponse = GetMerchantNFTListResponse;
959+
export type GetUserBoughtNFTsResponse = GetMerchantNFTListResponse;
960960

961-
export interface MakeNFTReservationResponse {
961+
export interface MakeReservationResponse {
962962
created_at: number;
963963
updated_at: number;
964964
description: string;
@@ -984,8 +984,8 @@ export declare class NFTs {
984984
Promise<AxiosResponse<GetMerchantNFTListResponse>>;
985985
getMerchantNFT(merchantUuid: string, nftId: number): Promise<AxiosResponse<GetMerchantNFTResponse>>;
986986
getExchangeRates(fiat: string, invert?: boolean): Promise<AxiosResponse<GetExchangeRatesResponse>>;
987-
getMyNFTs(page?: number, size?: number): Promise<AxiosResponse<GetMyNFTsResponse>>;
988-
makeNFTReservation(merchantUuid: string, nftId: number): Promise<AxiosResponse<MakeNFTReservationResponse>>;
987+
getUserBoughtNFTs(page?: number, size?: number): Promise<AxiosResponse<GetUserBoughtNFTsResponse>>;
988+
makeReservation(merchantUuid: string, nftId: number): Promise<AxiosResponse<MakeReservationResponse>>;
989989
}
990990

991991
export interface ApiEndpoints {
@@ -1052,8 +1052,8 @@ export interface ApiEndpoints {
10521052
getMerchantNFTList: (merchantUuid: string, page: number, size: number, filter: string) => string;
10531053
getMerchantNFT: (merchantUuid: string, nftId: number) => string;
10541054
getExchangeRates: (fiat: string, invert: boolean) => string;
1055-
getMyNFTs: (page: number, size: number) => string;
1056-
makeNFTReservation: (merchantUuid: string, nftId: number) => string;
1055+
getUserBoughtNFTs: (page: number, size: number) => string;
1056+
makeReservation: (merchantUuid: string, nftId: number) => string;
10571057
}
10581058

10591059
export interface ApiConfig {

src/constants/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ export const API = {
115115
getMerchantNFT: (merchantUuid: string, nftId: number): string => `/v2/nfts/${merchantUuid}/${nftId}`,
116116
getExchangeRates: (fiat: string, invert: boolean): string =>
117117
`/v2/nfts/exchange-rate/${fiat}${invert ? '?invert=true' : ''}`,
118-
getMyNFTs: (page: number, size: number): string => `/v2/nfts?page=${page}&size=${size}`,
119-
makeNFTReservation: (merchantUuid: string, nftId: number): string => `/v2/nfts/${merchantUuid}/${nftId}/reserve`,
118+
getUserBoughtNFTs: (page: number, size: number): string => `/v2/nfts?page=${page}&size=${size}`,
119+
makeReservation: (merchantUuid: string, nftId: number): string => `/v2/nfts/${merchantUuid}/${nftId}/reserve`,
120120
};

src/endpoints/nfts.ts

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,28 @@ class NFTs extends BaseExtend {
2121
super(config, request);
2222
}
2323

24+
/**
25+
* Returns a merchant's Marketplace data if there is one
26+
* @method getMerchantMarketplace
27+
* @async
28+
* @param {string} merchantUuid The Merchant's unique universal identifier (Merchant UUID).
29+
* @returns Promise<AxiosResponse<GetMerchantMarketplaceResponse>>
30+
*/
2431
async getMerchantMarketplace(merchantUuid: string): Promise<AxiosResponse<GetMerchantMarketplaceResponse>> {
2532
return this.request.get(API.getMerchantMarketplace(merchantUuid));
2633
}
2734

35+
/**
36+
* Returns a list of NFT items sold by a merchant
37+
* @method getMerchantNFTList
38+
* @async
39+
* @param {string} merchantUuid The Merchant's unique universal identifier (Merchant UUID).
40+
* @param {number} page The current page number.
41+
* If it is not set the starting page will be returned. Defaults to 1
42+
* @param {number} size The maximum mumber of items returned in the response. Defaults to 50
43+
* @param {string} filter Parameter by which the returned items in the list to be filtered. Defaults to "published"
44+
* @returns Promise<AxiosResponse<GetMerchantNFTListResponse>>
45+
*/
2846
async getMerchantNFTList(
2947
merchantUuid: string,
3048
page = 1,
@@ -34,28 +52,59 @@ class NFTs extends BaseExtend {
3452
return this.request.get(API.getMerchantNFTList(merchantUuid, page, size, filter));
3553
}
3654

55+
/**
56+
* Returns a specific NFT item sold by a merchant
57+
* @method getMerchantNFT
58+
* @async
59+
* @param {string} merchantUuid The Merchant's unique universal identifier (Merchant UUID).
60+
* @param {number} nftId The unique NFT identifier
61+
* @returns Promise<AxiosResponse<GetMerchantNFTResponse>>
62+
*/
3763
async getMerchantNFT(merchantUuid: string, nftId: number): Promise<AxiosResponse<GetMerchantNFTResponse>> {
3864
return this.request.get(API.getMerchantNFT(merchantUuid, nftId));
3965
}
4066

67+
/**
68+
* Returns exchange rates of a specific FIAT currency in respect to a list crypto currencies
69+
* @method getExchangeRates
70+
* @param {string} fiat The FIAT currency
71+
* @param {boolean} invert Whether the returned rates to be in their inverted exchange rates
72+
* @returns Promise<AxiosResponse<GetExchangeRatesResponse>>
73+
*/
4174
async getExchangeRates(fiat: string, invert = false): Promise<AxiosResponse<GetExchangeRatesResponse>> {
4275
return this.request.get(API.getExchangeRates(fiat, invert));
4376
}
4477

45-
async getMyNFTs(page = 1, size = 50): Promise<AxiosResponse<GetMyNFTsResponse>> {
78+
/**
79+
* Returns a list of NFTs bought and owned by an authenticated user
80+
* @method getUserBoughtNFTs
81+
* @param {number} page The current page number.
82+
* If it is not set the starting page will be returned. Defaults to 1
83+
* @param {number} size The maximum mumber of items returned in the response. Defaults to 50
84+
* @returns Promise<AxiosResponse<GetMyNFTsResponse>>
85+
*/
86+
async getUserBoughtNFTs(page = 1, size = 50): Promise<AxiosResponse<GetMyNFTsResponse>> {
4687
const tokenObject = await this.request.getToken();
4788

48-
return this.request.authenticatedGet(API.getMyNFTs(page, size), {
89+
return this.request.authenticatedGet(API.getUserBoughtNFTs(page, size), {
4990
headers: {
5091
Authorization: `Bearer ${tokenObject.token}`,
5192
},
5293
});
5394
}
5495

55-
async makeNFTReservation(merchantUuid: string, nftId: number): Promise<AxiosResponse<MakeNFTReservationResponse>> {
96+
/**
97+
* Makes a reservation request for a specific NFT and returns the relevant data when
98+
* that reservation is completed successfully
99+
* @method makeReservation
100+
* @param {string} merchantUuid The Merchant's unique universal identifier (Merchant UUID).
101+
* @param {number} nftId The unique NFT identifier
102+
* @returns Promise<AxiosResponse<MakeNFTReservationResponse>>
103+
*/
104+
async makeReservation(merchantUuid: string, nftId: number): Promise<AxiosResponse<MakeNFTReservationResponse>> {
56105
const tokenObject = await this.request.getToken();
57106

58-
return this.request.authenticatedPost(API.makeNFTReservation(merchantUuid, nftId), {
107+
return this.request.authenticatedPost(API.makeReservation(merchantUuid, nftId), {
59108
headers: {
60109
Authorization: `Bearer ${tokenObject.token}`,
61110
},

src/models/INFTs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ export interface NFTs extends BaseExtend {
9393
Promise<AxiosResponse<GetMerchantNFTListResponse>>;
9494
getMerchantNFT(merchantUuid: string, nftId: number): Promise<AxiosResponse<GetMerchantNFTResponse>>;
9595
getExchangeRates(fiat: string, invert?: boolean): Promise<AxiosResponse<GetExchangeRatesResponse>>;
96-
getMyNFTs(page?: number, size?: number): Promise<AxiosResponse<GetMyNFTsResponse>>;
97-
makeNFTReservation(merchantUuid: string, nftId: number): Promise<AxiosResponse<MakeNFTReservationResponse>>;
96+
getUserBoughtNFTs(page?: number, size?: number): Promise<AxiosResponse<GetMyNFTsResponse>>;
97+
makeReservation(merchantUuid: string, nftId: number): Promise<AxiosResponse<MakeNFTReservationResponse>>;
9898
}

0 commit comments

Comments
 (0)