@show-karma/karma-gap-sdk 0.2.5 → 0.2.7

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.
@@ -78,6 +78,12 @@ export declare abstract class Fetcher extends AxiosGQL {
78
78
  * @returns
79
79
  */
80
80
  abstract projectBySlug(slug: string): Promise<Project>;
81
+ /**
82
+ * Search projects by name. This method will return a list of projects
83
+ * __Must be implemented by the indexer__
84
+ * @param query
85
+ */
86
+ abstract searchProjects(query: string): Promise<Project[]>;
81
87
  /**
82
88
  * Fetch projects with details and members.
83
89
  * @param name if set, will search by the name.
@@ -44,6 +44,7 @@ export declare class GapEasClient extends Fetcher {
44
44
  projectById(uid: Hex): Promise<Project>;
45
45
  projectBySlug(slug: string): Promise<Project>;
46
46
  slugExists(slug: string): Promise<boolean>;
47
+ searchProjects(query: string): Promise<Project[]>;
47
48
  projects(name?: string): Promise<Project[]>;
48
49
  projectsOf(grantee: Hex): Promise<Project[]>;
49
50
  grantee(address: Hex): Promise<Grantee>;
@@ -229,6 +229,9 @@ class GapEasClient extends Fetcher_1.Fetcher {
229
229
  const { schema: { attestations }, } = await this.query(query);
230
230
  return attestations.some((a) => a.decodedDataJson.includes(slug));
231
231
  }
232
+ searchProjects(query) {
233
+ throw new Error('Method not implemented.');
234
+ }
232
235
  async projects(name) {
233
236
  const result = await this.attestations('Project', name);
234
237
  if (!result.length)
@@ -16,6 +16,7 @@ export declare class GapIndexerClient extends Fetcher {
16
16
  communityById(uid: `0x${string}`): Promise<Community>;
17
17
  projectBySlug(slug: string): Promise<Project>;
18
18
  projectById(uid: `0x${string}`): Promise<Project>;
19
+ searchProjects(query: string): Promise<Project[]>;
19
20
  projects(name?: string): Promise<Project[]>;
20
21
  projectsOf(grantee: `0x${string}`): Promise<Project[]>;
21
22
  grantee(address: `0x${string}`): Promise<Grantee>;
@@ -91,6 +91,14 @@ class GapIndexerClient extends Fetcher_1.Fetcher {
91
91
  projectById(uid) {
92
92
  return this.projectBySlug(uid);
93
93
  }
94
+ async searchProjects(query) {
95
+ const { data } = await this.client.get(Endpoints.project.all(), {
96
+ params: {
97
+ q: query,
98
+ },
99
+ });
100
+ return entities_1.Project.from(data);
101
+ }
94
102
  async projects(name) {
95
103
  const { data } = await this.client.get(Endpoints.project.all(), {
96
104
  params: {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.5",
6
+ "version": "0.2.7",
7
7
  "description": "Simple and easy interface between EAS and Karma GAP.",
8
8
  "main": "./index.js",
9
9
  "author": "KarmaHQ",