Skip to the content.

@leopiccionia/numista-sdk / Exports / NumistaConnector

Class: NumistaConnector

The main entrypoint for Numista SDK

Table of contents

Constructors

Methods

Constructors

constructor

new NumistaConnector(apiKey, clientId, config?)

Parameters

Name Type Description
apiKey string API key
clientId string Client ID
config Partial<ConnectorConfig> Miscellaneous configuration

Methods

addIssue

addIssue(typeId, data, params?): Promise<Issue>

Add a issue

It requires a specific permission associated to your API key

Parameters

Name Type Description
typeId number ID of the coin to which the issue is added
data IssueUpdate Data related to the coin issue to add to the catalogue
params Partial<BaseRequest> Miscellaneous params

Returns

Promise<Issue>

The coin issue that has been added to the catalogue


addItem

addItem(userId, data): Promise<CollectedItem>

Add an item in the user collection

This functionality requires the OAuth 2.0 authentication with the scope "edit_collection"

Parameters

Name Type Description
userId number ID of the user
data AddItemRequest Data related to the item to be added to the collection

Returns

Promise<CollectedItem>

The item


addType

addType(data, params?): Promise<Type>

This endpoint allows to add a type to the catalogue

It requires a specific permission associated to your API key. After adding a coin, you are required to add at least one issue

Parameters

Name Type Description
data TypeUpdate Data related to the coin to add to the catalogue
params Partial<BaseRequest> Miscellaneous params

Returns

Promise<Type>

The coin that has been added to the catalogue


catalogues

catalogues(): Promise<CataloguesResponse>

Retrieve the list of catalogues used for coin references

Returns

Promise<CataloguesResponse>


code

code(catalogue, number, params): Promise<SearchResponse>

Search the catalogue for types by catalogue code

Parameters

Name Type Description
catalogue number | CatalogueCode ID of a reference catalogue
number string Number of the searched typed in a reference catalogue
params Partial<Omit<SearchRequest, "number" | "catalogue">> Miscellaneous params

Returns

Promise<SearchResponse>


editItem

editItem(userId, itemId, data): Promise<CollectedItem>

Edit an item in a user’s collection

This functionality requires the OAuth 2.0 authentication with the scope "edit_collection"

Parameters

Name Type Description
userId number ID of the user
itemId number ID of the collected item
data EditItemRequest Item data which need to be edited. All fields are optional. Only the fields which are present will be updated

Returns

Promise<CollectedItem>

The updated item


issuers

issuers(params?): Promise<IssuersResponse>

Retrieve the list of issuing countries and territories

Parameters

Name Type Description
params Partial<BaseRequest> Miscellaneous params

Returns

Promise<IssuersResponse>


issues

issues(typeId, params?): Promise<Issue[]>

Find the issues of a type

Parameters

Name Type Description
typeId number ID of the type to fetch the issues from
params Partial<BaseRequest> Miscellaneous params

Returns

Promise<Issue[]>


item

item(userId, itemId): Promise<CollectedItem>

Get an item in a user’s collection

This functionality requires the OAuth 2.0 authentication with the scope "view_collection"

Parameters

Name Type Description
userId number ID of the user
itemId number ID of the collected item

Returns

Promise<CollectedItem>


myBanknotes

myBanknotes(params?): Promise<CollectedItemsResponse>

Get the banknotes owned by the user

Parameters

Name Type Description
params Partial<Omit<CollectedItemsRequest, "category">> Miscellaneous params

Returns

Promise<CollectedItemsResponse>


myCoins

myCoins(params?): Promise<CollectedItemsResponse>

Get the coins owned by the user

Parameters

Name Type Description
params Partial<Omit<CollectedItemsRequest, "category">> Miscellaneous params

Returns

Promise<CollectedItemsResponse>


myCollections

myCollections(params?): Promise<CollectionsResponse>

Get the list of collections of a user

Parameters

Name Type Description
params Partial<CollectionsRequest> Miscellaneous params

Returns

Promise<CollectionsResponse>


myExonumia

myExonumia(params?): Promise<CollectedItemsResponse>

Get the exonumia pieces owned by the user

Parameters

Name Type Description
params Partial<Omit<CollectedItemsRequest, "category">> Miscellaneous params

Returns

Promise<CollectedItemsResponse>


myItems

myItems(params?): Promise<CollectedItemsResponse>

Get the items (coins, banknotes, pieces of exonumia) owned by the user

Parameters

Name Type Description
params Partial<CollectedItemsRequest> Miscellaneous params

Returns

Promise<CollectedItemsResponse>


paginatedSearch

paginatedSearch(query, params?): Promise<PaginatedResult<SearchRequest, SearchResponse>>

Search the catalogue for coin, banknote and exonumia types (with pagination)

Parameters

Name Type Description
query string Search query
params Partial<Omit<SearchRequest, "page" | "q">> Miscellaneous params

Returns

Promise<PaginatedResult<SearchRequest, SearchResponse>>


prices

prices(typeId, issueId, params?): Promise<PricesResponse>

Get estimates for the price of an issue of a coin

Parameters

Name Type Description
typeId number ID of the type
issueId number ID of the issue
params Partial<PricesRequest> Miscellaneous params

Returns

Promise<PricesResponse>


removeItem

removeItem(userId, itemId): Promise<void>

Delete an item from a user’s collection

This functionality requires the OAuth 2.0 authentication with the scope "edit_collection"

Parameters

Name Type Description
userId number ID of the user
itemId number ID of the collected item

Returns

Promise<void>


search(query, params?): Promise<SearchResponse>

Search the catalogue for coin, banknote and exonumia types

Parameters

Name Type Description
query string Search query
params Partial<Omit<SearchRequest, "q">> Miscellaneous params

Returns

Promise<SearchResponse>


searchBanknotes

searchBanknotes(query, params?): Promise<SearchResponse>

Search the catalogue for banknotes

Parameters

Name Type Description
query string Search query
params Partial<Omit<SearchRequest, "q" | "category">> Miscellaneous params

Returns

Promise<SearchResponse>


searchByImage

searchByImage(data, params?): Promise<SearchByImageResponse>

Find the coin, banknote, and exonumia types that match the input image(s)

Search by image is a paid Numista feature. You will be charged monthly based on your usage. Additionally, your app is required to show the Numista N# reference when displaying the search results. Read Numista documentation for further details

Parameters

Name Type Description
data SearchByImageRequest Search params
params Partial<BaseRequest> Miscellaneous params

Returns

Promise<SearchByImageResponse>


searchCoins

searchCoins(query, params?): Promise<SearchResponse>

Search the catalogue for coins

Parameters

Name Type Description
query string Search query
params Partial<Omit<SearchRequest, "q" | "category">> Miscellaneous params

Returns

Promise<SearchResponse>


searchExonumia

searchExonumia(query, params?): Promise<SearchResponse>

Search the catalogue for exonumia pieces

Parameters

Name Type Description
query string Search query
params Partial<Omit<SearchRequest, "q" | "category">> Miscellaneous params

Returns

Promise<SearchResponse>


type

type(typeId, params?): Promise<Type>

Find a type by ID

Parameters

Name Type Description
typeId number ID of the type to fetch
params Partial<BaseRequest> Miscellaneous params

Returns

Promise<Type>


useAuthorizationCode

useAuthorizationCode(redirectUri, scope, params?): OAuthConnector

Get OAuth access token via user credentials

Parameters

Name Type Description
redirectUri string URI to redirect back the user to your application after they authenticate
scope Scope[] List of permissions you are requesting (e.g. ‘view_collection’)
params Partial<BaseRequest> Miscellaneous params

Returns

OAuthConnector

OAuth adapter using authorization code


useUserCredentials

useUserCredentials(scope): Promise<number>

Get OAuth access token via user credentials

Parameters

Name Type Description
scope Scope[] List of permissions

Returns

Promise<number>

ID of the user who authenticated


user

user(userId, params?): Promise<UserResponse>

Get information about a user

Parameters

Name Type Description
userId number ID of the user
params Partial<BaseRequest> Miscellaneous params

Returns

Promise<UserResponse>


userBanknotes

userBanknotes(userId, params?): Promise<CollectedItemsResponse>

Get the banknotes owned by a user

This functionality requires the OAuth 2.0 authentication with the scope "view_collection"

Parameters

Name Type Description
userId number ID of the user
params Partial<Omit<CollectedItemsRequest, "category">> Miscellaneous params

Returns

Promise<CollectedItemsResponse>


userCoins

userCoins(userId, params?): Promise<CollectedItemsResponse>

Get the coins owned by a user

This functionality requires the OAuth 2.0 authentication with the scope "view_collection"

Parameters

Name Type Description
userId number ID of the user
params Partial<Omit<CollectedItemsRequest, "category">> Miscellaneous params

Returns

Promise<CollectedItemsResponse>


userCollections

userCollections(userId, params?): Promise<CollectionsResponse>

Get the list of collections of a user

This functionality requires the OAuth 2.0 authentication with the scope "view_collection"

Parameters

Name Type Description
userId number ID of the user
params Partial<CollectionsRequest> Miscellaneous params

Returns

Promise<CollectionsResponse>


userExonumia

userExonumia(userId, params?): Promise<CollectedItemsResponse>

Get the exonumia pieces owned by a user

This functionality requires the OAuth 2.0 authentication with the scope "view_collection"

Parameters

Name Type Description
userId number ID of the user
params Partial<Omit<CollectedItemsRequest, "category">> Miscellaneous params

Returns

Promise<CollectedItemsResponse>


userItems

userItems(userId, params?): Promise<CollectedItemsResponse>

Get the items (coin, banknotes, pieces of exonumia) owned by a user

This functionality requires the OAuth 2.0 authentication with the scope "view_collection"

Parameters

Name Type Description
userId number ID of the user
params Partial<CollectedItemsRequest> Miscellaneous params

Returns

Promise<CollectedItemsResponse>