How to use the azure-common.OdataHandler function in azure-common

To help you get started, we’ve selected a few azure-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-node / lib / services / legacyStorage / lib / table / models / entityresult.js View on Github external
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var azureCommon = require('azure-common');
var Constants = azureCommon.Constants;
var HeaderConstants = Constants.HeaderConstants;
var OdataHandler = azureCommon.OdataHandler;

exports = module.exports;

exports.serialize = function (entity) {
  var odataHandler = new OdataHandler();
  return odataHandler.serialize(entity);
};

exports.parse = function (response) {
  var result = {};
  if (response.body) {
    var odataHandler = new OdataHandler();
    result = odataHandler.parse(response.body);
  }

  if (response.headers && response.headers[HeaderConstants.ETAG.toLowerCase()]) {
github Azure / azure-sdk-for-node / lib / services / sql / models / databaseresult.js View on Github external
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var azureCommon = require('azure-common');
var OdataHandler = azureCommon.OdataHandler;

exports = module.exports;

exports.serialize = function (databaseName, collation, edition, maxSizeInGB) {
  var databaseDescription = { };

  databaseDescription['CollationName'] = { '$': { 'type': 'Edm.String' }, '_': collation };
  databaseDescription['CreationDate'] = { '$': { 'type': 'Edm.DateTime' }, '_': '0001-01-01T00:00:00' };
  databaseDescription['Edition'] = { '$': { 'type': 'Edm.String' }, '_': edition };
  databaseDescription['Id'] = { '$': { 'type': 'Edm.Int32' }, '_': 0 };
  databaseDescription['IsFederationRoot'] = { '$': { 'type': 'Edm.Boolean' }, '_': null };
  databaseDescription['IsReadonly'] = { '$': { 'type': 'Edm.Boolean' }, '_': false };
  databaseDescription['IsRecursiveTriggersOn'] = { '$': { 'type': 'Edm.Boolean' }, '_': null };
  databaseDescription['IsSystemObject'] = { '$': { 'type': 'Edm.Boolean' }, '_': false };
  databaseDescription['MaxSizeGB'] = { '$': { 'type': 'Edm.Int32' }, '_': maxSizeInGB };
  databaseDescription['Name'] = { '$': { 'type': 'Edm.String' }, '_': databaseName };
github Azure / azure-sdk-for-node / lib / services / sqlManagement / lib / sqlservice.js View on Github external
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var util = require('util');
var url = require('url');
var _ = require('underscore');

var SqlServiceClient = require('./sqlserviceclient');

var azureCommon = require('azure-common');
var WebResource = azureCommon.WebResource;
var ServiceClientConstants = azureCommon.ServiceClientConstants;

var OdataHandler = azureCommon.OdataHandler;
var databaseResult = require('./models/databaseresult');

var Constants = azureCommon.Constants;
var HeaderConstants = Constants.HeaderConstants;
var SqlAzureConstants = Constants.SqlAzureConstants;

/**
* Validates a callback function.
* @ignore
*
* @param {string} callback The callback function.
* @return {undefined}
*/
function validateCallback(callback) {
  if (!callback) {
    throw new Error('Callback must be specified.');
github Azure / azure-sdk-for-node / lib / services / legacyStorage / lib / table / models / tableresult.js View on Github external
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var azureCommon = require('azure-common');
var OdataHandler = azureCommon.OdataHandler;

exports = module.exports;

exports.serialize = function (tableName) {
  var odataHandler = new OdataHandler();
  return odataHandler.serialize({ TableName: tableName }, true);
};

exports.parse = function (response) {
  var result = null;
  if (response.body) {
    var odataHandler = new OdataHandler();
    result = odataHandler.parse(response.body);
  }

  return result;