Contents api incomplete/incompatible #484

Closed
opened 2021-02-06 07:32:14 +00:00 by cameronbraid · 4 comments
Contributor

I am wanting to use the contents api to list files in a directory using

get /repos/{owner}/{repo}/contents/{filepath}

The API docs say Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir

So this endpoint can return a single item or an array of items - however the go-sdk implenments the response type as ContentsResponse struct

Should this go-sdk change to always return a []ContentsResponse and in the case of requesnting a single file, just return a single item in the array ?

I am wanting to use the contents api to list files in a directory using **get /repos/{owner}/{repo}/contents/{filepath}** The API docs say `Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir` So this endpoint can return a single item or an array of items - however the go-sdk implenments the response type as `ContentsResponse struct` Should this go-sdk change to always return a `[]ContentsResponse` and in the case of requesnting a single file, just return a single item in the array ?
Author
Contributor

Or should a new api method be introduced like ListContents which returns an []ContentsResponse and its up to the caller to call the right one based on them accssing a file or a directory ?

Or should a new api method be introduced like `ListContents` which returns an `[]ContentsResponse` and its up to the caller to call the right one based on them accssing a file or a directory ?
Owner

Good questuon, ... If you have good proposal, just let me know. I'll test what is most convinient/intuetive ...

Good questuon, ... If you have good proposal, just let me know. I'll test what is most convinient/intuetive ...
Author
Contributor

What about

61f0dfe11c

What about https://gitea.com/cameronbraid/go-sdk/commit/61f0dfe11c3f14d25ddd54c7e05c2329dfefdb94
Owner

@cameronbraid yes - can you make a pull from your commit ?

@cameronbraid yes - can you make a pull from your commit ?
6543 added this to the v0.14.0 milestone 2021-02-12 20:53:36 +00:00
6543 added the
kind/bug
label 2021-02-12 22:10:00 +00:00
6543 added the
has/pull
label 2021-02-13 05:44:51 +00:00
6543 closed this issue 2021-02-15 06:51:39 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/go-sdk#484
No description provided.