Skip to content

Repository files navigation

OpenAPIClient-php

Access Forem articles, users and other resources via API.

For a real-world example of Forem in action, check out DEV.

All endpoints that don't require authentication are CORS enabled.

Dates and date times, unless otherwise specified, must be in the RFC 3339 format.

Authentication

For more information, please visit https://dev.to/contact.

Installation & Usage

Requirements

PHP 7.2 and later.

Composer

To install the bindings via Composer, add the following to composer.json:

{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/bitween-software/dev-to-open-api-client.git"
}
],
"require": {
"bitween-software/dev-to-open-api-client": "*@dev"
}
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?phprequire_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?phprequire_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key$config = Bitween\DevTo\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// $config = Bitween\DevTo\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');// Configure OAuth2 access token for authorization: oauth2$config = Bitween\DevTo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
// Configure OAuth2 access token for authorization: oauth2$config = Bitween\DevTo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = newBitween\DevTo\Api\AdminConfigurationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.// This is optional, `GuzzleHttp\Client` will be used as default.newGuzzleHttp\Client(),
$config
);
try {
$result = $apiInstance->getConfig();
print_r($result);
} catch (Exception$e) {
echo'Exception when calling AdminConfigurationApi->getConfig: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://dev.to/api

ClassMethodHTTP requestDescription
AdminConfigurationApigetConfigGET /admin/configAdmin config
AdminConfigurationApiupsertConfigPUT /admin/configUpdate Site-wide Config
ArticlesApicreateArticlePOST /articlesCreate a new article
ArticlesApigetArticleByIdGET /articles/{id}A published article by ID
ArticlesApigetArticleByPathGET /articles/{username}/{slug}A published article by path
ArticlesApigetArticlesGET /articlesPublished articles
ArticlesApigetArticlesWithVideoGET /videosArticles with a video
ArticlesApigetUserAllArticlesGET /articles/me/allUser's all articles
ArticlesApigetUserArticlesGET /articles/meUser's articles
ArticlesApigetUserPublishedArticlesGET /articles/me/publishedUser's published articles
ArticlesApigetUserUnpublishedArticlesGET /articles/me/unpublishedUser's unpublished articles
ArticlesApiupdateArticlePUT /articles/{id}Update an article
CommentsApigetCommentByIdGET /comments/{id}Comment
CommentsApigetCommentsByArticleIdGET /commentsComments
FollowersApigetFollowersGET /followers/usersFollowers
FollowsApigetFollowedTagsGET /follows/tagsFollowed tags
ListingsApicreateListingPOST /listingsCreate a new listing
ListingsApigetListingByIdGET /listings/{id}A listing
ListingsApigetListingsGET /listingsPublished listings
ListingsApigetListingsByCategoryGET /listings/category/{category}Published listings by category
ListingsApiupdateListingPUT /listings/{id}Update a listing
OrganizationsApigetOrgArticlesGET /organizations/{username}/articlesOrganization's Articles
OrganizationsApigetOrgListingsGET /organizations/{username}/listingsOrganization's listings
OrganizationsApigetOrgUsersGET /organizations/{username}/usersOrganization's users
OrganizationsApigetOrganizationGET /organizations/{username}An organization
PodcastEpisodesApigetPodcastEpisodesGET /podcast_episodesPublished podcast episodes
ProfileImagesApigetProfileImageGET /profile_images/{username}User or organization profile picture
ReadinglistApigetReadinglistGET /readinglistUser's reading list
TagsApigetFollowedTagsGET /follows/tagsFollowed tags
TagsApigetTagsGET /tagsTags
UsersApigetUserGET /users/{id}A user
UsersApigetUserAllArticlesGET /articles/me/allUser's all articles
UsersApigetUserArticlesGET /articles/meUser's articles
UsersApigetUserMeGET /users/meThe authenticated user
UsersApigetUserPublishedArticlesGET /articles/me/publishedUser's published articles
UsersApigetUserUnpublishedArticlesGET /articles/me/unpublishedUser's unpublished articles
VideosApigetArticlesWithVideoGET /videosArticles with a video
WebhooksApicreateWebhookPOST /webhooksCreate a new webhook
WebhooksApideleteWebhookDELETE /webhooks/{id}A webhook endpoint
WebhooksApigetWebhookByIdGET /webhooks/{id}A webhook endpoint
WebhooksApigetWebhooksGET /webhooksWebhooks

Models

Authorization

api_key

  • Type: API key
  • API key parameter name: api-key
  • Location: HTTP header

oauth2

  • Type: OAuth
  • Flow: application
  • Authorization URL: ``
  • Scopes: N/A

oauth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://dev.to/oauth/authorize
  • Scopes: N/A

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

yo@dev.to

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 0.9.5
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

About

This is a PHP client for the Dev.To API.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages