Skip to content

Add 3 remote pin api#102

Open
zu1k wants to merge 9 commits into
ferristseng:masterfrom
zu1k:remote_pin
Open

Add 3 remote pin api#102
zu1k wants to merge 9 commits into
ferristseng:masterfrom
zu1k:remote_pin

Conversation

@zu1k

@zu1k zu1k commented Jun 11, 2022

Copy link
Copy Markdown

Add 3 remote pin api:

  • /pin/remote/add
  • /pin/remote/ls
  • /pin/remote/rm

zu1k added 7 commits June 11, 2022 21:12
Signed-off-by: zu1k <i@zu1k.com>
Signed-off-by: zu1k <i@zu1k.com>
Signed-off-by: zu1k <i@zu1k.com>
Signed-off-by: zu1k <i@zu1k.com>
Signed-off-by: zu1k <i@zu1k.com>
Signed-off-by: zu1k <i@zu1k.com>
Signed-off-by: zu1k <i@zu1k.com>
@zu1k zu1k marked this pull request as draft June 12, 2022 03:03
Signed-off-by: zu1k <i@zu1k.com>
@ferristseng ferristseng marked this pull request as ready for review July 26, 2022 13:02
@ferristseng

Copy link
Copy Markdown
Owner

@zu1k Do you want me to review this?

@zu1k

zu1k commented Jul 30, 2022

Copy link
Copy Markdown
Author

@ferristseng Sorry for the delay.

This PR is currently available, but not complete.

I found that some api's actual implementation is slightly different from the description in the documentation, especially when dealing with multiple cids at the same time.

You can review this PR now and I'll add more details on the problem I'm having so far at a later time.

@zu1k

zu1k commented Jul 30, 2022

Copy link
Copy Markdown
Author

The problem mainly lies in the processing of multiple cids. The document says to use comma to separate, but after testing, it is found that the document is inconsistent with the implementation.

comma-separated

as described in the documentation, but doesn't work

# curl -X POST "http://192.168.226.4:5001/api/v0/pin/remote/ls?service=Pinata&cid=bafybeiaq3hspbuvhvg7nlxjjvsnzit6m6hevrjwedoj4jbx6uycgkkexni%2CQmfWC6JwVxmjVQfPpSiTsxFaSBdPTtFCd1B4aqMqRgaeMU"
{"Message":"CID \"bafybeiaq3hspbuvhvg7nlxjjvsnzit6m6hevrjwedoj4jbx6uycgkkexni,QmfWC6JwVxmjVQfPpSiTsxFaSBdPTtFCd1B4aqMqRgaeMU\" cannot be parsed: illegal base32 data at input byte 58","Code":0,"Type":"error"}

multi params

It works, but it seems that Rust http client do not support this. Please let me know if there is a suitable way to implement this.

# curl -X POST "http://192.168.226.4:5001/api/v0/pin/remote/ls?service=Pinata&cid=bafybeiaq3hspbuvhvg7nlxjjvsnzit6m6hevrjwedoj4jbx6uycgkkexni&cid=QmfWC6JwVxmjVQfPpSiTsxFaSBdPTtFCd1B4aqMqRgaeMU"
{"Status":"pinned","Cid":"QmfWC6JwVxmjVQfPpSiTsxFaSBdPTtFCd1B4aqMqRgaeMU","Name":""}
{"Status":"pinned","Cid":"bafybeiaq3hspbuvhvg7nlxjjvsnzit6m6hevrjwedoj4jbx6uycgkkexni","Name":""}

Comment thread ipfs-api-prelude/src/api.rs
Comment thread ipfs-api-prelude/src/api.rs
Comment thread ipfs-api-prelude/src/api.rs Outdated
Comment thread ipfs-api-prelude/src/api.rs
Comment thread ipfs-api-prelude/src/request/pin.rs Outdated
Comment thread ipfs-api-prelude/src/request/pin.rs Outdated
@ferristseng

Copy link
Copy Markdown
Owner

@ferristseng Sorry for the delay.

This PR is currently available, but not complete.

I found that some api's actual implementation is slightly different from the description in the documentation, especially when dealing with multiple cids at the same time.

You can review this PR now and I'll add more details on the problem I'm having so far at a later time.

No rush! It just looked pretty complete so I wanted to check and see what was up.

Signed-off-by: zu1k <i@zu1k.com>
@zu1k

zu1k commented Jul 31, 2022

Copy link
Copy Markdown
Author

No rush! It just looked pretty complete so I wanted to check and see what was up.

I still haven't found a proper way to generate request parameters like cid=cid_1&cid=cid_2, please let me know if there is a proper way.

Maybe we can pull a request to kubo (go-ipfs) to support comma separation.

@Xuanwo

Xuanwo commented Jul 31, 2022

Copy link
Copy Markdown
Contributor

There is not http standard supports query like cid=abc&cid=def. I think we should report this as a bug to kubo.

As in this PR, I prefer to merge as-is. We can start another issue to track the multiple cids support.

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.

3 participants