コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuphonicService"/> class.
        /// </summary>
        /// <param name="client"></param>
        public AuphonicService(IRestClient client)
        {
            Precondition.IsNotNull(client, nameof(client));

            _client = client;

            SimpleJson.CurrentJsonSerializerStrategy = new SnakeJsonSerializerStrategy();
        }
コード例 #2
0
        public List <Service> GetServices(OAuthToken token)
        {
            Precondition.IsNotNull(token, nameof(token));

            IRestRequest request = new RestRequest("api/services.json");
            Response <List <Service> > response = ExecuteRequest <List <Service> >(request, token);

            return(response.Data);
        }
コード例 #3
0
        public Account GetAccountInfo(OAuthToken token)
        {
            Precondition.IsNotNull(token, nameof(token));

            IRestRequest       request  = new RestRequest("api/user.json");
            Response <Account> response = ExecuteRequest <Account>(request, token);

            return(response.Data);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Auphonic"/> class.
        /// </summary>
        /// <param name="clientId"></param>
        /// <param name="clientSecret"></param>
        /// <param name="service"></param>
        internal Auphonic(string clientId, string clientSecret, AuphonicService service)
        {
            Precondition.IsNotNullOrWhiteSpace(clientId, nameof(clientId));
            Precondition.IsNotNullOrWhiteSpace(clientSecret, nameof(clientSecret));
            Precondition.IsNotNull(service, nameof(service));

            ClientId     = clientId;
            ClientSecret = clientSecret;

            _service = service;
        }
コード例 #5
0
        public void DeletePreset(OAuthToken token, string uuid)
        {
            Precondition.IsNotNull(token, nameof(token));
            Precondition.IsNotNullOrWhiteSpace(uuid, nameof(uuid));

            IRestRequest request = new RestRequest("api/preset/{uuid}.json", Method.DELETE);

            request.AddUrlSegment("uuid", uuid);

            ExecuteRequest <object>(request, token);
        }
コード例 #6
0
        public List <string> GetPresetsUuids(OAuthToken token)
        {
            Precondition.IsNotNull(token, nameof(token));

            IRestRequest request = new RestRequest("api/presets.json");

            request.AddParameter("uuids_only", 1);

            Response <List <string> > response = ExecuteRequest <List <string> >(request, token);

            return(response.Data);
        }
コード例 #7
0
        public Production CreateProduction(OAuthToken token, Production production)
        {
            Precondition.IsNotNull(token, nameof(token));
            Precondition.IsNotNull(production, nameof(production));

            IRestRequest request = new RestRequest("api/production.json", Method.POST);

            request.AddBody(production);

            Response <Production> response = ExecuteRequest <Production>(request, token);

            return(response.Data);
        }
コード例 #8
0
        public Production StartProduction(OAuthToken token, string uuid)
        {
            Precondition.IsNotNull(token, nameof(token));
            Precondition.IsNotNullOrWhiteSpace(uuid, nameof(uuid));

            IRestRequest request = new RestRequest("api/production/{uuid}/start.json", Method.POST);

            request.AddUrlSegment("uuid", uuid);

            Response <Production> response = ExecuteRequest <Production>(request, token);

            return(response.Data);
        }
コード例 #9
0
        public List <string> GetServiceFiles(OAuthToken token, string uuid)
        {
            Precondition.IsNotNull(token, nameof(token));
            Precondition.IsNotNullOrWhiteSpace(uuid, nameof(uuid));

            IRestRequest request = new RestRequest("api/service/{uuid}/ls.json");

            request.AddUrlSegment("uuid", uuid);

            Response <List <string> > response = ExecuteRequest <List <string> >(request, token);

            return(response.Data);
        }
コード例 #10
0
        public Preset GetPreset(OAuthToken token, string uuid)
        {
            Precondition.IsNotNull(token, nameof(token));
            Precondition.IsNotNullOrWhiteSpace(uuid, nameof(uuid));

            IRestRequest request = new RestRequest("api/preset/{uuid}.json");

            request.AddUrlSegment("uuid", uuid);

            Response <Preset> response = ExecuteRequest <Preset>(request, token);

            return(response.Data);
        }
コード例 #11
0
        public Production UploadFile(OAuthToken token, string uuid, string path)
        {
            Precondition.IsNotNull(token, nameof(token));
            Precondition.IsNotNullOrWhiteSpace(uuid, nameof(uuid));

            IRestRequest request = new RestRequest("api/production/{uuid}/upload.json", Method.POST);

            request.AddUrlSegment("uuid", uuid);
            request.AddFile("input_file", path);

            Response <Production> response = ExecuteRequest <Production>(request, token);

            return(response.Data);
        }
コード例 #12
0
        public Production UpdateProduction(OAuthToken token, Production production)
        {
            Precondition.IsNotNull(token, nameof(token));
            Precondition.IsNotNull(production, nameof(production));
            Precondition.IsNotNullOrWhiteSpace(production.Uuid, nameof(production.Uuid));

            IRestRequest request = new RestRequest("api/production/{uuid}.json", Method.POST);

            request.AddUrlSegment("uuid", production.Uuid);
            request.AddBody(production);

            Response <Production> response = ExecuteRequest <Production>(request, token);

            return(response.Data);
        }
コード例 #13
0
        public List <Preset> GetPresets(OAuthToken token, int limit, int offset)
        {
            Precondition.IsNotNull(token, nameof(token));
            Precondition.IsGreaterOrEqual(limit, 0, nameof(limit));
            Precondition.IsGreaterOrEqual(offset, 0, nameof(offset));

            IRestRequest request = new RestRequest("api/presets.json");

            if (limit > 0)
            {
                request.AddParameter("limit", limit);
            }

            if (offset > 0)
            {
                request.AddParameter("offset", offset);
            }

            Response <List <Preset> > response = ExecuteRequest <List <Preset> >(request, token);

            return(response.Data);
        }