Integration
extends Part
in package
An Integration is a guild integrations for Twitch, Youtube, Bot and Apps.
Tags
Table of Contents
- $account : object
- $application : Application|null
- $created : bool
- Is the part already created in the Discord servers?
- $enable_emoticons : bool|null
- $enabled : bool|null
- $expire_behavior : int|null
- $expire_grace_period : int|null
- $guild : Guild|null
- $guild_id : string|null
- $id : string
- $name : string
- $revoked : bool|null
- $role : Role|null
- $role_id : string|null
- $scopes : array<string|int, mixed>|null
- $scriptData : mixed
- Custom script data.
- $subscriber_count : int|null
- $synced_at : Carbon|null
- $syncing : bool|null
- $type : string
- $user : User|null
- $attributes : array<string|int, mixed>
- The parts attributes.
- $discord : Discord
- The Discord client.
- $factory : Factory
- The factory.
- $fillable : array<string|int, mixed>
- The parts fillable attributes.
- $hidden : array<string|int, mixed>
- Attributes that are hidden from debug info.
- $http : Http
- The HTTP client.
- $repositories : array<string|int, mixed>
- An array of repositories that can exist in a part.
- $repositories_cache : array<string|int, mixed>
- An array of repositories.
- $visible : array<string|int, mixed>
- Attributes which are visible from debug info.
- __construct() : mixed
- Create a new part instance.
- __debugInfo() : array<string|int, mixed>
- Handles debug calls from var_dump and similar functions.
- __get() : mixed
- Handles dynamic get calls onto the part.
- __serialize() : array<string|int, mixed>
- __set() : void
- Handles dynamic set calls onto the part.
- __toString() : string
- Converts the part to a string.
- __unserialize() : void
- fetch() : ExtendedPromiseInterface<string|int, self>
- Fetches any missing information about the part from Discord's servers.
- fill() : void
- Fills the parts attributes from an array.
- getCreatableAttributes() : array<string|int, mixed>
- Returns the attributes needed to create.
- getPublicAttributes() : array<string|int, mixed>
- Returns an array of public attributes.
- getRawAttributes() : array<string|int, mixed>
- Returns an array of raw attributes.
- getRepositoryAttributes() : array<string|int, mixed>
- Gets the attributes to pass to repositories.
- getUpdatableAttributes() : array<string|int, mixed>
- Returns the updatable attributes.
- isPartial() : bool
- Whether the part is considered partial i.e. missing information which can be fetched from Discord.
- jsonSerialize() : array<string|int, mixed>
- Provides data when the part is encoded into JSON. Used for JsonSerializable.
- offsetExists() : bool
- Checks if an attribute exists via key. Used for ArrayAccess.
- offsetGet() : mixed
- Gets an attribute via key. Used for ArrayAccess.
- offsetSet() : void
- Sets an attribute via key. Used for ArrayAccess.
- offsetUnset() : void
- Unsets an attribute via key. Used for ArrayAccess.
- serialize() : string|null
- Serializes the data. Used for Serializable.
- unserialize() : void
- Unserializes some data and stores it. Used for Serializable.
- afterConstruct() : void
- Called after the part has been constructed.
- getApplicationAttribute() : Application|null
- Returns the application attribute.
- getGuildAttribute() : Guild|null
- Returns the guild attribute of the integration.
- getRoleAttribute() : Role|null
- Returns the "subscribers" role that this integration used only if guild is cached.
- getSyncedAtAttribute() : Carbon|null
- Returns the synced_at attribute.
- getUserAttribute() : User|null
- Gets the user that created the integration.
- checkForMutator() : string|false
- Checks if there is a mutator present.
- getAttribute() : mixed
- Gets an attribute on the part.
- setAttribute() : void
- Sets an attribute on the part.
- studly() : string
- Converts a string to studlyCase.
Properties
$account
public
object
$account
Integration account information.
$application
public
Application|null
$application
The bot/OAuth2 application for discord integrations.
$created
Is the part already created in the Discord servers?
public
bool
$created
= false
Whether the part has been created.
$enable_emoticons
public
bool|null
$enable_emoticons
Whether emoticons should be synced for this integration (twitch only currently).
$enabled
public
bool|null
$enabled
Is this integration enabled?
$expire_behavior
public
int|null
$expire_behavior
The behavior of expiring subscribers.
$expire_grace_period
public
int|null
$expire_grace_period
The grace period (in days) before expiring subscribers.
$guild read-only
public
Guild|null
$guild
$guild_id
public
string|null
$guild_id
$id
public
string
$id
Integration id.
$name
public
string
$name
Integration name.
$revoked
public
bool|null
$revoked
Has this integration been revoked.
$role read-only
public
Role|null
$role
Role that this integration uses for "subscribers".
$role_id
public
string|null
$role_id
Id that this integration uses for "subscribers".
$scopes
public
array<string|int, mixed>|null
$scopes
The scopes the application has been authorized for.
$scriptData
Custom script data.
public
mixed
$scriptData
Used for storing custom information, used by end products.
Tags
$subscriber_count
public
int|null
$subscriber_count
How many subscribers this integration has.
$synced_at
public
Carbon|null
$synced_at
When this integration was last synced.
$syncing
public
bool|null
$syncing
Is this integration syncing?
$type
public
string
$type
Integration type (twitch, youtube, discord, or guild_subscription).
$user
public
User|null
$user
User for this integration.
$attributes
The parts attributes.
protected
array<string|int, mixed>
$attributes
= []
The parts attributes and content.
$discord
The Discord client.
protected
Discord
$discord
Client.
$factory
The factory.
protected
Factory
$factory
Factory.
$fillable
The parts fillable attributes.
protected
array<string|int, mixed>
$fillable
= [
'id',
'name',
'type',
'enabled',
'syncing',
'role_id',
'enable_emoticons',
'expire_behavior',
'expire_grace_period',
'user',
'account',
'synced_at',
'subscriber_count',
'revoked',
'application',
'scopes',
// events
'guild_id',
]
The array of attributes that can be mass-assigned.
$hidden
Attributes that are hidden from debug info.
protected
array<string|int, mixed>
$hidden
= []
Attributes that are hidden from public.
$http
The HTTP client.
protected
Http
$http
Client.
$repositories
An array of repositories that can exist in a part.
protected
array<string|int, mixed>
$repositories
= []
Repositories.
$repositories_cache
An array of repositories.
protected
array<string|int, mixed>
$repositories_cache
= []
$visible
Attributes which are visible from debug info.
protected
array<string|int, mixed>
$visible
= []
Methods
__construct()
Create a new part instance.
public
__construct(Discord $discord[, array<string|int, mixed> $attributes = [] ][, bool $created = false ]) : mixed
Parameters
- $discord : Discord
-
The Discord client.
- $attributes : array<string|int, mixed> = []
-
An array of attributes to build the part.
- $created : bool = false
-
Whether the part has already been created.
Return values
mixed —__debugInfo()
Handles debug calls from var_dump and similar functions.
public
__debugInfo() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array of public attributes.
__get()
Handles dynamic get calls onto the part.
public
__get(string $key) : mixed
Parameters
- $key : string
-
The attributes key.
Tags
Return values
mixed —The value of the attribute.
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —__set()
Handles dynamic set calls onto the part.
public
__set(string $key, mixed $value) : void
Parameters
- $key : string
-
The attributes key.
- $value : mixed
-
The attributes value.
Tags
Return values
void —__toString()
Converts the part to a string.
public
__toString() : string
Tags
Return values
string —A JSON string of attributes.
__unserialize()
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
Return values
void —fetch()
Fetches any missing information about the part from Discord's servers.
public
fetch() : ExtendedPromiseInterface<string|int, self>
Tags
Return values
ExtendedPromiseInterface<string|int, self> —fill()
Fills the parts attributes from an array.
public
fill(array<string|int, mixed> $attributes) : void
Parameters
- $attributes : array<string|int, mixed>
-
An array of attributes to build the part.
Return values
void —getCreatableAttributes()
Returns the attributes needed to create.
public
getCreatableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —getPublicAttributes()
Returns an array of public attributes.
public
getPublicAttributes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array of public attributes.
getRawAttributes()
Returns an array of raw attributes.
public
getRawAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —Raw attributes.
getRepositoryAttributes()
Gets the attributes to pass to repositories.
public
getRepositoryAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —Attributes.
getUpdatableAttributes()
Returns the updatable attributes.
public
getUpdatableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —isPartial()
Whether the part is considered partial i.e. missing information which can be fetched from Discord.
public
isPartial() : bool
Return values
bool —jsonSerialize()
Provides data when the part is encoded into JSON. Used for JsonSerializable.
public
jsonSerialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array of public attributes.
offsetExists()
Checks if an attribute exists via key. Used for ArrayAccess.
public
offsetExists(string $key) : bool
Parameters
- $key : string
-
The attribute key.
Return values
bool —Whether the offset exists.
offsetGet()
Gets an attribute via key. Used for ArrayAccess.
public
offsetGet(string $key) : mixed
Parameters
- $key : string
-
The attribute key.
Tags
Return values
mixed —offsetSet()
Sets an attribute via key. Used for ArrayAccess.
public
offsetSet(string $key, mixed $value) : void
Parameters
- $key : string
-
The attribute key.
- $value : mixed
-
The attribute value.
Tags
Return values
void —offsetUnset()
Unsets an attribute via key. Used for ArrayAccess.
public
offsetUnset(string $key) : void
Parameters
- $key : string
-
The attribute key.
Return values
void —serialize()
Serializes the data. Used for Serializable.
public
serialize() : string|null
Return values
string|null —A string of serialized data.
unserialize()
Unserializes some data and stores it. Used for Serializable.
public
unserialize(string $data) : void
Parameters
- $data : string
-
Some serialized data.
Tags
Return values
void —afterConstruct()
Called after the part has been constructed.
protected
afterConstruct() : void
Return values
void —getApplicationAttribute()
Returns the application attribute.
protected
getApplicationAttribute() : Application|null
Tags
Return values
Application|null —getGuildAttribute()
Returns the guild attribute of the integration.
protected
getGuildAttribute() : Guild|null
Return values
Guild|null —getRoleAttribute()
Returns the "subscribers" role that this integration used only if guild is cached.
protected
getRoleAttribute() : Role|null
Return values
Role|null —getSyncedAtAttribute()
Returns the synced_at attribute.
protected
getSyncedAtAttribute() : Carbon|null
Tags
Return values
Carbon|null —The synced_at attribute.
getUserAttribute()
Gets the user that created the integration.
protected
getUserAttribute() : User|null
Return values
User|null —checkForMutator()
Checks if there is a mutator present.
private
checkForMutator(string $key, string $type) : string|false
Parameters
- $key : string
-
The attribute name to check.
- $type : string
-
Either get or set.
Return values
string|false —Either a string if it is callable or false.
getAttribute()
Gets an attribute on the part.
private
getAttribute(string $key) : mixed
Parameters
- $key : string
-
The key to the attribute.
Tags
Return values
mixed —Either the attribute if it exists or void.
setAttribute()
Sets an attribute on the part.
private
setAttribute(string $key, mixed $value) : void
Parameters
- $key : string
-
The key to the attribute.
- $value : mixed
-
The value of the attribute.
Return values
void —studly()
Converts a string to studlyCase.
private
static studly(string $string) : string
This is a port of updated Laravel's implementation, a non-regex with static cache. The Discord\studly() is kept due to unintended bug and we do not want to introduce BC by replacing it. This method is private static as we may move it outside this class in future.
Parameters
- $string : string
-
The string to convert.