public static RequestApiResult RemoveMaterial(DomainContext domainContext, string mediaId) { string accessToken = domainContext.AccessToken; RequestApiResult result = MaterialApi.RemoveMaterial(accessToken, mediaId); if (result.Success == false) { if (result.Retry) { if (result.ApiError.ErrorCode == 40001) { accessToken = AccessTokenGetter.Refresh(domainContext.AppId, accessToken); } result = MaterialApi.RemoveMaterial(accessToken, mediaId); if (result.Success == false) { _log.Write("MaterialApi.RemoveMaterial 失败", result.GetDetail(), TraceEventType.Warning); } } else { _log.Write("MaterialApi.RemoveMaterial 失败", result.GetDetail(), TraceEventType.Warning); } } return(result); }
public static RequestApiResult <WeixinAddMaterialResult> AddNormalMaterial(DomainContext domainContext, string file, MaterialType type) { string accessToken = domainContext.AccessToken; RequestApiResult <WeixinAddMaterialResult> result = MaterialApi.AddNormalMaterial(accessToken, file, type); if (result.Success == false) { if (result.Retry) { if (result.ApiError.ErrorCode == 40001) { accessToken = AccessTokenGetter.Refresh(domainContext.AppId, accessToken); } result = MaterialApi.AddNormalMaterial(accessToken, file, type); if (result.Success == false) { _log.Write("MaterialApi.AddNormalMaterial 失败", result.GetDetail(), TraceEventType.Warning); } } else { _log.Write("MaterialApi.AddNormalMaterial 失败", result.GetDetail(), TraceEventType.Warning); } } return(result); }
public static RequestApiResult <WeixinGetNormalMaterialListResult> GetNormalMaterialList(DomainContext domainContext, WeixinGetMaterialListArgs args) { string accessToken = domainContext.AccessToken; RequestApiResult <WeixinGetNormalMaterialListResult> result = MaterialApi.GetNormalMaterialList(accessToken, args); if (result.Success == false) { if (result.Retry) { if (result.ApiError.ErrorCode == 40001) { accessToken = AccessTokenGetter.Refresh(domainContext.AppId, accessToken); } result = MaterialApi.GetNormalMaterialList(accessToken, args); if (result.Success == false) { _log.Write("MaterialApi.GetNormalMaterialList 失败", result.GetDetail(), TraceEventType.Warning); } } else { _log.Write("MaterialApi.GetNormalMaterialList 失败", result.GetDetail(), TraceEventType.Warning); } } return(result); }
public void Init() { instance = new MaterialApi(); }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { AlbumApi = new AlbumApi(this); AnmmarApi = new AnmmarApi(this); AnnouncementApi = new AnnouncementApi(this); AssessmentsMessages = new AssessmentsMessages(this); AttendanceApi = new AttendanceApi(this); AuthorizationApi = new AuthorizationApi(this); BadgeApi = new BadgeApi(this); BehaviourApi = new BehaviourApi(this); CalendarApi = new CalendarApi(this); CertificateApi = new CertificateApi(this); ClassApi = new ClassApi(this); ConfigurationMangerApi = new ConfigurationMangerApi(this); CopyApi = new CopyApi(this); CourseApi = new CourseApi(this); CourseCatalogueApi = new CourseCatalogueApi(this); CourseGroupAuthors = new CourseGroupAuthors(this); CourseImageApi = new CourseImageApi(this); CourseRequestsApi = new CourseRequestsApi(this); CoursesProgress = new CoursesProgress(this); DiscussionApi = new DiscussionApi(this); EduShareApi = new EduShareApi(this); EvaluationApi = new EvaluationApi(this); EventApi = new EventApi(this); FileApi = new FileApi(this); FormsTemplatesApi = new FormsTemplatesApi(this); GradeApi = new GradeApi(this); GradeBookApi = new GradeBookApi(this); HelpApi = new HelpApi(this); IenApi = new IenApi(this); InvitationApi = new InvitationApi(this); InviteApi = new InviteApi(this); LanguageApi = new LanguageApi(this); LearningObjectivesApi = new LearningObjectivesApi(this); LearningPathApi = new LearningPathApi(this); LTILMSConsumerApi = new LTILMSConsumerApi(this); MaterialApi = new MaterialApi(this); MaterialSeenByUser = new MaterialSeenByUser(this); MembersApi = new MembersApi(this); MentorApi = new MentorApi(this); NotificationsApi = new NotificationsApi(this); OfferApi = new OfferApi(this); Office365 = new Office365(this); OfficeAddInApi = new OfficeAddInApi(this); Onenote = new Onenote(this); OrganizationUserAPI = new OrganizationUserAPI(this); OutcomesApi = new OutcomesApi(this); PointsApi = new PointsApi(this); PollApi = new PollApi(this); PrerequisitesApi = new PrerequisitesApi(this); QtiInteroperability = new QtiInteroperability(this); QuestionBankApi = new QuestionBankApi(this); ReflectionApi = new ReflectionApi(this); RelatedCoursesApi = new RelatedCoursesApi(this); ReportApi = new ReportApi(this); RoleManagementApi = new RoleManagementApi(this); ScheduleVisitApi = new ScheduleVisitApi(this); SchoolTypeApi = new SchoolTypeApi(this); SessionApi = new SessionApi(this); SpaceApi = new SpaceApi(this); StudentApi = new StudentApi(this); SubjectApi = new SubjectApi(this); SystemAdministrationApi = new SystemAdministrationApi(this); SystemReportsApi = new SystemReportsApi(this); TagsApi = new TagsApi(this); Themes = new Themes(this); TimeTableApi = new TimeTableApi(this); ToolConsumerProfileApi = new ToolConsumerProfileApi(this); TourApi = new TourApi(this); TrackApi = new TrackApi(this); TrainingPlanApi = new TrainingPlanApi(this); UserApi = new UserApi(this); UserProfileApi = new UserProfileApi(this); UserProgressApi = new UserProgressApi(this); UserSettingsApi = new UserSettingsApi(this); WallApi = new WallApi(this); BaseUri = new System.Uri("https://xwinji.azurewebsites.net"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }