定制 digitalscout/api-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

digitalscout/api-client

最新稳定版本:1.0.0

Composer 安装命令:

composer require digitalscout/api-client

包简介

A partner API client for Digital Scout

README 文档

README

This is a sample PHP library for partners to interact with the Digital Scout API for managing games, scores, and ID mappings.

Feel free to provide pull requests, as this was written by someone with little PHP experience.

Installation

The recommended way to install this library is through Composer.

# Install Composer (Linux/OSX)
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of this library:

composer.phar require digitalscout/api-client

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Usage

An API key is required to access this API. Please contact Digital Scout if you require one.

$client = new DigitalScout\Api("api.hsgamecenter.com", $apiKey);

//create a game
$newGame = new DigitalScout\Models\Game([
		"Sport" => "Football",
		"StartTime" => new DateTime("2015-09-01T23:00:00.000Z")
		"Participants" => [
			['SchoolId' => $school1Id, 'Level' => 'Varsity', 'Gender' => 'Male'],
			['SchoolId' => $school2Id, 'Level' => 'Varsity', 'Gender' => 'Male']
		], 
		"HomeSchoolId" => $school1Id
	]);
	
$createdGame = $client->games->createGame($newGame);

//load a game
$loadedGame = $client->games->getGame($createdGame->Id);

//change the time for a game
$loadedGame->StartTime = new DateTime("2015-10-01T23:00:00.000Z");
$updatedGame = $client->games->updateGame($loadedGame);

//add scores to a game
$scoreUpdate = new DigitalScout\Models\GameScores([
		"Scores" => [
			["SchoolId" => $school1Id, "Period" => 1, "Score" => 0 ],
			["SchoolId" => $school1Id, "Period" => 2, "Score" => 7 ],
			["SchoolId" => $school1Id, "Period" => 3, "Score" => 0 ],
			["SchoolId" => $school1Id, "Period" => 4, "Score" => 7 ],
			["SchoolId" => $school2Id, "Period" => 1, "Score" => 7 ],
			["SchoolId" => $school2Id, "Period" => 2, "Score" => 0 ],
			["SchoolId" => $school2Id, "Period" => 3, "Score" => 7 ],
			["SchoolId" => $school2Id, "Period" => 4, "Score" => 0 ]			
		]
	]);

$client->games->updateGameScore($updatedGame->Id, $scoreUpdate);

Error Handling

Most common errors are handled and have custom error types. The following types of custom exceptions can be thrown:

  • DigitalScout\Models\Errors\UnprocessableEntityException
  • DigitalScout\Models\Errors\UnauthorizedException
  • DigitalScout\Models\Errors\ForbiddenException
  • DigitalScout\Models\Errors\NotFoundException
  • DigitalScout\Models\Errors\ApiClientException (catchall exception type)

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-04-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固