Skip to content

Latest commit

 

History

History
615 lines (474 loc) · 40 KB

File metadata and controls

615 lines (474 loc) · 40 KB

SearchAPI

(searchAPI)

Overview

Available Operations

searchTraits

Returns aggregation of existing traits for specified collections with counter for each trait type/value.\ This is full-text-search, where you can specify filter for trait keys not precisely\ (for example, results back filter include Background trait)

Example Usage

import { RaribleProtocolMcp } from "@rarible/protocol-mcp";

const raribleProtocolMcp = new RaribleProtocolMcp({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const result = await raribleProtocolMcp.searchAPI.searchTraits({
    filter: "Hat",
    collectionIds: [
      "ETHEREUM:0x60e4d786628fea6478f785a6d7e704777c86a7c6",
    ],
    owners: [
      "${filterOwners}",
    ],
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { RaribleProtocolMcpCore } from "@rarible/protocol-mcp/core.js";
import { searchAPISearchTraits } from "@rarible/protocol-mcp/funcs/searchAPISearchTraits.js";

// Use `RaribleProtocolMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raribleProtocolMcp = new RaribleProtocolMcpCore({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const res = await searchAPISearchTraits(raribleProtocolMcp, {
    filter: "Hat",
    collectionIds: [
      "ETHEREUM:0x60e4d786628fea6478f785a6d7e704777c86a7c6",
    ],
    owners: [
      "${filterOwners}",
    ],
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.SearchTraitsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.Traits>

Errors

Error Type Status Code Content Type
errors.UnionApiErrorBadRequest 400 application/json
errors.UnionApiErrorServerError 500 application/json
errors.APIError 4XX, 5XX */*

searchItems

Advanced search returns NFTs satisfying provided filter

Example Usage

import { RaribleProtocolMcp } from "@rarible/protocol-mcp";

const raribleProtocolMcp = new RaribleProtocolMcp({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const result = await raribleProtocolMcp.searchAPI.searchItems({
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      lastUpdatedAtFrom: new Date("2022-12-01T00:00:00Z"),
      lastUpdatedAtTo: new Date("2029-12-01T00:00:00Z"),
      sellPriceFrom: 0,
      sellPriceTo: 100,
      sellCurrency: "ETHEREUM:0x0000000000000000000000000000000000000000",
    },
    sort: "EARLIEST",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { RaribleProtocolMcpCore } from "@rarible/protocol-mcp/core.js";
import { searchAPISearchItems } from "@rarible/protocol-mcp/funcs/searchAPISearchItems.js";

// Use `RaribleProtocolMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raribleProtocolMcp = new RaribleProtocolMcpCore({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const res = await searchAPISearchItems(raribleProtocolMcp, {
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      lastUpdatedAtFrom: new Date("2022-12-01T00:00:00Z"),
      lastUpdatedAtTo: new Date("2029-12-01T00:00:00Z"),
      sellPriceFrom: 0,
      sellPriceTo: 100,
      sellCurrency: "ETHEREUM:0x0000000000000000000000000000000000000000",
    },
    sort: "EARLIEST",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request models.ItemsSearchRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.Items>

Errors

Error Type Status Code Content Type
errors.UnionApiErrorBadRequest 400 application/json
errors.UnionApiErrorServerError 500 application/json
errors.APIError 4XX, 5XX */*

searchDuplicatedItems

Advanced search returns NFTs satisfying provided filter and with duplicated traits

Example Usage

import { RaribleProtocolMcp } from "@rarible/protocol-mcp";

const raribleProtocolMcp = new RaribleProtocolMcp({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const result = await raribleProtocolMcp.searchAPI.searchDuplicatedItems({
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      lastUpdatedAtFrom: new Date("2022-12-01T00:00:00Z"),
      lastUpdatedAtTo: new Date("2029-12-01T00:00:00Z"),
      sellPriceFrom: 0,
      sellPriceTo: 100,
      sellCurrency: "ETHEREUM:0x0000000000000000000000000000000000000000",
    },
    traits: [
      "series",
    ],
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { RaribleProtocolMcpCore } from "@rarible/protocol-mcp/core.js";
import { searchAPISearchDuplicatedItems } from "@rarible/protocol-mcp/funcs/searchAPISearchDuplicatedItems.js";

// Use `RaribleProtocolMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raribleProtocolMcp = new RaribleProtocolMcpCore({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const res = await searchAPISearchDuplicatedItems(raribleProtocolMcp, {
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      lastUpdatedAtFrom: new Date("2022-12-01T00:00:00Z"),
      lastUpdatedAtTo: new Date("2029-12-01T00:00:00Z"),
      sellPriceFrom: 0,
      sellPriceTo: 100,
      sellCurrency: "ETHEREUM:0x0000000000000000000000000000000000000000",
    },
    traits: [
      "series",
    ],
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request models.DuplicatedItemsSearchRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.DuplicatedItemGroups>

Errors

Error Type Status Code Content Type
errors.UnionApiErrorBadRequest 400 application/json
errors.UnionApiErrorServerError 500 application/json
errors.APIError 4XX, 5XX */*

searchOwnerships

Advanced search returns NFT Ownerships satisfying provided filter

Example Usage

import { RaribleProtocolMcp } from "@rarible/protocol-mcp";

const raribleProtocolMcp = new RaribleProtocolMcp({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const result = await raribleProtocolMcp.searchAPI.searchOwnerships({
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      sellPriceFrom: 0,
      sellPriceTo: 100,
      sellCurrency: "ETHEREUM:0x0000000000000000000000000000000000000000",
    },
    sort: "EARLIEST",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { RaribleProtocolMcpCore } from "@rarible/protocol-mcp/core.js";
import { searchAPISearchOwnerships } from "@rarible/protocol-mcp/funcs/searchAPISearchOwnerships.js";

// Use `RaribleProtocolMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raribleProtocolMcp = new RaribleProtocolMcpCore({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const res = await searchAPISearchOwnerships(raribleProtocolMcp, {
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      sellPriceFrom: 0,
      sellPriceTo: 100,
      sellCurrency: "ETHEREUM:0x0000000000000000000000000000000000000000",
    },
    sort: "EARLIEST",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request models.OwnershipSearchRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.Ownerships>

Errors

Error Type Status Code Content Type
errors.UnionApiErrorBadRequest 400 application/json
errors.UnionApiErrorServerError 500 application/json
errors.APIError 4XX, 5XX */*

searchActivities

Advanced search returns Activities satisfying provided filter

Example Usage

import { RaribleProtocolMcp } from "@rarible/protocol-mcp";

const raribleProtocolMcp = new RaribleProtocolMcp({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const result = await raribleProtocolMcp.searchAPI.searchActivities({
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      collections: [
        "ETHEREUM:0xb66a603f4cfe17e3d27b87a8bfcad319856518b8",
      ],
      items: [
        "ETHEREUM:0xb66a603f4cfe17e3d27b87a8bfcad319856518b8:32292934596187112148346015918544186536963932779440027682601542850818403729410",
      ],
      users: {
        any: [
          "ETHEREUM:0x4765273c477c2dc484da4f1984639e943adccfeb",
        ],
        from: [
          "ETHEREUM:0x4765273c477c2dc484da4f1984639e943adccfeb",
        ],
        to: [
          "ETHEREUM:0x4765273c477c2dc484da4f1984639e943adccfeb",
        ],
      },
      currencies: {
        bid: [
          "ETHEREUM:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        ],
      },
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { RaribleProtocolMcpCore } from "@rarible/protocol-mcp/core.js";
import { searchAPISearchActivities } from "@rarible/protocol-mcp/funcs/searchAPISearchActivities.js";

// Use `RaribleProtocolMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raribleProtocolMcp = new RaribleProtocolMcpCore({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const res = await searchAPISearchActivities(raribleProtocolMcp, {
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      collections: [
        "ETHEREUM:0xb66a603f4cfe17e3d27b87a8bfcad319856518b8",
      ],
      items: [
        "ETHEREUM:0xb66a603f4cfe17e3d27b87a8bfcad319856518b8:32292934596187112148346015918544186536963932779440027682601542850818403729410",
      ],
      users: {
        any: [
          "ETHEREUM:0x4765273c477c2dc484da4f1984639e943adccfeb",
        ],
        from: [
          "ETHEREUM:0x4765273c477c2dc484da4f1984639e943adccfeb",
        ],
        to: [
          "ETHEREUM:0x4765273c477c2dc484da4f1984639e943adccfeb",
        ],
      },
      currencies: {
        bid: [
          "ETHEREUM:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        ],
      },
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request models.ActivitySearchRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.Activities>

Errors

Error Type Status Code Content Type
errors.UnionApiErrorBadRequest 400 application/json
errors.UnionApiErrorServerError 500 application/json
errors.APIError 4XX, 5XX */*

searchCollection

Advanced search returns NFT Collections satisfying provided filter

Example Usage

import { RaribleProtocolMcp } from "@rarible/protocol-mcp";

const raribleProtocolMcp = new RaribleProtocolMcp({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const result = await raribleProtocolMcp.searchAPI.searchCollection({
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      text: "Apes",
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { RaribleProtocolMcpCore } from "@rarible/protocol-mcp/core.js";
import { searchAPISearchCollection } from "@rarible/protocol-mcp/funcs/searchAPISearchCollection.js";

// Use `RaribleProtocolMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raribleProtocolMcp = new RaribleProtocolMcpCore({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const res = await searchAPISearchCollection(raribleProtocolMcp, {
    filter: {
      blockchains: [
        "ETHEREUM",
      ],
      text: "Apes",
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request models.CollectionsSearchRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.Collections>

Errors

Error Type Status Code Content Type
errors.UnionApiErrorBadRequest 400 application/json
errors.UnionApiErrorServerError 500 application/json
errors.APIError 4XX, 5XX */*