Skip to content

NeroBlackstone/Forem.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forem.jl

Julia client for Forem API v1. It can query the content of dev.to.

API Key

Please apply for your DEV Community API Keys first. Then paste your api key at $HOME/.config/FOREM_KEY.txt. Or save api key to FOREM_KEY environment variable.

Initialization

Before calling the Forem interface, you need to initialize the corresponding Forem API through init_api().

There are 14 API implementations. You need to initialize them to call the corresponding interfaces.

  • ArticlesApi
  • CommentsApi
  • DisplayAdsApi
  • FollowedTagsApi
  • FollowersApi
  • OrganizationsApi
  • PagesApi
  • PodcastEpisodesApi
  • ProfileImagesApi
  • ReactionsApi
  • ReadinglistApi
  • TagsApi
  • UsersApi
  • VideosApi

To confirm the API implementation corresponding to specific API Endpoints, please check API Endpoints.

For example, get a article about Julia

julia> using Forem
julia> articles_api = init_api(APIClient.ArticlesApi)
julia> first(get_articles(articles_api;tag="julia",per_page=1))
first(get_articles(articles_api; tag = "julia", per_page = 1)) = Forem.APIClient.ArticleIndex[{
  "type_of": "article",
  "id": 1435846,
  "title": "Julia Plotting Cheat Sheet",
  "description": "This cheat sheet provides an overview of the most commonly used plotting functions and attributes in...",
  "cover_image": "https://media.dev.to/cdn-cgi/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fspjt0u51kej4ew7f1uqh.png",
  "readable_publish_date": "Apr 14 '23",
  "social_image": "https://media.dev.to/cdn-cgi/image/width=1000,height=500,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fspjt0u51kej4ew7f1uqh.png",
  "tag_list": [
    "julialang",
    "linearalgebra",
    "datascience",
    "julia"
  ],
  "tags": "julialang, linearalgebra, datascience, julia",
  "slug": "julia-plotting-cheat-sheet-n6j",
  "path": "/aicofounded/julia-plotting-cheat-sheet-n6j",
  "url": "https://dev.to/aicofounded/julia-plotting-cheat-sheet-n6j",
  "canonical_url": "https://dev.to/aicofounded/julia-plotting-cheat-sheet-n6j",
  "positive_reactions_count": 2,
  "public_reactions_count": 2,
  "created_at": "2023-04-14T14:09:45+00:00",
  "published_at": "2023-04-14T20:08:53+00:00",
  "last_comment_at": "2023-04-14T20:08:53+00:00",
  "published_timestamp": "2023-04-14T20:08:53+00:00",
  "reading_time_minutes": 4,
  "user": {
    "name": "AI Co-Founded",
    "username": "aicofounded",
    "twitter_username": "CodeOnTheRocks_",
    "website_url": "https://www.aicofounded.com/",
    "profile_image": "https://media.dev.to/cdn-cgi/image/width=640,height=640,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F924554%2F1c50e0b3-d130-4c89-8d98-73d0a767cce7.png",
    "profile_image_90": "https://media.dev.to/cdn-cgi/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F924554%2F1c50e0b3-d130-4c89-8d98-73d0a767cce7.png"
  }
}
]

Julia API client for APIClient

Access Forem articles, users and other resources via API. For a real-world example of Forem in action, check out DEV. All endpoints can be accessed with the 'api-key' header and a accept header, but some of them are accessible publicly without authentication.

    Dates and date times, unless otherwise specified, must be in
    the [RFC 3339](https://tools.ietf.org/html/rfc3339) format.

Overview

This API client was generated by the OpenAPI Generator project. By using the openapi-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Generator version: 7.5.0
  • Build package: org.openapitools.codegen.languages.JuliaClientCodegen

Installation

Place the Julia files generated under the src folder in your Julia project. Include APIClient.jl in the project code. It would include the module named APIClient.

Documentation is generated as markdown files under the docs folder. You can include them in your project documentation. Documentation is also embedded in Julia which can be used with a Julia specific documentation generator.

API Endpoints

Class Method
ArticlesApi create_article
POST /articles
Publish article
ArticlesApi get_article_by_id
GET /articles/{id}
Published article by id
ArticlesApi get_article_by_path
GET /articles/{username}/{slug}
Published article by path
ArticlesApi get_articles
GET /articles
Published articles
ArticlesApi get_latest_articles
GET /articles/latest
Published articles sorted by published date
ArticlesApi get_org_articles
GET /organizations/{username}/articles
Organization's Articles
ArticlesApi get_user_all_articles
GET /articles/me/all
User's all articles
ArticlesApi get_user_articles
GET /articles/me
User's articles
ArticlesApi get_user_published_articles
GET /articles/me/published
User's published articles
ArticlesApi get_user_unpublished_articles
GET /articles/me/unpublished
User's unpublished articles
ArticlesApi unpublish_article
PUT /articles/{id}/unpublish
Unpublish an article
ArticlesApi update_article
PUT /articles/{id}
Update an article by id
ArticlesApi videos
GET /videos
Articles with a video
CommentsApi get_comment_by_id
GET /comments/{id}
Comment by id
CommentsApi get_comments_by_article_id
GET /comments
Comments
DisplayAdsApi display_ads_get
GET /display_ads
display ads
DisplayAdsApi display_ads_id_get
GET /display_ads/{id}
display ad
DisplayAdsApi display_ads_id_put
PUT /display_ads/{id}
display ads
DisplayAdsApi display_ads_id_unpublish_put
PUT /display_ads/{id}/unpublish
unpublish
DisplayAdsApi display_ads_post
POST /display_ads
display ads
FollowedTagsApi get_followed_tags
GET /follows/tags
Followed Tags
FollowersApi get_followers
GET /followers/users
Followers
OrganizationsApi get_org_articles
GET /organizations/{username}/articles
Organization's Articles
OrganizationsApi get_org_users
GET /organizations/{username}/users
Organization's users
OrganizationsApi get_organization
GET /organizations/{username}
An organization
PagesApi pages_get
GET /pages
show details for all pages
PagesApi pages_id_delete
DELETE /pages/{id}
remove a page
PagesApi pages_id_get
GET /pages/{id}
show details for a page
PagesApi pages_id_put
PUT /pages/{id}
update details for a page
PagesApi pages_post
POST /pages
pages
PodcastEpisodesApi get_podcast_episodes
GET /podcast_episodes
Podcast Episodes
ProfileImagesApi get_profile_image
GET /profile_images/{username}
A Users or organizations profile image
ReactionsApi reactions_post
POST /reactions
create reaction
ReactionsApi reactions_toggle_post
POST /reactions/toggle
toggle reaction
ReadinglistApi get_readinglist
GET /readinglist
Readinglist
TagsApi get_followed_tags
GET /follows/tags
Followed Tags
TagsApi get_tags
GET /tags
Tags
UsersApi get_org_users
GET /organizations/{username}/users
Organization's users
UsersApi get_user
GET /users/{id}
A User
UsersApi get_user_all_articles
GET /articles/me/all
User's all articles
UsersApi get_user_articles
GET /articles/me
User's articles
UsersApi get_user_me
GET /users/me
The authenticated user
UsersApi get_user_published_articles
GET /articles/me/published
User's published articles
UsersApi get_user_unpublished_articles
GET /articles/me/unpublished
User's unpublished articles
UsersApi post_admin_users_create
POST /admin/users
Invite a User
UsersApi suspend_user
PUT /users/{id}/suspend
Suspend a User
UsersApi unpublish_user
PUT /users/{id}/unpublish
Unpublish a User's Articles and Comments
VideosApi videos
GET /videos
Articles with a video

Models

Authorization

Authentication schemes defined for the API:

api-key

  • Type: API key

Example

    using OpenAPI
    using OpenAPI.Clients
    import OpenAPI.Clients: Client
    client = Client(server_uri)
    api = MyApi(client)
    result = callApi(api, args...; api_key)

Author

About

Julia wrapper for Forem API v1

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages