Skip to content
This repository was archived by the owner on Aug 25, 2023. It is now read-only.

feat: implement func to get media id from private account post id#336

Open
mohsensamiei wants to merge 1 commit intoahmdrz:masterfrom
mohsensamiei:feature/get-media-id-from-private-id
Open

feat: implement func to get media id from private account post id#336
mohsensamiei wants to merge 1 commit intoahmdrz:masterfrom
mohsensamiei:feature/get-media-id-from-private-id

Conversation

@mohsensamiei
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Owner

@ahmdrz ahmdrz left a comment

Choose a reason for hiding this comment

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

Thank you for your interest.


const shortIDLen = 11

func MediaIDFromPrivateID(code string) (string, error) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It will be great if the original function could handle private IDs too. Move these lines to the original function.

)

func TestMediaIDFromPrivateID(t *testing.T) {
mediaID, err := MediaIDFromPrivateID("CFPU5jqA7F7gtdLtpBevHl5A6rVwt3fi4zVzs00")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Also, add more tests here to make sure about the function. For example, test invalid codes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants