Пример #1
0
        public static Task <string> SerializeAsync <TObjectType>(TObjectType obj, CancellationToken cancellationToken = default)
        {
            if (EqualityComparer <TObjectType> .Default.Equals(obj, default))
            {
                throw new ArgumentNullException(nameof(obj), "object must not be null");
            }

            IObjectJsonWriter <TObjectType> objectJsonWriter = JsonFactoryContainer.CreateObjectWriter <TObjectType>();

            return(objectJsonWriter.WriteObjectAsync(obj, cancellationToken));
        }
Пример #2
0
        public static Task <string> SerializeAsync(ITraktAuthorization authorization, CancellationToken cancellationToken = default)
        {
            if (authorization == null)
            {
                throw new ArgumentNullException(nameof(authorization), "authorization must not be null");
            }

            IObjectJsonWriter <ITraktAuthorization> objectJsonWriter = JsonFactoryContainer.CreateObjectWriter <ITraktAuthorization>();
            AuthorizationObjectJsonWriter           authorizationObjectJsonWriter = (objectJsonWriter as AuthorizationObjectJsonWriter);

            authorizationObjectJsonWriter.CompleteSerialization = true;
            return(authorizationObjectJsonWriter.WriteObjectAsync(authorization, cancellationToken));
        }
        public Task <string> ToJson(CancellationToken cancellationToken = default)
        {
            IObjectJsonWriter <ITraktSyncRecommendationsPost> objectJsonWriter = JsonFactoryContainer.CreateObjectWriter <ITraktSyncRecommendationsPost>();

            return(objectJsonWriter.WriteObjectAsync(this, cancellationToken));
        }
Пример #4
0
        internal static Task <string> SerializeObject <TObjectType>(TObjectType obj)
        {
            IObjectJsonWriter <TObjectType> objectJsonWriter = JsonFactoryContainer.CreateObjectWriter <TObjectType>();

            return(objectJsonWriter.WriteObjectAsync(obj));
        }
        public override Task <string> ToJson(CancellationToken cancellationToken = default)
        {
            IObjectJsonWriter <ITraktMovieCheckinPost> objectJsonWriter = JsonFactoryContainer.CreateObjectWriter <ITraktMovieCheckinPost>();

            return(objectJsonWriter.WriteObjectAsync(this, cancellationToken));
        }
        public Task <string> ToJson(CancellationToken cancellationToken = default)
        {
            IObjectJsonWriter <ITraktShowResetWatchedProgressPost> objectJsonWriter = JsonFactoryContainer.CreateObjectWriter <ITraktShowResetWatchedProgressPost>();

            return(objectJsonWriter.WriteObjectAsync(this, cancellationToken));
        }
        public Task <string> ToJson(CancellationToken cancellationToken = default)
        {
            IObjectJsonWriter <ITraktUserCustomListsReorderPost> objectJsonWriter = JsonFactoryContainer.CreateObjectWriter <ITraktUserCustomListsReorderPost>();

            return(objectJsonWriter.WriteObjectAsync(this, cancellationToken));
        }