Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Sample generation in README #11

Merged
merged 7 commits into from
Oct 21, 2017
Merged

Conversation

amarzavery
Copy link
Contributor

  • This is different than generating samples from x-ms-examples
  • With this we will have autogenerated samples that show
    • how to instantiate client
    • a sample get method

@olydis
Copy link
Contributor

olydis commented Oct 21, 2017

🤖 AutoRest automatic publish job 🤖

success (version: 2.0.56)

@amarzavery
Copy link
Contributor Author

amarzavery commented Oct 21, 2017

This is how an autogenerated README.md would look like for an Azure Client.

Microsoft Azure SDK for isomorphic javascript - StorageManagementClient

This project provides an isomorphic javascript package for accessing Azure. Right now it supports:

  • node.js version 6.x.x or higher
  • browser javascript

How to Install

  • nodejs
npm install azure-arm-storage-js
  • browser
<script type="text/javascript" src="https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/lib/services//storageManagementClientBundle.js"></script>

How to use

nodejs - Authentication, client creation and list operations as an example written in TypeScript.

import * as msRest from "ms-rest-js";
import * as msRestAzure from "ms-rest-azure-js";
import * as msRestNodeAuth from "ms-rest-nodeauth";
import { StorageManagementClient, StorageManagementModels, StorageManagementMappers } from "azure-arm-storage-js";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
  const client = new StorageManagementClient(creds, undefined, subscriptionId);
  client.operations.list().then((result) => {
    console.log("The result is:");
    console.log(result);
  });
}).catch((err) => {
  console.log('An error ocurred:');
  console.dir(err, {depth: null, colors: true});
});

browser - Authentication, client creation and list operations as an example written in javascript.

  • index.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>My Todos</title>
    <script type="text/javascript" src="https://raw.githubusercontent.com/Azure/ms-rest-js/master/msRestBundle.js"></script>
    <script type="text/javascript" src="https://raw.githubusercontent.com/Azure/ms-rest-js/master/msRestAzureBundle.js"></script>
    <script type="text/javascript" src="https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/lib/services//storageManagementClientBundle.js"></script>
    <script type="text/javascript">
      document.write('hello world');
      const subscriptionId = "<Subscription_Id>";
      const token = "<access_token>";
      const creds = new msRest.TokenCredentials(token);
      const client = new StorageManagementClient(creds, undefined, subscriptionId);
      client.operations.list().then((result) => {
        console.log("The result is:");
        console.log(result);
      }).catch((err) => {
        console.log('An error ocurred:');
        console.dir(err, { depth: null, colors: true});
      });
    </script>
  </head>
  <body>
  </body>
</html>

Related projects

@amarzavery amarzavery merged commit b92e5ae into Azure:master Oct 21, 2017
joheredi pushed a commit that referenced this pull request Dec 12, 2019
Simplify AutoRest plugin registration and entrypoint
qiaozha added a commit that referenced this pull request Nov 4, 2023
* inital-commit-of-hierarchy-support

* add model namespace name

* reserve work

* revert change in openai modular as of openai generic

* generate operations

* add classical operation hierarchy layers and reserve work

* organize classic operation as hierarchy layered

* change typespec to have simpler names

* resolve operation conflicts with full namespace path

* add namespace prefix for model only when conflicts

* add edge case for model and operation name conflicts and resolve model conflicts if detect

* enableModelNamespace as true for anomaly detector

* fix hierarchy layer info bug

* do not rename in Modular but rename in RLC if hierarchy client and conflict exists

* fix model conflicts detect condition

* update edge case generation

* update package.json with hierarchy subpath

* manual change for export the operation interface

* reserve work

* generate options in a centralized place

* update generated code for edge case

* loadtesting-with-hierarchy-false (#9)

* loadtesting-with-hierarchy-false

* do not return namespace hierarchies

* use interface name when enable operation group in rlc

* fix package.json

* update generic generated files with just pure import order change (#10)

* loadtesting-with-hierarchy-false

* do not return namespace hierarchies

* use interface name when enable operation group in rlc

* fix package.json

* update generic generated files just import order chaneg

* disable-hierarchy-client-and-not-introduce-extra-changes (#11)

* disable-hierarchy-client-and-not-introduce-extra-changes

* fix model import issues

* reserve work

* reserve work

* fix hierarchy layer overload

* fix generation failure

* fall back to enableOperationGroup logic if hierarchyClient is false

* fix package.json and api layer export

* fix smoke-test

* fix lint error

* tryfix ci

* add operation group name back if hierarchy client is false

* use operation group name if hierarchy client is false

* rename operation if enableOperationGroup true and hierarchyClient false

* do not include operation group name duplicated

* only return interface name when enableOperationGroup true and hierarchyClient false

* disable hierarchyClient for chatApi

* Update packages/typespec-test/test/chatApi_modular/generated/typespec-ts/package.json

* Update packages/typespec-test/test/loadtesting_modular/tspconfig.yaml

* enableOperationGroup for service with operationGroup decorator

* to not get namespace hierarchy if hierarchyClient is false (#12)

* hierarchy-namespace-in-client-tsp

* fix client structure with operations

* update smoke-test

* undo enable operation group for clients
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants