public Schema GetSchema(string customerID, string schemaName) { using (PoolItem <DirectoryService> connection = this.directoryServicePool.Take(NullValueHandling.Ignore)) { SchemasResource.GetRequest schemaReq = connection.Item.Schemas.Get(customerID, schemaName); return(schemaReq.ExecuteWithRetryOnBackoff()); } }
public bool HasSchema(string customerID, string schemaName) { try { using (PoolItem <DirectoryService> connection = this.directoryServicePool.Take(NullValueHandling.Ignore)) { SchemasResource.GetRequest schemaReq = connection.Item.Schemas.Get(customerID, schemaName); Schema schema = schemaReq.ExecuteWithRetryOnBackoff(); if (schema != null) { return(true); } else { return(false); } } } catch (Google.GoogleApiException ex) { if (ex.HttpStatusCode == System.Net.HttpStatusCode.NotFound || ex.HttpStatusCode == System.Net.HttpStatusCode.Forbidden) { return(false); } else { throw; } } catch (TokenResponseException ex) { if (ex.StatusCode == System.Net.HttpStatusCode.Forbidden || ex.StatusCode == System.Net.HttpStatusCode.Unauthorized) { return(false); } else { throw; } } }