public static void Build(CommandLineApplication download) { download.Description = "Download the schema as GraphQL SDL"; CommandArgument uriArg = download.Argument( "uri", "The URL to the GraphQL endpoint.", c => c.IsRequired()); CommandOption fileNameArg = download.Option( "-f|--FileName", "The file name to store the schema SDL.", CommandOptionType.SingleValue); CommandOption jsonArg = download.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); AuthArguments authArguments = download.AddAuthArguments(); download.OnExecuteAsync(cancellationToken => { var arguments = new DownloadCommandArguments( uriArg, fileNameArg, authArguments); DownloadCommandHandler handler = CommandTools.CreateHandler <DownloadCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); }
public PublishClientCommandArguments( CommandArgument registry, CommandArgument externalId, CommandArgument environmentName, CommandArgument schemaName, CommandArgument clientName, CommandOption searchDirectory, CommandOption queryFileName, CommandOption relayFileFormat, CommandOption tag, CommandOption published, AuthArguments authArguments) { Registry = registry; ExternalId = externalId; EnvironmentName = environmentName; SchemaName = schemaName; ClientName = clientName; SearchDirectory = searchDirectory; QueryFileName = queryFileName; RelayFileFormat = relayFileFormat; Tag = tag; Published = published; AuthArguments = authArguments; }
public static void Build(CommandLineApplication update) { update.Description = "Update local schema"; CommandOption pathArg = update.Option( "-p|--Path", "The directory where the client shall be located.", CommandOptionType.SingleValue); CommandOption urlArg = update.Option( "-u|--uri", "The URL to the GraphQL endpoint.", CommandOptionType.SingleValue); CommandOption jsonArg = update.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); AuthArguments authArguments = update.AddAuthArguments(); update.OnExecuteAsync(cancellationToken => { var arguments = new UpdateCommandArguments(urlArg, pathArg, authArguments); UpdateCommandHandler handler = CommandTools.CreateHandler <UpdateCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); }
public static CommandLineApplication Create() { var init = new CommandLineApplication(); init.AddName("update"); init.AddHelp <UpdateHelpTextGenerator>(); CommandOption pathArg = init.Option( "-p|--Path", "The directory where the client shall be located.", CommandOptionType.SingleValue); CommandOption urlArg = init.Option( "-u|--uri", "The URL to the GraphQL endpoint.", CommandOptionType.SingleValue); CommandOption jsonArg = init.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); AuthArguments authArguments = init.AddAuthArguments(); init.OnExecuteAsync(cancellationToken => { var arguments = new UpdateCommandArguments(urlArg, pathArg, authArguments); var handler = CommandTools.CreateHandler <UpdateCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); return(init); }
public DownloadCommandArguments( CommandArgument uri, CommandOption fileName, AuthArguments authArguments) { Uri = uri; FileName = fileName; AuthArguments = authArguments; }
public UpdateCommandArguments( CommandOption uri, CommandOption path, AuthArguments authArguments) { Uri = uri; Path = path; AuthArguments = authArguments; }
public InitCommandArguments( CommandArgument uri, CommandOption path, CommandOption name, AuthArguments authArguments) { Uri = uri; Path = path; Name = name; AuthArguments = authArguments; }
public static CommandLineApplication Create() { var publish = new CommandLineApplication(); publish.AddName("schema"); //publish.AddHelp<InitHelpTextGenerator>(); CommandArgument registryArg = publish.Argument( "registry", "The URL to the GraphQL schema registry.", c => c.IsRequired()); CommandArgument environmentNameArg = publish.Argument( "environmentName", "The name of the environment.", c => c.IsRequired()); CommandArgument schemaNameArg = publish.Argument( "schemaName", "The name of the schema.", c => c.IsRequired()); CommandArgument schemaFileNameArg = publish.Argument( "schemaFileName", "The schema file name.", c => c.IsRequired()); CommandOption tagArg = publish.Option( "-t|--tag", "A custom tag that can be passed to the schema registry.", CommandOptionType.MultipleValue); CommandOption jsonArg = publish.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); AuthArguments authArguments = publish.AddAuthArguments(); publish.OnExecuteAsync(cancellationToken => { var arguments = new PublishSchemaCommandArguments( registryArg, schemaNameArg, environmentNameArg, schemaFileNameArg, tagArg, authArguments); var handler = CommandTools.CreateHandler <PublishSchemaCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); return(publish); }
public DownloadCommandArguments( CommandArgument uri, CommandOption fileName, AuthArguments authArguments, CommandOption customHeaders) { Uri = uri; FileName = fileName; AuthArguments = authArguments; CustomHeaders = customHeaders; }
public InitCommandArguments( CommandArgument uri, CommandOption path, CommandOption schema, AuthArguments authArguments) { Uri = uri; Path = path; Schema = schema; AuthArguments = authArguments; }
public UpdateCommandArguments( CommandOption uri, CommandOption path, AuthArguments authArguments, CommandOption customHeaders) { Uri = uri; Path = path; AuthArguments = authArguments; CustomHeaders = customHeaders; }
public InitCommandArguments( CommandArgument uri, CommandOption path, CommandOption name, AuthArguments authArguments, CommandOption customHeaders) { Uri = uri; Path = path; Name = name; AuthArguments = authArguments; CustomHeaders = customHeaders; }
public async Task Auth(AuthArguments arguments) { var session = await OAuth.AuthorizeAsync(arguments.ClientId, arguments.ClientSecret); File.WriteAllText(".twitterToken", session.RequestToken); File.WriteAllText(".twitterSecret", session.RequestTokenSecret); Console.WriteLine($"Request Token: {session.RequestToken}"); Console.WriteLine($"Request Secret: {session.RequestTokenSecret}"); Console.WriteLine(); Console.WriteLine($"Open the following url to get the pin: {session.AuthorizeUri}"); }
public PublishSchemaCommandArguments( CommandArgument registry, CommandArgument environmentName, CommandArgument schemaName, CommandArgument schemaFileName, CommandOption tag, AuthArguments authArguments) { Registry = registry; EnvironmentName = environmentName; SchemaName = schemaName; SchemaFileName = schemaFileName; Tag = tag; AuthArguments = authArguments; }
public static void Build(CommandLineApplication init) { init.Description = "Initialize project and download schema"; CommandArgument uriArg = init.Argument( "uri", "The URL to the GraphQL endpoint.", c => c.IsRequired()); CommandOption pathArg = init.Option( "-p|--Path", "The directory where the client shall be located.", CommandOptionType.SingleValue); CommandOption nameArg = init.Option( "-n|--clientName", "The GraphQL client name.", CommandOptionType.SingleValue); CommandOption jsonArg = init.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); CommandOption headersArg = init.Option( "-x|--headers", "Custom headers used in request to Graph QL server. " + "Can be used mulitple times. Example: --headers key1=value1 --headers key2=value2", CommandOptionType.MultipleValue); AuthArguments authArguments = init.AddAuthArguments(); init.OnExecuteAsync(cancellationToken => { var arguments = new InitCommandArguments( uriArg, pathArg, nameArg, authArguments, headersArg); InitCommandHandler handler = CommandTools.CreateHandler <InitCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); }
public static CommandLineApplication Create() { var init = new CommandLineApplication(); init.AddName("init"); init.AddHelp <InitHelpTextGenerator>(); CommandArgument uriArg = init.Argument( "uri", "The URL to the GraphQL endpoint.", c => c.IsRequired()); CommandOption pathArg = init.Option( "-p|--Path", "The directory where the client shall be located.", CommandOptionType.SingleValue); CommandOption schemaArg = init.Option( "-n|--SchemaName", "The schema name.", CommandOptionType.SingleValue); CommandOption jsonArg = init.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); AuthArguments authArguments = init.AddAuthArguments(); init.OnExecuteAsync(cancellationToken => { var arguments = new InitCommandArguments( uriArg, pathArg, schemaArg, authArguments); InitCommandHandler handler = CommandTools.CreateHandler <InitCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); return(init); }
public PublishSchemaCommandArguments( CommandArgument registry, CommandArgument externalId, CommandArgument environmentName, CommandArgument schemaName, CommandOption schemaFileName, CommandOption tag, CommandOption published, AuthArguments authArguments) { Registry = registry; ExternalId = externalId; EnvironmentName = environmentName; SchemaName = schemaName; SchemaFileName = schemaFileName; Tag = tag; Published = published; AuthArguments = authArguments; }
public static void Build(CommandLineApplication download) { download.Description = "Download the schema as GraphQL SDL"; CommandArgument uriArg = download.Argument( "uri", "The URL to the GraphQL endpoint.", c => c.IsRequired()); CommandOption fileNameArg = download.Option( "-f|--FileName", "The file name to store the schema SDL.", CommandOptionType.SingleValue); CommandOption jsonArg = download.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); CommandOption headersArg = download.Option( "-x|--headers", "Custom headers used in request to Graph QL server. " + "Can be used mulitple times. Example: --headers key1=value1 --headers key2=value2", CommandOptionType.MultipleValue); AuthArguments authArguments = download.AddAuthArguments(); download.OnExecuteAsync(cancellationToken => { var arguments = new DownloadCommandArguments( uriArg, fileNameArg, authArguments, headersArg); DownloadCommandHandler handler = CommandTools.CreateHandler <DownloadCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); }
public static void Build(CommandLineApplication update) { update.Description = "Update local schema"; CommandOption pathArg = update.Option( "-p|--Path", "The directory where the client shall be located.", CommandOptionType.SingleValue); CommandOption urlArg = update.Option( "-u|--uri", "The URL to the GraphQL endpoint.", CommandOptionType.SingleValue); CommandOption jsonArg = update.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); CommandOption headersArg = update.Option( "-x|--headers", "Custom headers used in request to Graph QL server. " + "Can be used mulitple times. Example: --headers key1=value1 --headers key2=value2", CommandOptionType.MultipleValue); AuthArguments authArguments = update.AddAuthArguments(); update.OnExecuteAsync(cancellationToken => { var arguments = new UpdateCommandArguments( urlArg, pathArg, authArguments, headersArg); UpdateCommandHandler handler = CommandTools.CreateHandler <UpdateCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); }
public static CommandLineApplication Create() { var download = new CommandLineApplication(); download.AddName("download"); download.AddHelp <InitHelpTextGenerator>(); CommandArgument uriArg = download.Argument( "uri", "The URL to the GraphQL endpoint.", c => c.IsRequired()); CommandOption fileNameArg = download.Option( "-f|--FileName", "The file name to store the schema SDL.", CommandOptionType.SingleValue); CommandOption jsonArg = download.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); AuthArguments authArguments = download.AddAuthArguments(); download.OnExecuteAsync(cancellationToken => { var arguments = new DownloadCommandArguments( uriArg, fileNameArg, authArguments); DownloadCommandHandler handler = CommandTools.CreateHandler <DownloadCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); return(download); }
public static CommandLineApplication Create() { var publish = new CommandLineApplication(); publish.AddName("client"); //publish.AddHelp<InitHelpTextGenerator>(); CommandArgument registryArg = publish.Argument( "registry", "The URL to the GraphQL schema registry.", c => c.IsRequired()); CommandArgument environmentNameArg = publish.Argument( "environmentName", "The name of the environment.", c => c.IsRequired()); CommandArgument schemaNameArg = publish.Argument( "schemaName", "The name of the schema.", c => c.IsRequired()); CommandArgument clientNameArg = publish.Argument( "clientName", "The name of the client.", c => c.IsRequired()); CommandArgument externalId = publish.Argument( "externalId", "An external identifier to track the schema through the publish process.", c => c.IsRequired()); CommandOption searchDirectoryArg = publish.Option( "-d|--searchDirectory", "Files containing queries.", CommandOptionType.MultipleValue); CommandOption queryFileNameArg = publish.Option( "-f|--queryFileName", "Files containing queries.", CommandOptionType.MultipleValue); CommandOption relayFileFormatArg = publish.Option( "-r|--relayFileFormat", "Defines that the files are in the relay persisted query file format.", CommandOptionType.NoValue); CommandOption tagArg = publish.Option( "-t|--tag", "A custom tag that can be passed to the schema registry.", CommandOptionType.MultipleValue); CommandOption publishedArg = publish.Option( "-p|--published", "A custom tag that can be passed to the schema registry.", CommandOptionType.NoValue); CommandOption jsonArg = publish.Option( "-j|--json", "Console output as JSON.", CommandOptionType.NoValue); AuthArguments authArguments = publish.AddAuthArguments(); publish.OnExecuteAsync(cancellationToken => { var arguments = new PublishClientCommandArguments( registryArg, externalId, environmentNameArg, schemaNameArg, clientNameArg, searchDirectoryArg, queryFileNameArg, relayFileFormatArg, tagArg, publishedArg, authArguments); var handler = CommandTools.CreateHandler <PublishClientCommandHandler>(jsonArg); return(handler.ExecuteAsync(arguments, cancellationToken)); }); return(publish); }