I am new to Google Classroom API integration and want to announce text in one of the courses through classroom API, I completed Java Quickstart here! it works well for getting all courses data, right now how I implement the announcement() method to create a post for student
public static void main(String... args) throws IOException, GeneralSecurityException {
// Build a new authorized API client service.
final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
Classroom service = new Classroom.Builder(HTTP_TRANSPORT, JSON_FACTORY,
getCredentials(HTTP_TRANSPORT)).setApplicationName(APPLICATION_NAME).build();
ListCoursesResponse response = service.courses().list().setPageSize(10).execute();
List<Course> courses = response.getCourses();
if (courses == null || courses.size() == 0) {
System.out.println("No courses found.");
} else {
System.out.println("Courses:");
for (Course course : courses) {
System.out.println(course.getName());
//-- How do I create a new announcement? I tried this getting error ------
Classroom.Courses.Announcements.Create a = new Classroom.Courses
.Announcements.Create().setCourseId("423178037220");
// -------------------------------
}
}
}
after all, I'm getting this error
com.google.api.services.classroom.Classroom.Courses.Announcements' is not an enclosing class