posts/posts-client

用户自定义帖子服务

dev-master 2024-07-11 17:33 UTC

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请求描述
PostsApicreatePostPOST /posts创建帖子
PostsApideletePostDELETE /posts/{id}删除帖子
PostsApigetPostGET /posts/{id}按id获取帖子
PostsApipatchPostPATCH /posts/{id}更新帖子
PostsApisearchPostPOST /posts:search-one搜索单个帖子
PostsApisearchPostsPOST /posts:search搜索帖子
UsersVotesApicreateUserVotePOST /users-votes创建用户投票
UsersVotesApideleteUserVoteDELETE /users-votes/{id}删除用户投票
UsersVotesApigetUserVoteGET /users-votes/{id}按id获取用户投票
UsersVotesApipatchUserVotePATCH /users-votes/{id}更新用户投票
UsersVotesApisearchUsersVotesPOST /users-votes:search搜索用户投票

模型文档

授权文档

所有端点均不需要授权。

作者

ignatev@greensight.ru