posts / posts-client
用户自定义帖子服务
dev-master
2024-07-11 17:33 UTC
Requires
- php: ^7.1 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2 || ^7.0
- guzzlehttp/psr7: ^1.6.1
- symfony/http-foundation: ^5.0 || ^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- phpunit/phpunit: ^7.4 || ^8.0 || ^9.0
This package is not auto-updated.
Last update: 2024-09-20 13:35:53 UTC
README
用户自定义帖子服务
此PHP包由OpenAPI Generator项目自动生成
- API版本:1.0.0
- 构建包:org.openapitools.codegen.languages.PhpClientCodegen。更多信息请访问https://ensi.tech/contacts
需求
PHP 5.5及更高版本
安装与使用
Composer
要通过Composer安装绑定,请将以下内容添加到composer.json
{
"repositories": [
{
"type": "vcs",
"url": "https://gitlab.com/greensight/ensi/backend-service-skeleton-client-php.git"
}
],
"require": {
"posts/posts-client": "*@dev"
}
}
然后运行composer install
手动安装
下载文件并包含autoload.php
require_once('/path/to/PostsClient/vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门指南
请按照安装过程操作,然后运行以下命令
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new Posts\PostsClient\Api\PostsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$create_post_request = new \Posts\PostsClient\Dto\CreatePostRequest(); // \Posts\PostsClient\Dto\CreatePostRequest |
try {
$result = $apiInstance->createPost($create_post_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PostsApi->createPost: ', $e->getMessage(), PHP_EOL;
}
?>
API端点文档
所有URI均相对于https:///api/v1
类 | 方法 | HTTP请求 | 描述 |
---|---|---|---|
PostsApi | createPost | POST /posts | 创建帖子 |
PostsApi | deletePost | DELETE /posts/{id} | 删除帖子 |
PostsApi | getPost | GET /posts/{id} | 按id获取帖子 |
PostsApi | patchPost | PATCH /posts/{id} | 更新帖子 |
PostsApi | searchPost | POST /posts:search-one | 搜索单个帖子 |
PostsApi | searchPosts | POST /posts:search | 搜索帖子 |
UsersVotesApi | createUserVote | POST /users-votes | 创建用户投票 |
UsersVotesApi | deleteUserVote | DELETE /users-votes/{id} | 删除用户投票 |
UsersVotesApi | getUserVote | GET /users-votes/{id} | 按id获取用户投票 |
UsersVotesApi | patchUserVote | PATCH /users-votes/{id} | 更新用户投票 |
UsersVotesApi | searchUsersVotes | POST /users-votes:search | 搜索用户投票 |
模型文档
- CreatePostRequest
- CreateUserVoteRequest
- DifficultyTypeEnum
- EmptyDataResponse
- Error
- ErrorResponse
- ErrorResponse2
- PaginationTypeCursorEnum
- PaginationTypeEnum
- PaginationTypeOffsetEnum
- PatchPostRequest
- PatchUserVoteRequest
- Post
- PostFillableProperties
- PostIncludes
- PostReadonlyProperties
- PostResponse
- RequestBodyCursorPagination
- RequestBodyOffsetPagination
- RequestBodyPagination
- ResponseBodyCursorPagination
- ResponseBodyOffsetPagination
- ResponseBodyPagination
- SearchOnePostRequest
- SearchPostsRequest
- SearchPostsResponse
- SearchPostsResponseMeta
- SearchUsersVotesRequest
- SearchUsersVotesResponse
- UserVote
- UserVoteFillableProperties
- UserVoteReadonlyProperties
- UserVoteResponse
授权文档
所有端点均不需要授权。
作者
ignatev@greensight.ru