Skip to content

Commit

Permalink
Add PHPqa
Browse files Browse the repository at this point in the history
  • Loading branch information
matthijsthoolen committed Jun 8, 2019
1 parent a2ce94d commit bca53b7
Show file tree
Hide file tree
Showing 6 changed files with 360 additions and 1 deletion.
1 change: 1 addition & 0 deletions Examples/authorize.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
12 changes: 12 additions & 0 deletions src/Annotations/ModelAnnotation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace MatthijsThoolen\Slacky\Annotations;

/**
* @Annotation
* @Target(
*/
final class ModelAnnotation
{
//TODO: continue: https://www.doctrine-project.org/projects/doctrine-annotations/en/1.6/custom.html
}
126 changes: 126 additions & 0 deletions src/Endpoint/Oauth/Access.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?php

namespace MatthijsThoolen\Slacky\Endpoint\Oauth;

use MatthijsThoolen\Slacky\Endpoint\Endpoint;

/**
* Class Access
*
* @documentation https://api.slack.com/methods/oauth.access
*/
class Access extends Endpoint
{
/** @var string */
protected $method = 'POST';

/** @var string */
protected $uri ='oauth.access';

/** @var string */
protected $clientId;

/** @var string */
protected $clientSecret;

/** @var string */
protected $code;

/** @var string */
protected $redirectUri;

/** @var bool */
protected $singleChannel = false;

/**
* @return string
*/
public function getClientId(): string
{
return $this->clientId;
}

/**
* @param string $clientId
* @return Access
*/
public function setClientId(string $clientId): Access
{
$this->clientId = $clientId;
return $this;
}

/**
* @return string
*/
public function getClientSecret(): string
{
return $this->clientSecret;
}

/**
* @param string $clientSecret
* @return Access
*/
public function setClientSecret(string $clientSecret): Access
{
$this->clientSecret = $clientSecret;
return $this;
}

/**
* @return string
*/
public function getCode(): string
{
return $this->code;
}

/**
* @param string $code
* @return Access
*/
public function setCode(string $code): Access
{
$this->code = $code;
return $this;
}

/**
* @return string
*/
public function getRedirectUri(): string
{
return $this->redirectUri;
}

/**
* @param string $redirectUri
* @return Access
*/
public function setRedirectUri(string $redirectUri): Access
{
$this->redirectUri = $redirectUri;
return $this;
}

/**
* @return bool
*/
public function isSingleChannel(): bool
{
return $this->singleChannel;
}

/**
* @param bool $singleChannel
* @return Access
*/
public function setSingleChannel(bool $singleChannel): Access
{
$this->singleChannel = $singleChannel;
return $this;
}


}
35 changes: 35 additions & 0 deletions src/Endpoint/Oauth/Authorize.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace MatthijsThoolen\Slacky\Endpoint\Oauth;

use MatthijsThoolen\Slacky\Endpoint\Endpoint;

class Authorize extends Endpoint
{
/** @var string */
protected $method = 'GET';

/** @var string */
protected $uri = 'oauth.authorize';

/** @var Authorize */
protected $authorize;

/**
* @return Authorize
*/
public function getAuthorize(): Authorize
{
return $this->authorize;
}

/**
* @param Authorize $authorize
* @return Authorize
*/
public function setAuthorize(Authorize $authorize): Authorize
{
$this->authorize = $authorize;
return $this;
}
}
185 changes: 185 additions & 0 deletions src/Model/Authorize.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
<?php

namespace MatthijsThoolen\Slacky\Model;

