public RestAPIResponse Create(string label, IdentityStatus?status = null, bool?master = null) { Contract.Requires <ArgumentNullException>(label != null); Contract.Requires <ArgumentException>(!String.IsNullOrEmpty(label)); return(_client.GetRequest().Request("account/identity", new { label = label, status = status, master = master }, Method.POST)); }
public RestAPIResponse Create(string identityId, string service, int?totalAllowance = null, int?analyzeQueries = null) { Contract.Requires <ArgumentNullException>(identityId != null); Contract.Requires <ArgumentException>((identityId != null) ? identityId.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((identityId != null) ? Constants.IDENTITY_ID_FORMAT.IsMatch(identityId) : true, Messages.INVALID_IDENTITY_ID); Contract.Requires <ArgumentNullException>(service != null); Contract.Requires <ArgumentException>((service != null) ? service.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((totalAllowance != null) ? totalAllowance > 0 : true); Contract.Requires <ArgumentException>((analyzeQueries != null) ? analyzeQueries > 0 : true); return(_client.GetRequest().Request("account/identity/" + identityId + "/limit", new { service = service, total_allowance = totalAllowance, analyze_queries = analyzeQueries }, Method.POST)); }
public RestAPIResponse Create(string identityId, string service, string token) { Contract.Requires <ArgumentNullException>(identityId != null); Contract.Requires <ArgumentException>((identityId != null) ? identityId.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((identityId != null) ? Constants.IDENTITY_ID_FORMAT.IsMatch(identityId) : true, Messages.INVALID_IDENTITY_ID); Contract.Requires <ArgumentNullException>(service != null); Contract.Requires <ArgumentException>((service != null) ? service.Trim().Length > 0 : true); Contract.Requires <ArgumentNullException>(token != null); Contract.Requires <ArgumentException>((token != null) ? token.Trim().Length > 0 : true); return(_client.GetRequest().Request("account/identity/" + identityId + "/token", new { service = service, token = token }, Method.POST)); }
public RestAPIResponse Get(string id = null, int?max = null, int?page = null, bool?withEstimate = null) { Contract.Requires <ArgumentException>((id != null) ? id.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((id != null) ? Constants.HISTORICS_ID_FORMAT.IsMatch(id) : true, Messages.INVALID_HISTORICS_ID); Contract.Requires <ArgumentException>((max.HasValue) ? max.Value > 0 : true); Contract.Requires <ArgumentException>((page.HasValue) ? page.Value > 0 : true); return(_client.GetRequest().Request("historics/get", new { id = id, max = max, page = page, with_estimate = withEstimate })); }
public RestAPIResponse Get(string service, string id = null, int?page = null, int?perPage = null) { Contract.Requires <ArgumentNullException>(service != null); Contract.Requires <ArgumentException>((service != null) ? service.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((id != null) ? id.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((id != null) ? Constants.RECORDING_ID_FORMAT.IsMatch(id) : true, Messages.INVALID_RECORDING_ID); Contract.Requires <ArgumentException>((page.HasValue) ? page.Value > 0 : true); Contract.Requires <ArgumentException>((perPage.HasValue) ? perPage.Value > 0 : true); return(_client.GetRequest().Request("pylon/" + HttpUtility.UrlEncode(service) + "/get", new { id = id })); }
public RestAPIResponse Get(string id = null, string hash = null, string historicsId = null, int?page = null, int?perPage = null, OrderBy?orderBy = null, OrderDirection?orderDirection = null, bool?includeFinished = null) { Contract.Requires <ArgumentException>((id != null) ? id.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((id != null) ? Constants.SUBSCRIPTION_ID_FORMAT.IsMatch(id) : true, Messages.INVALID_SUBSCRIPTION_ID); Contract.Requires <ArgumentException>((hash != null) ? hash.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((hash != null) ? Constants.STREAM_HASH_FORMAT.IsMatch(hash) : true, Messages.INVALID_STREAM_HASH); Contract.Requires <ArgumentException>((historicsId != null) ? historicsId.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((historicsId != null) ? Constants.HISTORICS_ID_FORMAT.IsMatch(historicsId) : true, Messages.INVALID_HISTORICS_ID); Contract.Requires <ArgumentException>((page.HasValue) ? page.Value > 0 : true); Contract.Requires <ArgumentException>((perPage.HasValue) ? perPage.Value > 0 : true); return(_client.GetRequest().Request("push/get", new { id = id, hash = hash, historics_id = historicsId, page = page, per_page = perPage, order_by = orderBy, order_dir = orderDirection, include_finished = includeFinished })); }
public RestAPIResponse Get(string service, string slug = null, int?page = null, int?perPage = null) { Contract.Requires <ArgumentNullException>(service != null); Contract.Requires <ArgumentException>((service != null) ? service.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((slug != null) ? slug.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((page.HasValue) ? page.Value > 0 : true); Contract.Requires <ArgumentException>((perPage.HasValue) ? perPage.Value > 0 : true); if (slug != null) { return(_client.GetRequest().Request("pylon/" + HttpUtility.UrlEncode(service) + "/reference/" + HttpUtility.UrlEncode(slug), null, Method.GET)); } else { return(_client.GetRequest().Request("pylon/" + HttpUtility.UrlEncode(service) + "/reference", new { page = page, per_page = perPage }, Method.GET)); } }
public RestAPIResponse Create(string hash, string[] sources, List <HistoricsPreviewParameter> parameters, DateTimeOffset start, DateTimeOffset?end = null) { Contract.Requires <ArgumentNullException>(hash != null); Contract.Requires <ArgumentException>(hash.Trim().Length > 0); Contract.Requires <ArgumentException>(Constants.STREAM_HASH_FORMAT.IsMatch(hash), Messages.INVALID_STREAM_HASH); Contract.Requires <ArgumentNullException>(sources != null); Contract.Requires <ArgumentException>(sources.Length > 0); Contract.Requires <ArgumentException>(start >= new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero), Messages.HISTORICS_START_TOO_EARLY); Contract.Requires <ArgumentException>(start <= DateTimeOffset.Now.AddHours(-2), Messages.HISTORICS_START_TOO_LATE); Contract.Requires <ArgumentException>((end.HasValue) ? end <= DateTimeOffset.Now.AddHours(-1) : true, Messages.HISTORICS_END_TOO_LATE); Contract.Requires <ArgumentException>((end.HasValue) ? end > start : true, Messages.HISTORICS_START_MUST_BE_BEFORE_END); Contract.Requires <ArgumentNullException>(parameters != null); Contract.Requires <ArgumentException>(parameters.Count > 0); Contract.Requires <ArgumentException>(parameters.Count <= 20); return(_client.GetRequest().Request("preview/create", new { hash = hash, sources = sources, parameters = parameters, start = start, end = end }, Method.POST)); }
public RestAPIResponse Usage(DateTimeOffset start, DateTimeOffset end, AccountUsagePeriod?period = null) { Contract.Requires <ArgumentException>(end > start, Messages.HISTORICS_START_MUST_BE_BEFORE_END); return(_client.GetRequest().Request("account/usage", new { period = period, start = start, end = end })); }
public RestAPIResponse Get(string service, string type, string taskId = null, int?page = null, int?perPage = null) { Contract.Requires <ArgumentNullException>(service != null); Contract.Requires <ArgumentException>((service != null) ? service.Trim().Length > 0 : true); Contract.Requires <ArgumentNullException>(type != null); Contract.Requires <ArgumentException>((type != null) ? type.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((taskId != null) ? taskId.Trim().Length > 0 : true); Contract.Requires <ArgumentException>((taskId != null) ? Constants.TASK_ID_FORMAT.IsMatch(taskId) : true, Messages.INVALID_TASK_ID); Contract.Requires <ArgumentException>((page.HasValue) ? page.Value > 0 : true); Contract.Requires <ArgumentException>((perPage.HasValue) ? perPage.Value > 0 : true); if (taskId != null) { return(_client.GetRequest().Request("pylon/" + HttpUtility.UrlEncode(service) + "/task/" + type + "/" + taskId, null, Method.GET)); } else { return(_client.GetRequest().Request("pylon/" + HttpUtility.UrlEncode(service) + "/task/" + type, new { page = page, per_page = perPage }, Method.GET)); } }
public RestAPIResponse Start(string id) { Contract.Requires <ArgumentNullException>(id != null); Contract.Requires <ArgumentException>(id.Trim().Length > 0); Contract.Requires <ArgumentException>((id != null) ? Constants.SOURCE_ID_FORMAT.IsMatch(id) : true, Messages.INVALID_SOURCE_ID); return(_client.GetRequest().Request("source/start", new { id = id }, Method.PUT)); }