Ejemplo n.º 1
0
 /**
  * @param SehirListeAyar $ayar
  * @return SehirPagedResponse
  *
  * @throws UnauthorizedException
  */
 public function liste(SehirListeAyar $ayar = null)
 {
     // response alalım
     $response = $this->api->get('/sehir/liste-yeni', is_null($ayar) ? [] : $ayar->toArray());
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return new SehirPagedResponse($response->body);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
Ejemplo n.º 2
0
 /**
  * @return SiteAyar
  *
  * @throws NotFoundException
  * @throws UnauthorizedException
  */
 public function getAyar()
 {
     // response alalım
     $response = $this->api->get('/site-ayar');
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return new SiteAyar($response->body);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 404:
             throw new NotFoundException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
Ejemplo n.º 3
0
 /**
  * @param int $ilceId
  * @return Semt[]
  *
  * @throws UnauthorizedException
  * @throws NotFoundException
  * @throws UnknownException
  */
 public function getListeByIlceId($ilceId)
 {
     // response alalım
     $response = $this->api->get('/semt/liste-by-ilce-id/' . $ilceId);
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return array_map(function ($item) {
                 return new Semt($item);
             }, $response->body);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 404:
             throw new NotFoundException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
Ejemplo n.º 4
0
 /**
  * @param int $id
  * @param array $data
  * @return Resim
  *
  * @throws BadRequestException
  * @throws UnauthorizedException
  * @throws NotFoundException
  * @throws UnknownException
  */
 public function guncelle($id, $data)
 {
     // response alalım
     $response = $this->api->post('/resim/guncelle/' . $id, $data);
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return new Resim($response->body);
         case 400:
             throw new BadRequestException($response);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 404:
             throw new NotFoundException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
Ejemplo n.º 5
0
 /**
  * @param string $menuKodu
  * @return MenuEleman[]
  *
  * @throws NotFoundException
  * @throws UnauthorizedException
  */
 public function getElemanListeByMenuKodu($menuKodu)
 {
     // response alalım
     $response = $this->api->get('/menu/eleman/liste-by-menu-kodu/' . $menuKodu);
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return array_map(function ($item) {
                 return new MenuEleman($item);
             }, $response->body);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 404:
             throw new NotFoundException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
 /**
  * @param IletisimMesaj $iletisimMesaj
  * @return string
  *
  * @throws NotFoundException
  * @throws UnauthorizedException
  * @throws BadRequestException
  */
 public function ekle(IletisimMesaj $iletisimMesaj)
 {
     // response alalım
     $response = $this->api->post('/iletisim-mesaj/yeni', ['adi' => $iletisimMesaj->adi, 'mail' => $iletisimMesaj->mail, 'telefon' => $iletisimMesaj->telefon, 'konu' => $iletisimMesaj->konu, 'mesaj' => $iletisimMesaj->mesaj]);
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return $response->body->mesaj;
         case 400:
             throw new BadRequestException($response);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 404:
             throw new NotFoundException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
 /**
  * @param int $kullaniciId
  * @param array $data
  * @return KullaniciAdres
  *
  * @throws BadRequestException
  * @throws UnauthorizedException
  * @throws UnknownException
  */
 public function ekleAdres($kullaniciId, $data)
 {
     // response alalım
     $response = $this->api->post('/kullanici/' . $kullaniciId . '/adres/ekle', $data);
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return new KullaniciAdres($response->body);
         case 400:
             throw new BadRequestException($response);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
Ejemplo n.º 8
0
 /**
  * @return SiparisKargoYontem[]
  *
  * @throws UnauthorizedException
  * @throws UnknownException
  */
 public function listeKargoYontem()
 {
     // response alalım
     $response = $this->api->get('/siparis/kargo-yontem/liste');
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return array_map(function ($item) {
                 return new SiparisKargoYontem($item);
             }, $response->body);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
Ejemplo n.º 9
0
 /**
  * @param int $id
  * @return GaleriIcerik
  *
  * @throws BadRequestException
  * @throws UnauthorizedException
  * @throws NotFoundException
  * @throws UnknownException
  */
 public function silIcerik($id)
 {
     // response alalım
     $response = $this->api->get('/galeri/icerik/sil/' . $id);
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return new GaleriIcerik($response->body);
         case 400:
             throw new BadRequestException($response);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 404:
             throw new NotFoundException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
Ejemplo n.º 10
0
 /**
  * @param int $id
  * @param int $resimId
  * @return EmlakIlan
  *
  * @throws BadRequestException
  * @throws UnauthorizedException
  * @throws NotFoundException
  * @throws UnknownException
  */
 public function silIlanResim($id, $resimId)
 {
     // response alalım
     $response = $this->api->get('/emlak/ilan/resim/sil/' . $id . '/' . $resimId);
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return new EmlakIlan($response->body);
         case 400:
             throw new BadRequestException($response);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 404:
             throw new NotFoundException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }
Ejemplo n.º 11
0
 /**
  * @param int $referenceId
  * @param int $imageId
  * @return Reference
  *
  * @throws BadRequestException
  * @throws UnauthorizedException
  * @throws NotFoundException
  * @throws UnknownException
  */
 public function deleteImage($referenceId, $imageId)
 {
     // response alalım
     $response = $this->api->get('/reference/image/delete/' . $referenceId . '/' . $imageId);
     // durum koduna göre işlem yapalım
     switch ($response->code) {
         case 200:
             return new Reference($response->body);
         case 400:
             throw new BadRequestException($response);
         case 401:
             throw new UnauthorizedException($response->body->mesaj);
         case 404:
             throw new NotFoundException($response->body->mesaj);
         case 500:
             throw new InternalApiErrorException($response);
     }
     throw new UnknownException($response);
 }