Lingara Lingara दस्तावेज़ मार्गदर्शिकाएँ API लाइब्रेरी ऐप बनाएं वेब ऐप
भाषा: हिन्दी

संदर्भ और सहमति

यह पेज अंग्रेज़ी से अनुवादित है। अगर दोनों में अंतर हो, तो अंग्रेज़ी पेज सही है। अंग्रेज़ी पेज पढ़ें

आपका ऐप किसी शिक्षार्थी के बारे में केवल संदर्भ स्लाइस के ज़रिए जानता है। हर स्लाइस निश्चित फ़ील्ड वाला एक छोटा रिकॉर्ड है। आपका मेनिफ़ेस्ट उन स्लाइस की सूची देता है जो वह माँगता है, शिक्षार्थी आपका ऐप इंस्टॉल करते समय हर एक के लिए सहमति देता है, और Lingara कोई स्लाइस तभी तक भेजता है जब तक ये दोनों बातें बनी रहती हैं।

स्लाइस

स्लाइसफ़ील्डइसमें क्या होता है
languagessource_langवह भाषा जिसके माध्यम से शिक्षार्थी पढ़ता है, भाषा टैग के रूप में, जैसे en।
target_langवह भाषा जो वह सीख रहा है।
levelउस भाषा में उसका स्तर, 1 से 9 तक, जब उसने कोई स्तर सेट किया हो।
plan_summaryplan_idउसकी नवीनतम पाठ योजना की id, जो एक योजना को दूसरी से अलग पहचानती है। आपका ऐप इससे योजना प्राप्त नहीं कर सकता, क्योंकि आपके ऐप का टोकन आपका अपना खाता पढ़ता है, शिक्षार्थी का नहीं।
titleयोजना का जनरेट किया गया शीर्षक, अधिकतम 120 वर्ण, जब उसका कोई शीर्षक हो।
target_langवह भाषा जो योजना सिखाती है।
set_countयोजना में कितने सेट हैं, अधिकतम 200।
sets_completedउनमें से कितने सेट शिक्षार्थी ने पूरे कर लिए हैं।
review_duedueअभी कितने फ़्लैशकार्ड बाकी हैं, अधिकतम 100000।
learnedउसने कितने शब्द सीख लिए हैं, अधिकतम 100000।
tutor_topictopicउसकी नवीनतम ट्यूटर बातचीत किस बारे में है, 1 से 120 वर्णों तक। यह किसी योजना के शीर्षक या उस स्क्रीन से आता है जिस पर वह है, कभी भी उसके अपने शब्दों से नहीं।

कोई स्लाइस क्या नहीं ले जाता

कोई भी स्लाइस ईमेल पता, नाम, यूज़र id या शिक्षार्थी द्वारा टाइप की गई कोई भी चीज़ नहीं ले जाता। आपका ऐप अनुरोध के subject से जानता है कि शिक्षार्थी कौन है, जो एक स्थिर मान है और हर ऐप के लिए अलग होता है। आपके ऐप का टोकन आपका अपना खाता पढ़ता है, कभी भी शिक्षार्थी का नहीं, इसलिए आपका ऐप उसके बारे में जो कुछ जानता है वह सब स्लाइस ही हैं।

सहमति

  • शिक्षार्थी आपका ऐप इंस्टॉल करते समय हर स्लाइस के लिए सहमति देता है। जिस चीज़ के लिए उसने सहमति दी है उसे बदलने के लिए, वह आपका ऐप अनइंस्टॉल करता है और उसे फिर से इंस्टॉल करता है।
  • अगर आप कम स्लाइस माँगने के लिए अपना मेनिफ़ेस्ट संपादित करते हैं, तो जो स्लाइस आपने हटाए वे तुरंत बंद हो जाते हैं।
  • अगर आप अधिक स्लाइस माँगने के लिए इसे संपादित करते हैं, तो नए स्लाइस किसी भी शिक्षार्थी तक तब तक नहीं पहुँचते जब तक वह फिर से इंस्टॉल न करे।
  • Lingara हर अनुरोध पर सहमति की फिर से जाँच करता है, और ऐसा कोई भी स्लाइस हटा देता है जिसके लिए शिक्षार्थी ने सहमति नहीं दी या जिसे आपका मेनिफ़ेस्ट अब नहीं माँगता। जो स्लाइस अपने रिकॉर्ड में फ़िट नहीं होता, उसे भी हटा दिया जाता है, पूरे अनुरोध को कभी नहीं।

नीचे दिया गया सैंपल उसे दिए गए स्लाइस से अपनी पंक्ति बनाता है और कोई API कॉल नहीं करता।

कोड उदाहरण की भाषा

TypeScript