class Authorize extends Model
{
const ADMIN = 'admin';
const AUDITLOGS_READ = 'auditlogs:read';
const BOT = 'bot';
const CHANNELS_HISTORY = 'channels:history';
const CHANNELS_READ = 'channels:read';
const CHANNELS_WRITE = 'channels:write';
const CHAT_WRITE = 'chat:write';
const CHAT_WRITE_BOT = 'chat:write:bot';
const CHAT_WRITE_USER = 'chat:write:user';
const CLIENT = 'client';
const COMMANDS = 'commands';
const CONVERSATIONS_WRITE = 'conversations:write';
const DND_READ = 'dnd:read';
const DND_WRITE = 'dnd:write';
const DND_WRITE_USER = 'dnd:write:user';
const EMOJI_READ = 'emoji:read';
const FILES_READ = 'files:read';
const FILES_WRITE = 'files:write';
const FILES_WRITE_USER = 'files:write:user';
const GROUPS_HISTORY = 'groups:history';
const GROUPS_READ = 'groups:read';
const GROUPS_WRITE = 'groups:write';
const IDENTITY = 'identiTy';
const IDENTITY_AVATAR = 'identity:avatar';
const IDENTITY_AVATAR_READ_USER = 'identity.avatar:read:user';
const IDENTITY_BASIC = 'identity.basic';
const IDENTITY_EMAIL = 'identity.email';
const IDENTITY_EMAIL_READ_USER = 'identity.email:read:user';
const IDENTITY_TEAM = 'identity.team';
const IDENTITY_TEAM_READ_USER = 'identity.team:read:user';
const IDENTITY_READ_USER = 'identity:read:user';
const IM_HISTORY = 'im:history';
const IM_READ = 'im:read';
const IM_WRITE = 'im:write';
const INCOMING_WEBHOOK = 'incoming-webhook';
const LINKS_READ = 'links:read';
const LINKS_WRITE = 'links:write';
const MPIM_HISTORY = 'mpim:history';
const MPIM_READ = 'mpim:read';
const MPIM_WRITE = 'mpim:write';
const NONE = 'none';
const PINS_READ = 'pins:read';
const PINS_WRITE = 'pins:write';
const POST = 'post';
const REACTIONS_READ = 'reactions:read';
const REACTIONS_WRITE = 'reactions:write';
const READ = 'read';
const REMINDERS_READ = 'reminders:read';
const REMINDERS_READ_USER = 'reminders:read:user';
const REMINDERS_WRITE_USER = 'reminders:write:user';
const SEARCH_READ = 'search:read';
const STARS_READ = 'stars:read';
const STARS_WRITE = 'stars:write';
const TEAM_READ = 'team:read';
const TOKENS_BASIC = 'tokens.basic';
const USERGROUPS_READ = 'usergroups:read';
const USERGROUPS_WRITE = 'usergroups:write';
const USERS_PROFILE_READ = 'users.profile:read';
const USERS_PROFILE_WRITE = 'users.profile:write';
const USERS_PROFILE_WRITE_USER = 'users.profile:write:user';
const USERS_READ = 'users:read';
const USERS_READ_EMAIL = 'users:read.email';
const USERS_WRITE = 'users:write';

/** @var $string */
protected $clientId;

/** @var array */
protected $scope = [];

/** @var string */
protected $redirectUri;

/** @var string */
protected $state;

/** @var string */
protected $team;

/**
* @return mixed
*/
public function getClientId()
{
return $this->clientId;
}

/**
* @param mixed $clientId
* @return Authorize
*/
public function setClientId($clientId)
{
$this->clientId = $clientId;
return $this;
}

/**
* @return array
*/
public function getScope(): array
{
return $this->scope;
}

/**
* @param array $scope
* @return Authorize
*/
public function setScope(array $scope): Authorize
{
$this->scope = $scope;
return $this;
}

/**
* @param string $scope
* @return Authorize
*/
public function addScope($scope): Authorize
{
$this->scope[] = $scope;
return $this;
}

/**
* @return string
*/
public function getRedirectUri(): string
{
return $this->redirectUri;
}

/**
* @param string $redirectUri
* @return Authorize
*/
public function setRedirectUri(string $redirectUri): Authorize
{
$this->redirectUri = $redirectUri;
return $this;
}

/**
* @return string
*/
public function getState(): string
{
return $this->state;
}

/**
* @param string $state
* @return Authorize
*/
public function setState(string $state): Authorize
{
$this->state = $state;
return $this;
}

/**
* @return string
*/
public function getTeam(): string
{
return $this->team;
}

/**
* @param string $team
* @return Authorize
*/
public function setTeam(string $team): Authorize
{
$this->team = $team;
return $this;
}
}
2 changes: 1 addition & 1 deletion src/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use MatthijsThoolen\Slacky\Slacky;
use MatthijsThoolen\Slacky\SlackyFactory;

// TODO: add annotations functionality with https://github.com/doctrine/annotations
abstract class Model
{

/** @var bool */
private $isOk = false;

Expand Down

0 comments on commit bca53b7

Please sign in to comment.