Skip to content

Latest commit

 

History

History
2177 lines (1449 loc) · 35.3 KB

File metadata and controls

2177 lines (1449 loc) · 35.3 KB

Reference

Source: MediumApiClient

Article

Source: Article

Task<ArticleFansResponse> GetArticleFans(string articleId, CancellationToken ct = default);

Description

Returns a list of user_ids of the people who clapped on the article (a.k.a voters).

Usage

try
{
    var response = await client.Article.GetArticleFans(articleId);
    // TODO: Handle 'response' of type ArticleFansResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
articleId string It's a unique hash id assigned to every Medium Article.

Response

OnSuccess: ArticleFansResponse

OnError: SdkException<RawError>

Task<ArticleResponse> GetArticleInfo(string articleId, CancellationToken ct = default);

Description

Returns the article related information such as Title, Subtitle, Tags, Topics (assigned by Medium), Publication, Published date and time, Clap Count, Voter Count, Word Count, Reading Time, Language, etc…

Usage

try
{
    var response = await client.Article.GetArticleInfo(articleId);
    // TODO: Handle 'response' of type ArticleResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
articleId string It's a unique hash id assigned to every Medium Article.

Response

OnSuccess: ArticleResponse

OnError: SdkException<RawError>

Task<ArticleResponsesResponse> GetArticleResponses(string articleId, CancellationToken ct = default);

Description

Returns a list of responses (response_ids, same as article_ids) for a given article (article_id) Note: To see the content of the response, use the "Get Article's Content" endpoint

Usage

try
{
    var response = await client.Article.GetArticleResponses(articleId);
    // TODO: Handle 'response' of type ArticleResponsesResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
articleId string It's a unique hash id assigned to every Medium Article.

Response

OnSuccess: ArticleResponsesResponse

OnError: SdkException<RawError>

Task<ArticleContentResponse> GetArticleSContent(string articleId, CancellationToken ct = default);

Description

Returns the content of an article/story, for the corresponding article_id

Usage

try
{
    var response = await client.Article.GetArticleSContent(articleId);
    // TODO: Handle 'response' of type ArticleContentResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
articleId string It's a unique hash id assigned to every Medium Article.

Response

OnSuccess: ArticleContentResponse

OnError: SdkException<RawError>

Task<ArticleMarkdownResponse> GetArticleSMarkdown(string articleId, CancellationToken ct = default);

Description

Returns the markdown of an article/story from Medium, for the corresponding article_id

Usage

try
{
    var response = await client.Article.GetArticleSMarkdown(articleId);
    // TODO: Handle 'response' of type ArticleMarkdownResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
articleId string It's a unique hash id assigned to every Medium Article.

Response

OnSuccess: ArticleMarkdownResponse

OnError: SdkException<RawError>

Task<ArticleRelatedResponse> GetRelatedArticles(string articleId, CancellationToken ct = default);

Description

Returns a list of article_ids of the related posts. (Length = 5)

Note: If the given article is self-published, related posts will belong to the same author, else related posts will belong to the publication in which the article is published.

Usage

try
{
    var response = await client.Article.GetRelatedArticles(articleId);
    // TODO: Handle 'response' of type ArticleRelatedResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
articleId string It's a unique hash id assigned to every Medium Article.

Response

OnSuccess: ArticleRelatedResponse

OnError: SdkException<RawError>

ListModel

Source: ListModel

Task<ListArticlesResponse> GetListArticles(string listId, CancellationToken ct = default);

Description

Returns an array of articles_ids present in the given Medium List.

Usage

try
{
    var response = await client.ListModel.GetListArticles(listId);
    // TODO: Handle 'response' of type ListArticlesResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
listId string It's a unique hash id assigned to every Medium List.

Response

OnSuccess: ListArticlesResponse

OnError: SdkException<RawError>

Task<ListResponse> GetListInfo(string listId, CancellationToken ct = default);

Description

Returns the list-related information such as id, name, author, description, thumbnail image url, creation datetime, last article inserted datetime, number of articles in the list, claps, voters, and comments/responses.

Usage

try
{
    var response = await client.ListModel.GetListInfo(listId);
    // TODO: Handle 'response' of type ListResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
listId string It's a unique hash id assigned to every Medium List.

Response

OnSuccess: ListResponse

OnError: SdkException<RawError>

Task<ListResponsesResponse> GetListResponses(string listId, CancellationToken ct = default);

Description

Returns an array of response_ids of the comments (same as article_ids) on the given Medium List.

Usage

try
{
    var response = await client.ListModel.GetListResponses(listId);
    // TODO: Handle 'response' of type ListResponsesResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
listId string It's a unique hash id assigned to every Medium List.

Response

OnSuccess: ListResponsesResponse

OnError: SdkException<RawError>

Misc

Source: Misc

Task<LatestpostsResponse> GetLatestPosts(string topicSlug, CancellationToken ct = default);

Description

Returns a list of latest posts (article_ids) for a topic/niche (as classified by the Medium platform). Example of a topic/niche can be:

  • blockchain
  • relationships
  • mental-health, etc …

These are known as topic_slugs. At any given moment, this endpoint will return a list of 25 articles (article_ids).

Usage

try
{
    var response = await client.Misc.GetLatestPosts(topicSlug);
    // TODO: Handle 'response' of type LatestpostsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
topicSlug string It's a unique string, usually hyphen-separated, representing a topic/niche, as classified by Medium.

Response

OnSuccess: LatestpostsResponse

OnError: SdkException<RawError>

Task<RelatedTagsResponse> GetRelatedTags(string tag, CancellationToken ct = default);

Description

Returns a list of related_tags for the given tag.

Usage

try
{
    var response = await client.Misc.GetRelatedTags(tag);
    // TODO: Handle 'response' of type RelatedTagsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
tag string It's a unique string, usually hyphen-separated, representing a class of content.

Response

OnSuccess: RelatedTagsResponse

OnError: SdkException<RawError>

Task<TopWriterResponse> GetTopWriters(string topicSlug, int? count, CancellationToken ct = default);

Description

Returns a list of top writers (user_ids) within a particular topic/niche (topic_slug). e.g.

  • blockchain
  • relationships
  • artificial-intelligence, etc ...

Note: You can use optional count query parameter to limit the number of results. The maximum number of top writers within a topic/niche will be 250.

Usage

try
{
    var response = await client.Misc.GetTopWriters(topicSlug, count);
    // TODO: Handle 'response' of type TopWriterResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
topicSlug string It's a unique string, usually hyphen-separated, representing a topic/niche, as classified by Medium.
count int? Limits the number of article_ids in the result.

Response

OnSuccess: TopWriterResponse

OnError: SdkException<RawError>

Task<TopfeedsResponse> GetTopfeeds(string tag, string mode, int? after = 0, int? count = 25, CancellationToken ct = default);

Description

Returns a list of article_ids (length: 25) for the given tag and mode.

Usage

try
{
    var response = await client.Misc.GetTopfeeds(tag, mode);
    // TODO: Handle 'response' of type TopfeedsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
tag string It's a unique string, usually hyphen-separated, representing a class of content.
mode string Mode:

- hot : For getting trending articles
- new : For getting latest articles
- top_year : For getting best articles of the year
- top_month : For getting best articles of the month
- top_week : For getting best articles of the week
- top_all_time: For getting best article of all time
after int? To get the subsequent top feeds. (after < 250)
Default: 0
count int? To limit the number of top feeds. (count < 25)
Default: 25

Response

OnSuccess: TopfeedsResponse

OnError: SdkException<RawError>

Publication

Source: Publication

Task<PublicationArticlesResponse> GetPublicationArticles(string publicationId, string? from, CancellationToken ct = default);

Description

Returns the list of articles_ids, of the latest 25 articles, posted in that publication.

Usage

try
{
    var response = await client.Publication.GetPublicationArticles(publicationId, from);
    // TODO: Handle 'response' of type PublicationArticlesResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
publicationId string It's a unique hash id assigned to every Medium Publication.
from string? To get the articles before specified date and time.

Response

OnSuccess: PublicationArticlesResponse

OnError: SdkException<RawError>

Task<PublicationIdForResponse> GetPublicationId(string publicationSlug, CancellationToken ct = default);

Description

Returns the unique publication_id for the given publication_slug.

Note: You can find the publication_slug from the publication's homepage URL.

  • medium.com/publication_slug

Usage

try
{
    var response = await client.Publication.GetPublicationId(publicationSlug);
    // TODO: Handle 'response' of type PublicationIdForResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
publicationSlug string It's a lowercased hyphen-separated unique string alloted to each Medium Publication.

Response

OnSuccess: PublicationIdForResponse

OnError: SdkException<RawError>

Task<PublicationResponse> GetPublicationInfo(string publicationId, CancellationToken ct = default);

Description

Returns the publication related information such as Publication name, Tagline, Description, Tags, Followers Count, Twitter username, Instagram username, Facebook Page name, etc …

Note: If you don't know the publication_id, you can get it from any article published by it. Use endpoint "/article/{article_id}" to retrieve the publication_id.

Usage

try
{
    var response = await client.Publication.GetPublicationInfo(publicationId);
    // TODO: Handle 'response' of type PublicationResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
publicationId string It's a unique hash id assigned to every Medium Publication.

Response

OnSuccess: PublicationResponse

OnError: SdkException<RawError>

Task<PublicationNewsletterResponse> GetPublicationNewsletter(string publicationId, CancellationToken ct = default);

Description

Returns the newsletter related information such as id, name, description, slug, creator_id, subscribers, image_url, etc …

Note: If you don't know the publication_id, you can get it from any article published by it. Use endpoint "/article/{article_id}" to retrieve the publication_id.

Usage

try
{
    var response = await client.Publication.GetPublicationNewsletter(publicationId);
    // TODO: Handle 'response' of type PublicationNewsletterResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
publicationId string It's a unique hash id assigned to every Medium Publication.

Response

OnSuccess: PublicationNewsletterResponse

OnError: SdkException<RawError>

Search

Source: Search

Task<SearchArticlesResponse> SearchArticles(string query, CancellationToken ct = default);

Description

Returns the list of articles_ids for the given search query results. (Max Length = 1000)

Usage

try
{
    var response = await client.Search.SearchArticles(query);
    // TODO: Handle 'response' of type SearchArticlesResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
query string Search query

Response

OnSuccess: SearchArticlesResponse

OnError: SdkException<RawError>

Task<SearchListsResponse> SearchLists(string query, CancellationToken ct = default);

Description

Returns an array of list_ids for the given search query results. (Max Length = 1000)

Usage

try
{
    var response = await client.Search.SearchLists(query);
    // TODO: Handle 'response' of type SearchListsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
query string Search query

Response

OnSuccess: SearchListsResponse

OnError: SdkException<RawError>

Task<SearchPublicationsResponse> SearchPublications(string query, CancellationToken ct = default);

Description

Returns the list of publication_ids for the given search query results. (Max Length = 1000)

Usage

try
{
    var response = await client.Search.SearchPublications(query);
    // TODO: Handle 'response' of type SearchPublicationsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
query string Search query

Response

OnSuccess: SearchPublicationsResponse

OnError: SdkException<RawError>

Task<SearchTagsResponse> SearchTags(string query, CancellationToken ct = default);

Description

Returns a list of tags for the given search query results. (Max Length = 1000)

Usage

try
{
    var response = await client.Search.SearchTags(query);
    // TODO: Handle 'response' of type SearchTagsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
query string Search query

Response

OnSuccess: SearchTagsResponse

OnError: SdkException<RawError>

Task<SearchUsersResponse> SearchUsers(string query, CancellationToken ct = default);

Description

Returns a list of user_ids for the given search query results. (Max Length = 1000)

Usage

try
{
    var response = await client.Search.SearchUsers(query);
    // TODO: Handle 'response' of type SearchUsersResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
query string Search query

Response

OnSuccess: SearchUsersResponse

OnError: SdkException<RawError>

User

Source: User

Task<UserFollowersResponse> GetUserFollowers(string userId, int? count, CancellationToken ct = default);

Description

Returns the list of user_ids of the user's followers.

Note: The length of this followers' list might be different from what you get in the "Get User Info" Endpoint. It's because, this list doesn't include Medium Users who left the platform. If you really need the exact followers' count, use this endpoint to get the followers' list and take its length as the exact followers' count

Usage

try
{
    var response = await client.User.GetUserFollowers(userId, count);
    // TODO: Handle 'response' of type UserFollowersResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
userId string Unique hash id assigned to every single Medium user.
count int? To limit the number of results. (count < 1500)

Response

OnSuccess: UserFollowersResponse

OnError: SdkException<RawError>

Task<UserFollowingResponse> GetUserFollowing(string userId, int? count, CancellationToken ct = default);

Description

Returns the list of user_ids of the user's followings.

Note: Currently, this list does not contain the publication_ids of the publications that the user is following.

Usage

try
{
    var response = await client.User.GetUserFollowing(userId, count);
    // TODO: Handle 'response' of type UserFollowingResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
userId string Unique hash id assigned to every single Medium user.
count int? To limit the number of results. (count < 1500)

Response

OnSuccess: UserFollowingResponse

OnError: SdkException<RawError>

Task<UserIdForResponse> GetUserId(string username, CancellationToken ct = default);

Description

Returns the unique user_id for the given username.

Note: You can find the username from the user's/author's profile page URL.

  • username.medium.com
  • medium.com/@username

Usage

try
{
    var response = await client.User.GetUserId(username);
    // TODO: Handle 'response' of type UserIdForResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
username string It's a unique string chosen by every single Medium user.

Response

OnSuccess: UserIdForResponse

OnError: SdkException<RawError>

Task<UserResponse> GetUserInfo(string userId, CancellationToken ct = default);

Description

Returns user related information like Full name, Bio, Followers count, Following count, Twitter username, Profile-image URL, User ID, etc...

It takes user_id as the path parameter.

Note: If you don't know the user_id, then you can get it from the endpoint
'/user/id_for/{username}'.

Usage

try
{
    var response = await client.User.GetUserInfo(userId);
    // TODO: Handle 'response' of type UserResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
userId string It's a unique hash id assigned to every single Medium user.

Response

OnSuccess: UserResponse

OnError: SdkException<RawError>

Task<UserArticlesResponse> GetUserSArticles(string userId, CancellationToken ct = default);

Description

Returns the list of articles (article_ids) written by the user.

Usage

try
{
    var response = await client.User.GetUserSArticles(userId);
    // TODO: Handle 'response' of type UserArticlesResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
userId string Unique hash id assigned to every single Medium user.

Response

OnSuccess: UserArticlesResponse

OnError: SdkException<RawError>

Task<UserInterestsResponse> GetUserSInterests(string userId, CancellationToken ct = default);

Description

Returns a list of tags that the given user follows.

Usage

try
{
    var response = await client.User.GetUserSInterests(userId);
    // TODO: Handle 'response' of type UserInterestsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
userId string Unique hash id assigned to every single Medium user.

Response

OnSuccess: UserInterestsResponse

OnError: SdkException<RawError>

Task<UserListsResponse> GetUserSLists(string userId, CancellationToken ct = default);

Description

Returns an array of list_ids created by the user.

Note: You can check whether the use has created lists or not beforehand. Check the has_list attribute in the "Article Info" endpoint.

Usage

try
{
    var response = await client.User.GetUserSLists(userId);
    // TODO: Handle 'response' of type UserListsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
userId string Unique hash id assigned to every single Medium user.

Response

OnSuccess: UserListsResponse

OnError: SdkException<RawError>

Task<UserPublicationsResponse> GetUserSPublications(string userId, CancellationToken ct = default);

Description

Returns a list of publication_ids where the user is the editor and/or creator.

Usage

try
{
    var response = await client.User.GetUserSPublications(userId);
    // TODO: Handle 'response' of type UserPublicationsResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
userId string Unique hash id assigned to every single Medium user.

Response

OnSuccess: UserPublicationsResponse

OnError: SdkException<RawError>

Task<UserTopArticlesResponse> GetUserSTopArticles(string userId, CancellationToken ct = default);

Description

Returns a list of article_ids of the top 10 articles on the user's profile, for a given user_id.

Usage

try
{
    var response = await client.User.GetUserSTopArticles(userId);
    // TODO: Handle 'response' of type UserTopArticlesResponse
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Parameters

Name Type Description
userId string Unique hash id assigned to every single Medium user.

Response

OnSuccess: UserTopArticlesResponse

OnError: SdkException<RawError>

Welcome

Source: Welcome

Task<Response> GetWelcome(CancellationToken ct = default);

Description

Test Endpoint Returns the information about the Medium API

Usage

try
{
    var response = await client.Welcome.GetWelcome();
    // TODO: Handle 'response' of type Response
}
catch (SdkException<RawError> ex)
{
    // TODO: Handle 'ex.Error' of type RawError
}

Response

OnSuccess: Response

OnError: SdkException<RawError>