DEV TOOLS

RINA geliştirici API’sini canlı dene

Her kart gerçek bir API isteği gönderir. Konsolda tam HTTP isteğini ve JSON yanıtını görürsün; aşağıda curl, JavaScript ve PHP örnekleri hazır.

Tarayıcıdasın. Giriş normal Club onay ekranıyla yapılır. Telefon köprüsü yalnız oyun içi telefonda çalışır.

Bu uygulama bir “backend-for-frontend”: token’lar ve client_secret yalnızca sunucuda durur, tarayıcıya maskeli görüntü gelir. Kendi uygulamanı da böyle kur.

Giriş yapılmadı

Token’lar, client_secret ve kullanıcı adı maskelenir; gerçek değerler tarayıcına hiç gelmez.

Rina ile Giriş Yap (OAuth 2.0)

GET/oauth/authorize

POST/oauth/token

Standart authorization code akışı. Dev Tools her girişte oturumuna bağlı, tek kullanımlık bir state üretir, normal yetkilendirme adresine yönlendirir ve dönen kodu SUNUCUDAN client_secret ile token’a çevirir.

  1. GET /devtools/login: state üret, oturuma bağla (10 dk, tek kullanım).
  2. 302 → /oauth/authorize?client_id&redirect_uri&scope=basic&state
  3. Kullanıcı onaylar → redirect_uri?code=…&state=… (redirect_uri birebir eşleşmeli).
  4. Sunucu state’i doğrular, POST /oauth/token ile kodu token’a çevirir.
  5. Token oturumda kalır; tarayıcı yalnız Dev Tools arka ucuyla konuşur.
Kullanılan yetkilendirme adresihttps://www.rina-roleplay.com/gateway/api/v2/oauth/authorize?client_id=rina_devtools&redirect_uri=https%3A%2F%2Fwww.rina-roleplay.com%2Fdevtools%2Fcallback&scope=basic&state=<random>

Oyun içi telefonda: OAuth Direct

Aynı yetkilendirme adresi iFruit Store uygulamasının içinde açılınca gateway bunu algılar ve Club ekranı yerine telefonun yerel onay kartını kullanır. Uygulamanda HİÇBİR değişiklik gerekmez: aynı authorize adresi, aynı code + state, aynı token takası. İlk girişte telefon onay ister (Club 2FA’n açıksa kodunu da); sonraki girişler sessizdir. Koşul: mağaza adresinin kökeni = redirect_uri kökeni.

Çıkış ve erişimi kaldırma

“Çıkış” yalnız Dev Tools oturumunu siler; token gateway’de süresi dolana kadar geçerli kalır. Erişimi tamamen kaldırmak için Club > Hesabım > Bağlı uygulamalar: kaldırınca telefon bir sonraki girişte yeniden onay ister.

Bağlı uygulamaları aç

Son token takası (sunucudan)

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl -X POST "https://www.rina-roleplay.com/gateway/api/v2/oauth/token" \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  --data-urlencode "grant_type=authorization_code" \
  --data-urlencode "code=AUTHORIZATION_CODE" \
  --data-urlencode "redirect_uri=https://example.com/callback"

Hesabım

GET/me

Bu kart için önce Rina ile giriş yap.

Token sahibinin Club hesabı: AccountID, kullanıcı adı, oluşturma tarihi ve scope.

Kullanıcı adı (giriş adı) Dev Tools’ta gizlenir. Senin uygulaman tam değeri alır: onu asla herkese açık gösterme.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl "https://www.rina-roleplay.com/gateway/api/v2/me" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Karakterler

POST/characters

Bu kart için önce Rina ile giriş yap.

Hesabın bu sunucudaki oyun hesabı ve karakterleri (telefon numarası, banka hesapları dahil).

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl -X POST "https://www.rina-roleplay.com/gateway/api/v2/characters" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --data-urlencode "serverId=1"

Aktif karakter

GET/me/active-character

Bu kart için önce Rina ile giriş yap.

Hesabın şu an oyunda olan karakteri. Oyunda değilse online:false ve diğer alanlar null.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl "https://www.rina-roleplay.com/gateway/api/v2/me/active-character" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Sunucular

GET/servers

Herkese açık sunucu listesi (token gerekmez). serverId değerini buradan al.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl "https://www.rina-roleplay.com/gateway/api/v2/servers?platform=gtav"

Telefon bildirimi (v2)

POST/notification/send-phone-notify

Bu kart için önce Rina ile giriş yap.

Kurulu uygulamanın simgesiyle telefona bildirim. Gönderen adı her zaman uygulamanın adıdır. image: isteğe bağlı https resim. open: bildirime dokununca uygulamanın içinde açılacak yol; burada /devtools/#notify-landed seçersen bu sayfa açılır ve derin bağlantının çalıştığını görürsün.

Teslim koşulları: karakter oyunda, uygulama bu karakterde kurulu, telefon açık ve uçak modu kapalı, uygulamanın bildirimleri kapatılmamış. Sınır: uygulama başına 10 sn’de 1, saatte 20.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl -X POST "https://www.rina-roleplay.com/gateway/api/v2/notification/send-phone-notify" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --data-urlencode "userId=active" \
  --data-urlencode "serverId=1" \
  --data-urlencode "title=Dev Tools" \
  --data-urlencode "message=Merhaba! Bu bildirim RINA Dev Tools’tan geldi." \
  --data-urlencode "open=/devtools/#notify-landed"

Uygulama rozeti

POST/phone/badge

Bu kart için önce Rina ile giriş yap.

Uygulamanın ana ekran simgesindeki sayı (0 = kaldır). Telefona en çok 2 sn’de bir gider, son değer kazanır.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl -X POST "https://www.rina-roleplay.com/gateway/api/v2/phone/badge" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --data-urlencode "userId=active" \
  --data-urlencode "serverId=1" \
  --data-urlencode "count=3"

Oyuncuya mesaj

POST/notification/send-to-player

Bu kart için önce Rina ile giriş yap.

Aktif karaktere oyun içi sohbet bildirimi; metnin başına [Uygulama adı] eklenir.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl -X POST "https://www.rina-roleplay.com/gateway/api/v2/notification/send-to-player" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --data-urlencode "userId=active" \
  --data-urlencode "serverId=1" \
  --data-urlencode "messageType=success" \
  --data-urlencode "messageText=Dev Tools: send-to-player çalışıyor."

Club hesabına mesaj

POST/notification/send-to-club

Bu kart için önce Rina ile giriş yap.

clubId = kendi AccountID’n (token ile yalnız kendi hesabına gönderebilirsin). Dev Tools AccountID’yi önce /me ile öğrenir.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl -X POST "https://www.rina-roleplay.com/gateway/api/v2/notification/send-to-club" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --data-urlencode "clubId=YOUR_ACCOUNT_ID" \
  --data-urlencode "serverId=1" \
  --data-urlencode "messageType=normal" \
  --data-urlencode "messageText=Dev Tools: send-to-club çalışıyor."

Ödeme ($1)

POST/banking/initiate-payment

GET/banking/transaction-status/{id}

Bu kart için önce Rina ile giriş yap.

Aktif karakterinin banka hesabından RINA’ya GERÇEK $1 ödeme isteği. Telefonunda ödeme ekranı açılır, onaylarsan para çekilir. İade yoktur.

Akış: GET /me/active-character → POST /banking/initiate-payment (Bearer) → oyuncu telefonda onaylar → GET /banking/transaction-status/{id} (client credentials, yalnız sunucudan).

Ön koşul: uygulama o sunucuda banka ortağı olmalı (bank_api_apps). Değilse yanıt 403 “Invalid client ID” olur.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl -X POST "https://www.rina-roleplay.com/gateway/api/v2/banking/initiate-payment" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --data-urlencode "amount=1" \
  --data-urlencode "description=RINA Dev Tools test ödemesi" \
  --data-urlencode "userId=ACTIVE_USER_ID" \
  --data-urlencode "serverId=1" \
  --data-urlencode "storeName=RINA Dev Tools"

curl "https://www.rina-roleplay.com/gateway/api/v2/banking/transaction-status/TRANSACTION_ID?serverId=1" \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET"

Token yenile

POST/oauth/token

Bu kart için önce Rina ile giriş yap.

grant_type=refresh_token. Refresh token tek kullanımlıktır ve döner: yeni access + refresh token gelir, eskisi geçersiz olur. Access token 24 saat, refresh token bitişten sonra 30 gün kullanılabilir.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Kod örnekleri
curl -X POST "https://www.rina-roleplay.com/gateway/api/v2/oauth/token" \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  --data-urlencode "grant_type=refresh_token" \
  --data-urlencode "refresh_token=YOUR_REFRESH_TOKEN"

Hata biçimleri

Gateway hataları JSON’dur: {"error": "…"} ya da {"error": "…", "error_code": "…"}. HTTP durum koduna ve error_code’a göre dallan.

Konsol

Henüz istek yok. “Çalıştır”a bas.

Telefon köprüsü (postMessage)

postMessagewindow.parent → https://cfx-nui-rina

iFruit Store web uygulaması telefonla window.parent.postMessage ile konuşur. İstek: {rinaPhone: tür, v: 1, id, …}. Sonuç: {rinaPhoneResult: tür, v: 1, id, ok, data | error}. Sonucu yalnız e.source === window.parent ve e.origin === "https://cfx-nui-rina" ise kabul et; sonucu asla HTML olarak basma.

Telefon isteği yalnız mağaza adresinin kökeninden (bu uygulama için https://www.rina-roleplay.com) kabul eder. Yanıt gelmeyen istekler (bilinmeyen tür, geçersiz id, telefon dışı) hiç dönmez: her isteğe zaman aşımı koy.

Hata kodları: cancelled, busy, unavailable, invalid, rate_limited, not_supported.

Telefon aranıyor (hello)…

Kod örnekleri
const NUI = "https://cfx-nui-rina";
const RP = (() => {
  let n = 0;
  const wait = new Map();
  addEventListener("message", (e) => {
    const d = e.data;
    if (e.source !== parent || e.origin !== NUI || !d || typeof d !== "object") return;
    const w = wait.get(d.id);
    if (typeof d.rinaPhoneResult !== "string" || !w) return;
    wait.delete(d.id);
    clearTimeout(w.t);
    w.res(d);
  });
  return (type, params, ms = 60000) => new Promise((res) => {
    if (parent === window) return res({ ok: false, error: "not_in_phone" });
    const id = "r" + (++n);
    const t = setTimeout(() => { wait.delete(id); res({ ok: false, error: "timeout" }); }, ms);
    wait.set(id, { res, t });
    parent.postMessage(Object.assign({ rinaPhone: type, v: 1, id }, params || {}), NUI);
  });
})();

const hi = await RP("hello", {}, 3000);
if (!hi.ok) showOnlyInPhone();
Köprü günlüğü

hello

Köprüyü ve desteklenen türleri algıla. Sonuç: {v, types, kind: phone|tablet}. 3 sn zaman aşımı.

Kod örnekleri
const r = await RP("hello", {}, 3000);
if (r.ok) console.log(r.data); else console.warn(r.error);

dial

Onay sonrası tuş takımını numarayla açar; aramanın sonucu bildirilmez. Sonuçtan ~150 ms sonra uygulamadan çıkılır.

Kod örnekleri
const r = await RP("dial", {"number":"5551234"}, 60000);
if (r.ok) console.log(r.data); else console.warn(r.error);

sms

Onay sonrası Mesajlar’da taslak açar. to boşsa oyuncu alıcıyı seçer; uygulama alıcıyı öğrenmez. Sonuçtan ~150 ms sonra uygulamadan çıkılır.

Kod örnekleri
const r = await RP("sms", {"to":"","text":"RINA Dev Tools’tan merhaba!"}, 60000);
if (r.ok) console.log(r.data); else console.warn(r.error);

photo_pick

Oyuncu galeriden / kameradan TEK fotoğraf seçer; sonuç herkese açık Imgur adresi {url, width?, height?}.

Kod örnekleri
const r = await RP("photo_pick", {"source":"any"}, 60000);
if (r.ok && /^https:\/\/i\.imgur\.com\//.test(r.data.url)) img.src = r.data.url;

contact_pick

Oyuncu tek bir kişi seçer; sonuç {name, number}.

Kod örnekleri
const r = await RP("contact_pick", {}, 60000);
if (r.ok) console.log(r.data); else console.warn(r.error);

location_share

Oyuncunun konumu: {street, zone, x, y}. Sayfada tam olarak gönderilecek bilgi gösterilir.

Kod örnekleri
const r = await RP("location_share", {}, 5000);
if (r.ok) console.log(r.data); else console.warn(r.error);

waypoint

Onay sonrası haritada GPS noktası işaretler.

Kod örnekleri
const r = await RP("waypoint", {"x":-268,"y":-957,"label":"Dev Tools"}, 60000);
if (r.ok) console.log(r.data); else console.warn(r.error);

share

Paylaşım sayfası; sonuç {target: sms | bleeter | copy}. En az biri: text, url.

Kod örnekleri
const r = await RP("share", {"text":"RINA Dev Tools ile API’yi dene","url":"https://www.rina-roleplay.com/devtools/"}, 60000);
if (r.ok) console.log(r.data); else console.warn(r.error);

copy

Onay sonrası metni sistem panosuna kopyalar.

Kod örnekleri
const r = await RP("copy", {"text":"RINA Dev Tools"}, 60000);
if (r.ok) console.log(r.data); else console.warn(r.error);

haptic

Arayüzsüz titreşim; saniyede bir, uygulama ön planda olmalı.

Kod örnekleri
const r = await RP("haptic", {"pattern":"tap"}, 5000);
if (r.ok) console.log(r.data); else console.warn(r.error);

context

Kişisel veri olmadan telefon bağlamı: {lang, theme, time, weather, kind}.

Kod örnekleri
const r = await RP("context", {}, 5000);
if (r.ok) console.log(r.data); else console.warn(r.error);

badge

Bu uygulamanın ana ekran rozeti (köprüden, token gerekmez); saniyede bir.

Kod örnekleri
const r = await RP("badge", {"count":5}, 5000);
if (r.ok) console.log(r.data); else console.warn(r.error);