संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Classroom में मौजूद Invitation संसाधन, किसी उपयोगकर्ता को किसी कोर्स में शामिल होने का न्योता देता है. इसमें, उपयोगकर्ता को कोर्स में किसी खास भूमिका के साथ शामिल होने का न्योता दिया जाता है. जैसे, छात्र, शिक्षक या मालिक.
हर Invitation संसाधन में ये फ़ील्ड होते हैं:
id: न्योते के लिए, Classroom से असाइन किया गया आइडेंटिफ़ायर.
userId: उस उपयोगकर्ता का आईडी जिसे कोर्स में शामिल होने का न्योता भेजा गया है.
courseId: वह कोर्स जिसका न्योता उपयोगकर्ता को भेजा जा रहा है.
invitations.create() तरीके का इस्तेमाल करके, किसी उपयोगकर्ता को किसी खास भूमिका के साथ कोर्स में शामिल होने का न्योता भेजा जा सकता है. अनुरोध के मुख्य हिस्से में Invitation रिसॉर्स शामिल करें और courseId, userId, और role की जानकारी दें.
Invitationinvitation=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.*/Invitationcontent=newInvitation().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(GoogleJsonResponseExceptione){// TODO (developer) - handle error appropriatelyGoogleJsonErrorerror=e.getDetails();if(error.getCode()==404){System.out.printf("The course or user does not exist.\n");}throwe;}catch(Exceptione){throwe;}returninvitation;
न्योता वापस पाना
invitations.get() तरीके को कॉल करके और न्योते का id बताकर, किसी खास न्योते को वापस पाएं.
Invitationinvitation=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(GoogleJsonResponseExceptione){GoogleJsonErrorerror=e.getDetails();if(error.getCode()==404){System.out.printf("The invitation id (%s) does not exist.\n",id);}throwe;}catch(Exceptione){throwe;}returninvitation;
न्योता स्वीकार करना
न्योता स्वीकार करने पर, न्योता मिट जाता है और न्योते में बताई गई भूमिका के साथ, न्योता पाने वाले उपयोगकर्ता को कोर्स में जोड़ दिया जाता है. invitations.accept() तरीके को कॉल करके और न्योते का id बताकर, न्योता स्वीकार करें.
try{service.invitations().accept(id).execute();System.out.printf("Invitation (%s) was accepted.\n",id);}catch(GoogleJsonResponseExceptione){GoogleJsonErrorerror=e.getDetails();if(error.getCode()==404){System.out.printf("The invitation id (%s) does not exist.\n",id);}throwe;}catch(Exceptione){throwe;}
न्योता मिटाना
न्योते को अपडेट करने का एक ही तरीका है. इसके लिए, न्योते को मिटाएं और नया न्योता बनाएं. न्योते को मिटाने के लिए, invitations.delete() वाले तरीके को कॉल करें और id की जानकारी दें.
try{service.invitations().delete(id).execute();System.out.printf("Invitation (%s) was deleted.\n",id);}catch(GoogleJsonResponseExceptione){GoogleJsonErrorerror=e.getDetails();if(error.getCode()==404){System.out.printf("The invitation id (%s) does not exist.\n",id);}throwe;}catch(Exceptione){throwe;}
[[["समझने में आसान है","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"]],["आखिरी बार 2025-01-14 (UTC) को अपडेट किया गया."],[[["An Invitation resource in Classroom allows users to join a course with a specific role, containing fields like `id`, `userId`, `courseId`, and `role`."],["You can create, retrieve, accept, and delete invitations using the Classroom API's `invitations` methods, specifying necessary parameters like `courseId`, `userId`, `role`, and `id`."],["Accepting an invitation adds the user to the course with the specified role and deletes the invitation, while deleting an invitation requires using the `invitations.delete()` method."],["Updating an invitation involves deleting the existing one and creating a new one with the desired changes."]]],[]]