Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ colleciton by Id in #49

Merged
merged 9 commits into from
Oct 10, 2024
Merged

Conversation

roiLeo
Copy link
Contributor

@roiLeo roiLeo commented Sep 23, 2024

route is ugly but it's working

stdout | test/path.test.ts > Path utils > collecion id in > should do something
{
  baseURL: 'https://kodadot.squids.live/basick/graphql',
  query: {
    query: 'query  { collections: collectionEntities(where: {id_in: ["0xd9a2c93ba2e9fae10fe762a42ee807bbf95764cc","0x2f36072129aabb22bd4afffca0640a3e02695925"]})  { id, createdAt, name, image, metadata, currentOwner, issuer } }',
    variables: {}
  },
  path: '/base/collectionByIdIn/0xd9a2c93ba2e9fae10fe762a42ee807bbf95764cc,0x2f36072129aabb22bd4afffca0640a3e02695925'
}
{
  "data": {
    "collections": [
      {
        "id": "0xd9a2c93ba2e9fae10fe762a42ee807bbf95764cc",
        "createdAt": "2024-05-20T17:02:17.000000Z",
        "name": "Basescapes",
        "image": "ipfs://bafybeiaystlm6xszy3eq5ovqgqjwxwgpeztdrvbsixiqx6me56yxp7efrq",
        "metadata": "ipfs://bafkreicljf6qmoula5u3l4jgrdilias6ucd54cecp7nw4iq2zeoesfee3e",
        "currentOwner": "0xE844b2a0a6453250c920BD2b4B7741946aB16C08",
        "issuer": "0xe844b2a0a6453250c920bd2b4b7741946ab16c08"
      },
      {
        "id": "0x2f36072129aabb22bd4afffca0640a3e02695925",
        "createdAt": "2024-09-10T08:30:31.000000Z",
        "name": "Harmony",
        "image": "ipfs://QmUyoKGVTiDTrQzjLdwj41q9K3rfHa7K68zQuoPXhnEm28",
        "metadata": "ipfs://QmcUD2wSowiUz9rxrSXgAbtiUWuZcoYGS7brJC359BCPw7",
        "currentOwner": "0xE844b2a0a6453250c920BD2b4B7741946aB16C08",
        "issuer": "0xe844b2a0a6453250c920bd2b4b7741946ab16c08"
      }
    ]
  }
}

// TODO:

  • send id as query param
  • id: string[]

@roiLeo roiLeo marked this pull request as ready for review September 24, 2024 15:22
src/clients/SquidClient.ts Outdated Show resolved Hide resolved
Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small

roiLeo and others added 2 commits October 4, 2024 15:58
@roiLeo
Copy link
Contributor Author

roiLeo commented Oct 4, 2024

small

// TODO:

* send id as query param

any idea how to achieve that?

@vikiival
Copy link
Member

vikiival commented Oct 4, 2024

any idea how to achieve that?

I would like to rewrite /rest package ideally :)

Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob change impl

src/clients/SquidClient.ts Outdated Show resolved Hide resolved
@vikiival
Copy link
Member

vikiival commented Oct 4, 2024

Also pls merge main

@vikiival
Copy link
Member

vikiival commented Oct 9, 2024

Works

import { getClient }  from './dist/index.mjs'
const client = getClient('ahp')
const query = client.collectionByIdIn('1,13,163,171')
const result = await client.fetch(query)
console.log(result)

Does not work

import { getClient }  from './dist/index.mjs'
const client = getClient('ahp')
const query = client.collectionByIdIn(['1', '13', '163', '171'])
const result = await client.fetch(query)
console.log(result)

cc @roiLeo one more fix plz

@roiLeo
Copy link
Contributor Author

roiLeo commented Oct 9, 2024

Should be ok, added more test
Capture d’écran 2024-10-09 à 4 07 25 PM

test/index.test.ts Outdated Show resolved Hide resolved
@vikiival vikiival merged commit 32b36cb into kodadot:main Oct 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

collectionListByIdIn
2 participants