WowPress-Tailwind/theme/wowpress/Api/WoWAudit.php

49 lines
1.2 KiB
PHP

<?php
namespace WoWPress\Api;
use WoWPress\Models\Character;
use WoWPress\Models\Raid;
class WoWAudit extends Api{
protected $api_url = "https://www.wowaudit.com/v1/";
public function getRaids($include_past=false)
{
return $this->get('raids', ['include_past' => $include_past?"true":"false"],true,5);
}
public function getRaid($id,$force)
{
return $this->get("raids/$id", [], true, $force?-1:5);
}
public function getRoster(){
return $this->get("characters",[],true,5);
}
public function changeSignup($raid,$character,$status,$role,$comment="",$second_char=null){
if(empty($character->ID) || empty($raid->ID)) return false;
$body = [
'id' => $raid->id_wowaudit,
'signup_changes' => [
[
'character_id' => $character->id_wowaudit,
'status' => $status,
'role' => $role,
'class' => $second_char->ID?$second_char->class:$character->class,
'comment' => $comment,
]
],
];
$url = "raids/".$raid->id_wowaudit;
return $this->put($url,$body);
}
}