// 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.

'use strict';

const {google} = require('googleapis');
const blogger = google.blogger('v3');
const nconf = require('nconf');
const path = require('path');

// Ex: node blogger.js --api_key "YOUR API KEY"
nconf
  .argv()
  .env()
  .file(path.join(__dirname, 'config.json'));

blogger.blogs.get(
  {
    key: nconf.get('api_key'),
    blogId: 3213900,
  },
  (err, res) => {
//
//    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.

'use strict';

const {google} = require('googleapis');
const sampleClient = require('../sampleclient');

const blogger = google.blogger({
  version: 'v3',
  auth: sampleClient.oAuth2Client
});

async function runSample () {
  const res = await blogger.posts.insert({
    blogId: '4340475495955554224',
    resource: {
      title: 'Hello from the googleapis npm module!',
      content: 'Visit https://github.com/google/google-api-nodejs-client to learn more!'
    }
  });
  console.log(res.data);
  return res.data;
}

if (module === require.main) {