gitee-php/gitee-sdk

v5.6.0 2024-08-07 01:48 UTC

This package is auto-updated.

Last update: 2024-09-07 02:03:30 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Gitee SDK for PHP (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

Requirements

PHP 5.5 and later

Installation & Usage

Composer

composer require gitee-php/gitee-sdk

Manual Installation

Download the files and include autoload.php:

require_once '/path/to/vendor/autoload.php';

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once __DIR__ . '/vendor/autoload.php';

$apiInstance = new Gitee\Api\ActivityApi(
    // 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()
);
$owner = "owner_example"; // string | 仓库所属空间地址(企业、组织或个人的地址path)
$repo = "repo_example"; // string | 仓库路径(path)
$accessToken = "accessToken_example"; // string | 用户授权码

try {
    $apiInstance->deleteV5UserStarredOwnerRepo($owner, $repo, $accessToken);
} catch (Exception $e) {
    echo 'Exception when calling ActivityApi->deleteV5UserStarredOwnerRepo: ', $e->getMessage(), PHP_EOL;
}

?>

Warning

由于 Gitee 官方提供的 swagger.json 存在错误,所以本 SDK 中存在部分 API 的返回值 Model 未能正确返回内容,如果发现可以提交 Issue 或提交 Pull Request
同时为了减小影响,可以使用 SDK 提供的 ResponseHandler 来获取到原始响应。

<?php
require_once __DIR__ . '/vendor/autoload.php';

$response = new Gitee\ResponseHandler();
$client = $response->createClientWithMiddleware();

$apiInstance = new Gitee\Api\UsersApi($client);
$accessToken = "accessToken_example"; // string | 用户授权码

try {
    $result = $apiInstance->getV5User($accessToken);
    print_r($result);
    print_r($response->toArray());
} catch (Exception $e) {
    echo 'Exception when calling UsersApi->getV5User: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://gitee.com/api

Documentation For Models