示例#1
0
        /// <summary>Creates a new <see cref="TraktAuthorization" /> instance with the given values.</summary>
        /// <param name="accessToken">The access token for the new <see cref="TraktAuthorization" /> instance.</param>
        /// <param name="refreshToken">The optional refresh token for the new <see cref="TraktAuthorization" /> instance.</param>
        /// <returns>A new <see cref="TraktAuthorization" /> instance with the given values.</returns>
        public static TraktAuthorization CreateWith(string accessToken, string refreshToken = null)
        {
            TraktAuthorization traktAuthorization = CreateWith(DateTime.UtcNow, accessToken, refreshToken);

            traktAuthorization.IgnoreExpiration = true;
            return(traktAuthorization);
        }
示例#2
0
        /// <summary>
        /// Creates a new <see cref="TraktAuthorization" /> instance with the given values.
        /// <see cref="ExpiresInSeconds" /> of the created <see cref="TraktAuthorization" /> instance will have the default
        /// value of 3600 * 24 * 90 seconds, equal to 90 days.
        /// </summary>
        /// <param name="createdAt">The datetime, when the given access token was created. Will be converted to UTC datetime.</param>
        /// <param name="accessToken">The access token for the new <see cref="TraktAuthorization" /> instance.</param>
        /// <param name="refreshToken">The optional refresh token for the new <see cref="TraktAuthorization" /> instance.</param>
        /// <returns>A new <see cref="TraktAuthorization" /> instance with the given values.</returns>
        public static TraktAuthorization CreateWith(DateTime createdAt, string accessToken, string refreshToken = null)
        {
            TraktAuthorization traktAuthorization = CreateWith(createdAt, DEFAULT_EXPIRES_IN_SECONDS, accessToken, refreshToken);

            traktAuthorization.IgnoreExpiration = true;
            return(traktAuthorization);
        }