You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
5.1 KiB

2 years ago
  1. # Org.OpenAPITools - the C# library for the Seaweedfs Master Server API
  2. The Seaweedfs Master Server API allows you to store blobs
  3. This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
  4. - API version: 3.43.0
  5. - SDK version: 1.0.0
  6. - Build package: org.openapitools.codegen.languages.CSharpClientCodegen
  7. ## Frameworks supported
  8. - .NET 4.0 or later
  9. - Windows Phone 7.1 (Mango)
  10. ## Dependencies
  11. - [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
  12. - [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
  13. - [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.2.0 or later
  14. The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
  15. ```
  16. Install-Package RestSharp
  17. Install-Package Newtonsoft.Json
  18. Install-Package JsonSubTypes
  19. ```
  20. NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
  21. ## Installation
  22. Run the following command to generate the DLL
  23. - [Mac/Linux] `/bin/sh build.sh`
  24. - [Windows] `build.bat`
  25. Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
  26. ```csharp
  27. using Org.OpenAPITools.Api;
  28. using Org.OpenAPITools.Client;
  29. using Org.OpenAPITools.Model;
  30. ```
  31. ## Packaging
  32. A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages.
  33. This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly:
  34. ```
  35. nuget pack -Build -OutputDirectory out Org.OpenAPITools.csproj
  36. ```
  37. Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual.
  38. ## Getting Started
  39. ```csharp
  40. using System.Collections.Generic;
  41. using System.Diagnostics;
  42. using Org.OpenAPITools.Api;
  43. using Org.OpenAPITools.Client;
  44. using Org.OpenAPITools.Model;
  45. namespace Example
  46. {
  47. public class Example
  48. {
  49. public static void Main()
  50. {
  51. Configuration.Default.BasePath = "https://127.0.0.1:9333";
  52. var apiInstance = new DefaultApi(Configuration.Default);
  53. var count = new Object(); // Object | how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)
  54. var collection = new Object(); // Object | required collection name (optional)
  55. var dataCenter = new Object(); // Object | preferred data center (optional)
  56. var rack = new Object(); // Object | preferred rack (optional)
  57. var dataNode = new Object(); // Object | preferred volume server, e.g. 127.0.0.1:8080 (optional)
  58. var disk = new Object(); // Object | If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)
  59. var replication = new Object(); // Object | replica placement strategy (optional)
  60. var ttl = new Object(); // Object | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)
  61. var preallocate = new Object(); // Object | If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)
  62. var memoryMapMaxSizeMb = new Object(); // Object | Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)
  63. var writableVolumeCount = new Object(); // Object | If no matching volumes, create specified number of new volumes. (optional)
  64. try
  65. {
  66. // Assign a file key
  67. FileKey result = apiInstance.DirAssign(count, collection, dataCenter, rack, dataNode, disk, replication, ttl, preallocate, memoryMapMaxSizeMb, writableVolumeCount);
  68. Debug.WriteLine(result);
  69. }
  70. catch (ApiException e)
  71. {
  72. Debug.Print("Exception when calling DefaultApi.DirAssign: " + e.Message );
  73. Debug.Print("Status Code: "+ e.ErrorCode);
  74. Debug.Print(e.StackTrace);
  75. }
  76. }
  77. }
  78. }
  79. ```
  80. ## Documentation for API Endpoints
  81. All URIs are relative to *https://127.0.0.1:9333*
  82. Class | Method | HTTP request | Description
  83. ------------ | ------------- | ------------- | -------------
  84. *DefaultApi* | [**DirAssign**](docs/DefaultApi.md#dirassign) | **GET** /dir/assign | Assign a file key
  85. *DefaultApi* | [**DirLookup**](docs/DefaultApi.md#dirlookup) | **GET** /dir/lookup | Lookup volume
  86. ## Documentation for Models
  87. - [Model.FileKey](docs/FileKey.md)
  88. - [Model.Location](docs/Location.md)
  89. ## Documentation for Authorization
  90. All endpoints do not require authorization.