उस उपयोगकर्ता का userId जिस पर न्योता भेजा गया है.
उस कोर्स का courseId जिसके लिए उपयोगकर्ता को न्योता दिया जा रहा है.
roleकोर्स की भूमिका जो न्योता पाने वाले उपयोगकर्ता को कोर्स में मिलेगी.
न्योता बनाएं
एक न्योता बनाएं, ताकि उपयोगकर्ता invitations.create() वाले तरीके को कॉल करके, तय की गई भूमिका वाले कोर्स में शामिल हो सके. अनुरोध के मुख्य हिस्से में, न्योते के संसाधन शामिल करें. साथ ही, courseId, userId, और role की जानकारी दें.
Java
classroom/snippets/src/main/java/Create शहर के न्योते.java
Invitation invitation = null;
try {
/* Set the role the user is invited to have in the course. Possible values of CourseRole can be
found here: https://developers.google.com/classroom/reference/rest/v1/invitations#courserole.*/
Invitation content =
new Invitation().setCourseId(courseId).setUserId(userId).setRole("TEACHER");
invitation = service.invitations().create(content).execute();
System.out.printf(
"User (%s) has been invited to course (%s).\n",
invitation.getUserId(), invitation.getCourseId());
} catch (GoogleJsonResponseException e) {
// TODO (developer) - handle error appropriately
GoogleJsonError error = e.getDetails();
if (error.getCode() == 404) {
System.out.printf("The course or user does not exist.\n");
}
throw e;
} catch (Exception e) {
throw e;
}
return invitation;
न्योता फिर से पाएं
invitations.get() तरीके को कॉल करके और न्योते का id बताकर, कोई खास न्योता वापस पाएं.
Java
Classroom/snippets/src/main/java/Get महिलाओं के लिए न्योते.java
Invitation invitation = null;
try {
invitation = service.invitations().get(id).execute();
System.out.printf(
"Invitation (%s) for user (%s) in course (%s) retrieved.\n",
invitation.getId(), invitation.getUserId(), invitation.getCourseId());
} catch (GoogleJsonResponseException e) {
GoogleJsonError error = e.getDetails();
if (error.getCode() == 404) {
System.out.printf("The invitation id (%s) does not exist.\n", id);
}
throw e;
} catch (Exception e) {
throw e;
}
return invitation;
न्योता स्वीकार करें
किसी कोर्स का न्योता स्वीकार करने से न्योता मिटा दिया जाता है और उपयोगकर्ता को न्योते में बताई गई भूमिका वाले कोर्स में जोड़ दिया जाता है. न्योता स्वीकार करने के लिए,
invitations.accept() तरीके को कॉल करें और न्योते का id बताएं.
Java
classroom/snippets/src/main/java/एलिमेंट स्वीकार करें.java
try {
service.invitations().accept(id).execute();
System.out.printf("Invitation (%s) was accepted.\n", id);
} catch (GoogleJsonResponseException e) {
GoogleJsonError error = e.getDetails();
if (error.getCode() == 404) {
System.out.printf("The invitation id (%s) does not exist.\n", id);
}
throw e;
} catch (Exception e) {
throw e;
}
कोई न्योता मिटाना
किसी न्योते को अपडेट करने का सिर्फ़ एक ही तरीका है. इसे मिटाकर एक नया न्योता बनाएं. न्योता मिटाने के लिए, invitations.delete() वाले तरीके को कॉल करें और id बताएं.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"वह जानकारी मौजूद नहीं है जो मुझे चाहिए"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"बहुत मुश्किल है / बहुत सारे चरण हैं"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"पुराना"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"अनुवाद से जुड़ी समस्या"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"सैंपल / कोड से जुड़ी समस्या"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"अन्य"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"समझने में आसान है"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"मेरी समस्या हल हो गई"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"अन्य"
}]
{"lastModified": "\u0906\u0916\u093f\u0930\u0940 \u092c\u093e\u0930 2023-09-14 (UTC) \u0915\u094b \u0905\u092a\u0921\u0947\u091f \u0915\u093f\u092f\u093e \u0917\u092f\u093e."}
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2023-09-14 (UTC) को अपडेट किया गया."]]