// The app's own client reads its owner's account, never the learner's. The
// slices are all a render knows about the learner.
function planLine(request: AppRenderRequest): string {
  let line = "";
  for (const slice of request.context) {
    // A slice is present only when the learner agreed to share it.
    if (slice.kind === "languages") line += `${slice.source_lang} → ${slice.target_lang}. `;
    if (slice.kind === "plan_summary") line += `${slice.sets_completed}/${slice.set_count} sets.`;
  }
  return line;
}

Rust

// The app's own client reads its owner's account, never the learner's. The
// slices are all a render knows about the learner.
/// The learner's target language and, when they shared their plan, its
/// `(sets_completed, set_count)`.
fn shared_plan(request: &AppRenderRequest) -> (String, Option<(u32, u32)>) {
    let (mut target_lang, mut progress) = (String::from("zh"), None);
    for slice in &request.context {
        match slice {
            ContextSlice::Languages(languages) => target_lang = languages.target_lang.clone(),
            ContextSlice::PlanSummary(summary) => progress = Some((summary.sets_completed, summary.set_count)),
            _ => {}
        }
    }
    (target_lang, progress)
}

Go

// The app's own client reads its owner's account, never the learner's.
// The slices are all a render knows about the learner.
//
// Each slice is present only when the learner agreed to share it.
card := lingaraapps.NewCard().Heading("Your plan", 1)
for _, slice := range req.Context {
	switch s := slice.(type) {
	case lingaraapps.ContextSliceLanguages:
		card.Text(fmt.Sprintf("Learning %s from %s", s.TargetLang, s.SourceLang))
	case lingaraapps.ContextSlicePlanSummary:
		card.Text(fmt.Sprintf("%d of %d sets done", s.SetsCompleted, s.SetCount))
	}
}

Java

import com.getlingara.apps.Card;
import com.getlingara.apps.Reply;
import com.getlingara.apps.model.AppRenderRequest;
import com.getlingara.apps.model.ContextSlice;
import com.getlingara.apps.model.ContextSliceLanguages;
import com.getlingara.apps.model.ContextSlicePlanSummary;

// The app's own client reads its owner's account, never the learner's. The slices are all a
// render knows about the learner.
static Reply render(AppRenderRequest request) {
  Card.Builder card = Card.card();
  // A slice is present only when the learner agreed to share it; the context is read-only.
  for (ContextSlice slice : request.getContext()) {
    if (slice instanceof ContextSliceLanguages languages) {
      card.heading("Learning " + languages.targetLang(), 1);
    } else if (slice instanceof ContextSlicePlanSummary summary) {
      card.text(summary.setsCompleted() + " of " + summary.setCount() + " sets done");
    }
  }
  return card.heading("Today", 2).build();
}

Kotlin

import com.getlingara.apps.kotlin.Reply
import com.getlingara.apps.kotlin.card
import com.getlingara.apps.kotlin.model.AppRenderRequest
import com.getlingara.apps.kotlin.model.ContextSliceLanguages
import com.getlingara.apps.kotlin.model.ContextSlicePlanSummary

// The app's own client reads its owner's account, never the learner's. The slices are all a
// render knows about the learner.
fun renderWithContext(request: AppRenderRequest): Reply {
    // A slice is present only when the learner agreed to share it; the context is read-only.
    val languages = request.context.filterIsInstance<ContextSliceLanguages>().firstOrNull()
    val summary = request.context.filterIsInstance<ContextSlicePlanSummary>().firstOrNull()
    return card {
        heading("Learning ${languages?.targetLang ?: "today"}", 1)
        if (summary != null) {
            text("${summary.setsCompleted} of ${summary.setCount} sets done")
        }
    }
}

Ruby

# The app's own client reads its owner's account, never the learner's. The
# slices are all a render knows about the learner.
#
# A slice is present only when the learner agreed to share it.
request.context.filter_map do |slice|
  case slice
  in Lingara::Apps::ContextSliceLanguages(source_lang:, target_lang:)
    "#{source_lang} → #{target_lang}."
  in Lingara::Apps::ContextSlicePlanSummary(sets_completed:, set_count:)
    "#{sets_completed}/#{set_count} sets."
  else nil
  end
end.join(" ")

PHP

use Lingara\Apps\Generated\ContextSliceLanguages;
use Lingara\Apps\Generated\ContextSlicePlanSummary;

function planLine(AppRenderRequest $request): string
{
    // The app's own client reads its owner's account, never the learner's. The
    // slices are all a render knows about the learner.
    $line = '';
    // A slice is present only when the learner agreed to share it.
    foreach ($request->getContext() as $slice) {
        if ($slice instanceof ContextSliceLanguages) {
            $line .= "{$slice->sourceLang} → {$slice->targetLang}. ";
        } elseif ($slice instanceof ContextSlicePlanSummary) {
            $line .= "{$slice->setsCompleted}/{$slice->setCount} sets.";
        }
    }
    return $line;
}

यह भी देखें