{"id":19703458,"url":"https://github.com/crowdin/crowdin-api-client-dotnet","last_synced_at":"2025-05-16T17:07:40.300Z","repository":{"id":40436311,"uuid":"147632140","full_name":"crowdin/crowdin-api-client-dotnet","owner":"crowdin","description":".NET client library for Crowdin API","archived":false,"fork":false,"pushed_at":"2025-05-16T12:33:50.000Z","size":9067,"stargazers_count":52,"open_issues_count":0,"forks_count":30,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-16T17:06:57.431Z","etag":null,"topics":["api","client","crowdin-api","dotnet","hacktoberfest","sdk"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Crowdin.Api/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crowdin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-09-06T07:07:05.000Z","updated_at":"2025-05-16T12:40:07.000Z","dependencies_parsed_at":"2023-10-25T10:26:52.174Z","dependency_job_id":"e284f486-a7ec-4435-a9f6-836dcf430743","html_url":"https://github.com/crowdin/crowdin-api-client-dotnet","commit_stats":{"total_commits":161,"total_committers":14,"mean_commits":11.5,"dds":0.5838509316770186,"last_synced_commit":"633fed3346922b8a529171941cf67a65fe9af701"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crowdin","download_url":"https://codeload.github.com/crowdin/crowdin-api-client-dotnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254573589,"owners_count":22093731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","crowdin-api","dotnet","hacktoberfest","sdk"],"created_at":"2024-11-11T21:17:56.083Z","updated_at":"2025-05-16T17:07:40.293Z","avatar_url":"https://github.com/crowdin.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cWhite.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png\"\u003e\n    \u003cimg width=\"150\" height=\"150\" width=\"\"src=\"[https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png](https://crowdin.com)\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n# Crowdin .NET client [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fcrowdin%2Fcrowdin-api-client-dotnet\u0026text=The%20Crowdin%20.NET%20client%20is%20a%20lightweight%20interface%20to%20the%20Crowdin%20API)\u0026nbsp;[![GitHub Repo stars](https://img.shields.io/github/stars/crowdin/crowdin-api-client-dotnet?style=social\u0026cacheSeconds=1800)](https://github.com/crowdin/crowdin-api-client-dotnet/stargazers)\n\nThe Crowdin .NET client is a lightweight interface to the Crowdin API. It provides common services for making API requests.\n\nOur API is a full-featured RESTful API that helps you to integrate localization into your development process. The endpoints that we use allow you to easily make calls to retrieve information and perform necessary actions.\n\n\u003cdiv align=\"center\"\u003e\n\n[**`Docs`**](https://crowdin.github.io/crowdin-api-client-dotnet/api/Crowdin.Api.html) \u0026nbsp;|\u0026nbsp;\n[**`Examples`**](https://github.com/crowdin/crowdin-api-client-dotnet/tree/main/samples) \u0026nbsp;|\u0026nbsp;\n[**`Crowdin API`**](https://developer.crowdin.com/api/v2/) \u0026nbsp;|\u0026nbsp;\n[**`Crowdin Enterprise API`**](https://developer.crowdin.com/enterprise/api/v2/)\n\n[![Nuget](https://img.shields.io/nuget/v/Crowdin.Api?cacheSeconds=5000)](https://www.nuget.org/packages/Crowdin.Api/)\n[![Nuget](https://img.shields.io/nuget/dt/crowdin.api?cacheSeconds=800)](https://www.nuget.org/packages/Crowdin.Api/)\n[![Tests](https://github.com/crowdin/crowdin-api-client-dotnet/actions/workflows/basic.yml/badge.svg)](https://github.com/crowdin/crowdin-api-client-dotnet/actions/workflows/basic.yml)\n[![codecov](https://codecov.io/gh/crowdin/crowdin-api-client-dotnet/branch/main/graph/badge.svg?token=rvpbEqBcLU)](https://codecov.io/gh/crowdin/crowdin-api-client-dotnet)\n[![GitHub contributors](https://img.shields.io/github/contributors/crowdin/crowdin-api-client-dotnet?cacheSeconds=10000)](https://github.com/crowdin/crowdin-api-client-dotnet/graphs/contributors)\n[![GitHub](https://img.shields.io/github/license/crowdin/crowdin-api-client-dotnet?cacheSeconds=20000)](https://github.com/crowdin/crowdin-api-client-dotnet/blob/master/LICENSE)\n\n\u003c/div\u003e\n\n### Requirements\n\n* .NET Standard 2.0 support\n* C# language version - 8.0+\n\n### Installation\n\nInstall via NuGet:\n\n```\n// Package Manager\nInstall-Package Crowdin.Api -Version 2.35.0\n\n// .Net CLI\ndotnet add package Crowdin.Api --version 2.35.0\n\n// Package Reference\n\u003cPackageReference Include=\"Crowdin.Api\" Version=\"2.35.0\" /\u003e\n\n// Paket CLI\npaket add Crowdin.Api --version 2.35.0\n```\n\n### Usage examples\n\n#### Initialization\n\nInstantiate a client with all available APIs:\n\n```C#\n\nvar credentials = new CrowdinCredentials\n{\n    AccessToken = \"\u003cpaste token here\u003e\",\n    Organization = \"organizationName (for Crowdin Enterprise only)\"\n};\nvar client = new CrowdinApiClient(credentials);\n```\n\nOr use only the executors you need:\n\n```C#\nvar credentials = new CrowdinCredentials\n{\n    AccessToken = \"\u003cpaste token here\u003e\",\n    Organization = \"organizationName (for Crowdin Enterprise only)\"\n};\n\nvar client = new CrowdinApiClient(credentials);\nvar executor = new SourceFilesApiExecutor(client);\n```\n\n#### Storage\n\n1. List storages\n\n```C#\nResponseList\u003cStorageResource\u003e storages = await client.Storage.ListStorages();\n```\n\n2. Add storage\n\n```C#\nawait using FileStream fileStream = File.Open(\"/path/to/file\", FileMode.Open);\nStorageResource storageResource = await client.Storage.AddStorage(fileStream, filename: \"MyFile\");\n```\n\n#### Projects\n\n1. List projects\n\n```C#\nResponseList\u003cEnterpriseProject\u003e response = await client.ProjectsGroups.ListProjects\u003cEnterpriseProject\u003e();\n```\n\n2. Edit project\n\n```C#\nconst int projectId = 1;\n\n// Edit info \u0026 settings with one request\nvar patches = new List\u003cProjectPatch\u003e\n{\n    // Edit project info\n    new ProjectInfoPatch\n    {\n        Value = \"name\",\n        Path = ProjectInfoPathCode.Cname,\n        Operation = PatchOperation.Replace\n    },\n    new ProjectInfoPatch\n    {\n        Value = \"value here\",\n        Path = new ProjectInfoPath(ProjectInfoPathCode.LanguageMapping, \"languageId\", \"mapping\"),\n        Operation = PatchOperation.Test\n    },\n\n    // Edit project settings\n    new ProjectSettingPatch\n    {\n        Value = true,\n        Path = ProjectSettingPathCode.AutoSubstitution,\n        Operation = PatchOperation.Replace\n    }\n};\n\n// PATCH request\nvar projectSettingsResponse = await client.ProjectsGroups.EditProject\u003cProjectSettings\u003e(projectId, patches);\nConsole.WriteLine(projectSettingsResponse);\n```\n\n#### GraphQL API\n\nThis SDK also has the support of [GraphQL API](https://support.crowdin.com/developer/graphql-api/).\n\n```csharp\nconst string Query =\n    \"\"\"\n    query {\n      viewer {\n        projects(first: 50) {\n          edges {\n            node {\n              name\n                  \n              files(first: 10) {\n                totalCount\n                edges {\n                  node {\n                    name\n                    type\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n    \"\"\";\n\nvar request = new GraphQLRequest\n{\n    Query = Query\n};\n\nJObject? response = await _crowdinApiClient.GraphQL.ExecuteQuery(request);\n            \nstring[] projectNames =\n    response[\"data\"][\"viewer\"][\"projects\"][\"edges\"]\n        .Select(edge =\u003e edge[\"node\"][\"name\"].Value\u003cstring\u003e())\n        .Where(projectNames =\u003e !string.IsNullOrWhiteSpace(projectNames))\n        .ToArray();\n\nConsole.WriteLine(\n    \"Project names:\\n - {0}\",\n    string.Join(\"\\n - \", projectNames.Select((name, i) =\u003e $\"{i + 1}) {name}\")));\n```\n\n#### Fetch all records\n\nGet a list of all the data available from the API via automatic pagination control:\n\n```C#\nconst int parentId = 1;\nconst int maxAmountOfItems = 50; // amount of needed items. Optional parameter, default: no limit\nconst int amountPerRequest = 10; // amount of items in response per 1 request. Optional parameter, default: 25\n\nGroup[] allGroups = await CrowdinApiClient.WithFetchAll((limit, offset) =\u003e\n{\n    Console.WriteLine(\"Limit: {0} | Offset: {1}\", limit, offset);\n    return client.ProjectsGroups.ListGroups(parentId, limit, offset);\n}, maxAmountOfItems, amountPerRequest);\n```\n\nOnly for list async methods that return `Task\u003cResponseList\u003cT\u003e\u003e`.\n\n#### Sorting\n\nAn optional `orderBy` parameter is used to apply sorting.\n\n```C#\nvar executor = new ProjectsGroupsApiExecutor(mockClient.Object);\n\nResponseList\u003cEnterpriseProject\u003e projectsList = await executor.ListProjects\u003cEnterpriseProject\u003e(\n        userId, groupId, hasManagerAccess,\n        orderBy: new[]\n        {\n            new SortingRule\n            {\n                Field = \"createdAt\",\n                Order = SortingOrder.Descending\n            },\n            new SortingRule\n            {\n                Field = \"name\",\n                Order = SortingOrder.Ascending\n            }\n        });\n```\n\nProperty `SortingRule.Order` is also optional (ascending order applied by default).\n\n#### Rate limiting\n\nAPI client has built-in support for rate limiting services. The library provides an implementation of Exponential Backoff Algorithm.\n\nUsage:\n\n```C#\nvar rateLimiter = new ExponentialBackoffRateLimiter(new RateLimitConfiguration\n{\n    // Maximum attempts count\n    MaxAttempts = 5,\n    // Maximum delay (top limit)\n    MaxDelay = TimeSpan.FromSeconds(5),\n    // Initial delay (bottom limit)\n    InitialDelay = TimeSpan.FromMilliseconds(200),\n});\n\n// Pass created Rate Limiter instance as named argument to API client instance\n// If rate limiter not passed - the request will fail immediately after HTTP 429 Too Many Requests error\nvar client = new CrowdinApiClient(new CrowdinCredentials\n{\n    AccessToken = \"\u003cpaste token here\u003e\",\n    Organization = \"optional organization (for Enterprise API)\"\n}, rateLimiter: rateLimiter);\n```\n\nA custom rate limiting service should also implement the `IRateLimiter` interface. Rate limiting is disabled by default because users may be using custom resilience approaches (such as `Polly`) that may conflict with each other. This solution only covers simple resilience cases. If you need advanced customization - please try `Polly` or alternatives.\n\n#### Retry configuration\n\nPass retry service (built-in or custom):\n\n```C#\nIRetryService myRetryService = new RetryService(new RetryConfiguration\n{\n    RetriesCount = 5,\n    WaitIntervalMilliseconds = 1000,\n    SkipRetryConditions =\n    {\n        exception =\u003e ((CrowdinApiException) exception).Code.GetValueOrDefault() == 1\n    }\n});\n\nvar apiClient = new CrowdinApiClient(new CrowdinCredentials\n{\n    AccessToken = \"\u003cpaste token here\u003e\",\n    Organization = \"optional organization (for Enterprise API)\"\n}, retryService: myRetryService);\n```\n\nA custom retry service should also implement the `IRetryService` interface.\n\n### Contribution\n\nIf you would like to contribute please read the [Contributing](CONTRIBUTING.md) guidelines.\n\n### Seeking Assistance\n\nIf you find any problems or would like to suggest a feature, please feel free to file an issue on GitHub at the [Issues Page](https://github.com/crowdin/crowdin-dotnet-client/issues).\n\n### License\n\n\u003cpre\u003e\nThe Crowdin .NET client is licensed under the MIT License.\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nExcept as contained in the LICENSE file, the name(s) of the above copyright\nholders shall not be used in advertising or otherwise to promote the sale,\nuse or other dealings in this Software without prior written authorization.\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdin%2Fcrowdin-api-client-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrowdin%2Fcrowdin-api-client-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdin%2Fcrowdin-api-client-dotnet/lists"}