Exemplo n.º 1
0
        /// <summary>
        /// Construct a <see cref="InstanceClient"/>
        /// </summary>
        /// <param name="apiClient">The value of <see cref="apiClient"/></param>
        /// <param name="instance">The value of <see cref="Metadata"/></param>
        public InstanceClient(IApiClient apiClient, Instance instance)
        {
            this.apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
            Metadata       = instance ?? throw new ArgumentNullException(nameof(instance));

            Byond         = new ByondClient(apiClient, instance);
            Repository    = new RepositoryClient(apiClient, instance);
            DreamDaemon   = new DreamDaemonClient(apiClient, instance);
            Configuration = new ConfigurationClient(apiClient, instance);
            Users         = new InstanceUserClient(apiClient, instance);
            ChatBots      = new ChatBotsClient(apiClient, instance);
            DreamMaker    = new DreamMakerClient(apiClient, instance);
            Jobs          = new JobsClient(apiClient, instance);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InstanceClient"/> class.
        /// </summary>
        /// <param name="apiClient">The <see cref="IApiClient"/> used to construct component clients.</param>
        /// <param name="instance">The value of <see cref="Metadata"/>.</param>
        public InstanceClient(IApiClient apiClient, Instance instance)
        {
            if (apiClient == null)
            {
                throw new ArgumentNullException(nameof(apiClient));
            }
            if (!instance.Id.HasValue)
            {
                throw new ArgumentException("Instance missing ID!", nameof(instance));
            }

            Metadata = instance ?? throw new ArgumentNullException(nameof(instance));

            Byond          = new ByondClient(apiClient, instance);
            Repository     = new RepositoryClient(apiClient, instance);
            DreamDaemon    = new DreamDaemonClient(apiClient, instance);
            Configuration  = new ConfigurationClient(apiClient, instance);
            PermissionSets = new InstancePermissionSetClient(apiClient, instance);
            ChatBots       = new ChatBotsClient(apiClient, instance);
            DreamMaker     = new DreamMakerClient(apiClient, instance);
            Jobs           = new JobsClient(apiClient, instance);
        }