সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি বিষয় সম্পদ সাদৃশ্য দ্বারা শ্রেণীবদ্ধ স্ট্রীম আইটেমগুলির একটি গ্রুপকে প্রতিনিধিত্ব করে, যেমন নির্ধারিত সপ্তাহ বা কোর্সের বিষয়।
প্রতিটি বিষয় সার্ভার দ্বারা নির্ধারিত একটি অনন্য ID দ্বারা চিহ্নিত করা হয়। এই আইডির সাথে সংশ্লিষ্ট হল বিষয়ের অন্তর্গত কোর্স আইডি, ক্লাসরুম UI-তে প্রদর্শিত বিষয়ের আসল নাম এবং শেষ আপডেটের তারিখ ও সময়।
একটি বিষয় তৈরি করুন
আপনি topics.create() পদ্ধতি ব্যবহার করে একটি কোর্সে একটি নতুন বিষয় তৈরি করতে পারেন, যেমনটি নিম্নলিখিত নমুনায় দেখানো হয়েছে:
List<Topic> topics = new ArrayList<>();
String pageToken = null;
try {
do {
ListTopicResponse response =
service
.courses()
.topics()
.list(courseId)
.setPageSize(100)
.setPageToken(pageToken)
.execute();
/* Ensure that the response is not null before retrieving data from it to avoid errors. */
if (response.getTopic() != null) {
topics.addAll(response.getTopic());
pageToken = response.getNextPageToken();
}
} while (pageToken != null);
if (topics.isEmpty()) {
System.out.println("No topics found.");
} else {
for (Topic topic : topics) {
System.out.printf("%s (%s)\n", topic.getName(), topic.getTopicId());
}
}
} catch (GoogleJsonResponseException e) {
// TODO (developer) - handle error appropriately
GoogleJsonError error = e.getDetails();
if (error.getCode() == 404) {
System.out.printf("The courseId does not exist: %s.\n", courseId);
} else {
throw e;
}
} catch (Exception e) {
throw e;
}
return topics;
পাইথন
topics = []
page_token = None
while True:
response = service.courses().topics().list(
pageToken=page_token,
pageSize=30,
courseId=<course ID or alias>).execute()
topics.extend(response.get('topic', []))
page_token = response.get('nextPageToken', None)
if not page_token:
break
if not topics:
print('No topics found.')
else:
print('Topics:')
for topic in topics:
print('{0} ({1})'.format(topic['name'], topic['topicId']))
বিষয়গুলি আপডেট করুন
আপনি topics.patch() পদ্ধতির মাধ্যমে একটি বিদ্যমান বিষয়ের নাম আপডেট করতে পারেন, যেমনটি নিম্নলিখিত নমুনায় দেখানো হয়েছে:
Topic topic = null;
try {
// Retrieve the topic to update.
Topic topicToUpdate = service.courses().topics().get(courseId, topicId).execute();
// Update the name field for the topic retrieved.
topicToUpdate.setName("Semester 2");
/* Call the patch endpoint and set the updateMask query parameter to the field that needs to
be updated. */
topic =
service
.courses()
.topics()
.patch(courseId, topicId, topicToUpdate)
.set("updateMask", "name")
.execute();
/* Prints the updated topic. */
System.out.printf("Topic '%s' updated.\n", topic.getName());
} catch (GoogleJsonResponseException e) {
// TODO(developer) - handle error appropriately
GoogleJsonError error = e.getDetails();
if (error.getCode() == 404) {
System.out.printf("The courseId or topicId does not exist: %s, %s.\n", courseId, topicId);
} else {
throw e;
}
} catch (Exception e) {
throw e;
}
return topic;
পাইথন
topic = {
"name": "New Topic Name"
}
response = service.courses().topics().patch(
courseId=<course ID or alias>,
id=<topic ID>,
updateMask="name",
body=topic).execute()
print('{0} ({1})'.format(response['name'], response['topicId']))
বিষয়গুলি মুছুন
আপনি topics.delete() পদ্ধতির মাধ্যমে একটি বিদ্যমান বিষয় মুছে ফেলতে পারেন, যেমনটি নিম্নলিখিত নমুনায় দেখানো হয়েছে:
[[["সহজে বোঝা যায়","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"]],["2024-11-23 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["A topic in Google Classroom groups similar stream items together, identified by a unique ID, and includes information like the course it belongs to, its name, and the last updated timestamp."],["You can manage topics by creating, retrieving details (individually or as a list), updating the name of existing topics, and deleting them, using dedicated methods for each action."],["When creating or updating topics, ensure the name field is a non-empty string; avoid trailing spaces in topic names due to a known issue; and note that the topic ID and update time cannot be changed manually."],["Code samples in Java and Python are provided to illustrate how to interact with the Classroom API for various topic management operations."]]],[]]