gitee-php / gitee-sdk
gitee sdk for php
v5.6.0
2024-08-07 01:48 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
README
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
- AttachFile
- Blame
- Blob
- Branch
- CheckAnnotation
- CheckRun
- Code
- CodeComment
- CodeForks
- CodeForksHistory
- Commit
- CommitContent
- CommitParentsBasic
- Compare
- CompleteBranch
- Content
- ContentBasic
- Contributor
- DiffFile
- EnterpriseBasic
- EnterpriseMember
- Event
- GitUser
- GiteeMetrics
- Group
- GroupBasic
- GroupDetail
- GroupFollowers
- GroupMember
- Hook
- Issue
- IssueState
- IssueType
- Label
- Milestone
- ModelNamespace
- NamespaceMini
- Note
- OperateLog
- PostV5ReposOwnerRepoCommits
- PostV5ReposOwnerRepoCommitsActions
- PostV5ReposOwnerRepoCommitsAuthor
- ProgramBasic
- Project
- ProjectBasic
- ProjectLabel
- ProjectMember
- ProjectMemberPermission
- ProjectMini
- ProjectPushConfig
- ProjectStargazers
- ProjectTrafficData
- ProjectTrafficDataDesc
- ProjectTrafficDataSummary
- ProjectWatchers
- ProtectionRule
- PullRequest
- PullRequestComments
- PullRequestCommits
- PullRequestFiles
- RefPullRequest
- Release
- RepoCommit
- RepoCommitWithFiles
- SSHKey
- SSHKeyBasic
- Tag
- Tree
- User
- UserAssignee
- UserBasic
- UserDetail
- UserEmail
- UserInfo
- UserMessage
- UserMessageList
- UserMini
- UserNotification
- UserNotificationCount
- UserNotificationList
- UserNotificationNamespace
- UserNotificationSubject
- WeekReport