Skip to content

Commit 2ad7f55

Browse files
authored
Merge pull request #51 from dimitrov-d/master
Add type parameter to generateIpfsLink
2 parents 8499bd0 + 99d38f7 commit 2ad7f55

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@apillon/sdk",
33
"description": "▶◀ Apillon SDK for NodeJS ▶◀",
4-
"version": "3.9.0",
4+
"version": "3.10.0",
55
"author": "Apillon",
66
"license": "MIT",
77
"main": "./dist/index.js",

packages/sdk/src/modules/storage/storage.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ export class Storage extends ApillonModule {
7171
* Apillon IPFS gateways are private and can only be accessible with a token.
7272
* @docs [Generate an IPFS link](https://wiki.apillon.io/build/2-storage-api.html#get-or-generate-link-for-ipfs)
7373
* @param {string} cid The CID or IPNS address of the fie
74+
* @param {string} type The type of the link to generate based on the gateway. Can be 'ipfs' or 'ipns'.
7475
* @returns {Promise<string>} The IPFS link where the requested content can be accessed.
7576
*/
76-
public async generateIpfsLink(cid: string): Promise<string> {
77+
public async generateIpfsLink(
78+
cid: string,
79+
type: 'ipfs' | 'ipns' = 'ipfs',
80+
): Promise<string> {
7781
const { link } = await ApillonApi.get<{ link: string }>(
78-
`${this.API_PREFIX}/link-on-ipfs/${cid}`,
82+
`${this.API_PREFIX}/link-on-ipfs/${cid}?type=${type}`,
7983
);
8084
return link;
8185
}

0 commit comments

Comments
 (0)