Skip to content

Commit

Permalink
feat: align SDK namespace with NuGet package and assembly name (#109)
Browse files Browse the repository at this point in the history
This PR renames the namespace `MomentoSdk` to `Momento.Sdk`. This is
consistent with C# best practices, with the package name on NuGet, and
with the assembly name.
  • Loading branch information
malandis authored Aug 11, 2022
1 parent 70676fb commit dde5796
Show file tree
Hide file tree
Showing 58 changed files with 112 additions and 114 deletions.
4 changes: 2 additions & 2 deletions IncubatingIntegrationTest/DictionaryTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using MomentoSdk.Internal.ExtensionMethods;
using MomentoSdk.Responses;
using Momento.Sdk.Internal.ExtensionMethods;
using Momento.Sdk.Responses;

namespace IncubatingIntegrationTest;

Expand Down
2 changes: 1 addition & 1 deletion IncubatingIntegrationTest/SetTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MomentoSdk.Responses;
using Momento.Sdk.Responses;

namespace IncubatingIntegrationTest;

Expand Down
6 changes: 3 additions & 3 deletions IncubatingIntegrationTest/Usings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
global using Momento.Sdk.Exceptions;
global using Momento.Sdk.Incubating;
global using Xunit;
global using MomentoSdk.Incubating;
global using MomentoSdk.Exceptions;
global using Utils = MomentoSdk.Internal.Utils;
global using Utils = Momento.Sdk.Internal.Utils;
2 changes: 1 addition & 1 deletion Momento/Exceptions/AlreadyExistsException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

/// <summary>
/// Resource already exists
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/AuthenticationException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

/// <summary>
/// Authentication token is not provided or is invalid.
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/BadRequestException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

/// <summary>
/// Invalid parameters sent to Momento Services.
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/CacheExceptionMapper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Grpc.Core;

namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

class CacheExceptionMapper
{
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/CancelledException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

public class CancelledException : MomentoServiceException
{
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/ClientSdkException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

public class ClientSdkException : SdkException
{
Expand Down
3 changes: 2 additions & 1 deletion Momento/Exceptions/InternalServerException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
namespace MomentoSdk.Exceptions;

namespace Momento.Sdk.Exceptions;

/// <summary>
/// Momento Service encountered an unexpected exception while trying to fulfill the request.
Expand Down
3 changes: 2 additions & 1 deletion Momento/Exceptions/InvalidArgumentException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
namespace MomentoSdk.Exceptions;

namespace Momento.Sdk.Exceptions;

/// <summary>
/// SDK client side validation failed.
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/LimitExceededException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

/// <summary>
/// Requested operation couldn't be completed because system limits were hit.
Expand Down
3 changes: 2 additions & 1 deletion Momento/Exceptions/MomentoServiceException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
namespace MomentoSdk.Exceptions;

namespace Momento.Sdk.Exceptions;

/// <summary>
/// Base type for all the exceptions resulting from invalid interactions with Momento Services.
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/NotFoundException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

/// <summary>
/// Requested resource or the resource on which an operation was requested doesn't exist.
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/PermissionDeniedException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

/// <summary>
/// Insufficient permissions to execute an operation.
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/SdkException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

public abstract class SdkException : Exception
{
Expand Down
2 changes: 1 addition & 1 deletion Momento/Exceptions/TimeoutException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Exceptions;
namespace Momento.Sdk.Exceptions;

/// <summary>
/// Requested operation did not complete in allotted time.
Expand Down
5 changes: 3 additions & 2 deletions Momento/ISimpleCacheClient.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MomentoSdk.Responses;
namespace MomentoSdk;
using Momento.Sdk.Responses;

namespace Momento.Sdk;

/// <summary>
/// Minimum viable functionality of a cache client.
Expand Down
10 changes: 5 additions & 5 deletions Momento/Incubating/Internal/ScsDataClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using System.Threading.Tasks;
using Google.Protobuf;
using Momento.Protos.CacheClient;
using MomentoSdk.Exceptions;
using MomentoSdk.Incubating.Responses;
using MomentoSdk.Internal;
using MomentoSdk.Internal.ExtensionMethods;
using Momento.Sdk.Exceptions;
using Momento.Sdk.Incubating.Responses;
using Momento.Sdk.Internal;
using Momento.Sdk.Internal.ExtensionMethods;

namespace MomentoSdk.Incubating.Internal;
namespace Momento.Sdk.Incubating.Internal;

internal sealed class ScsDataClient : ScsDataClientBase
{
Expand Down
6 changes: 3 additions & 3 deletions Momento/Incubating/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Incubating

The `MomentoSdk.Incubating` namespace has work-in-progress features that may or may be be in the final version.
The `Momento.Sdk.Incubating` namespace has work-in-progress features that may or may be be in the final version.

# Dictionary Methods

This demonstrates the methods and response types for a dictionary data type in the cache:

```csharp
using MomentoSdk.Incubating;
using Momento.Sdk.Incubating;

class Driver
{
public static void Main()
{
var client = SimpleCacheClientFactory.CreateClient(authToken: "YOUR-AUTH-TOKEN", defaultTtlSeconds: 60);
using var client = SimpleCacheClientFactory.CreateClient(authToken: "YOUR-AUTH-TOKEN", defaultTtlSeconds: 60);
var cacheName = "my-cache";

// Set a value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheDictionaryDeleteResponse
{
Expand Down
6 changes: 3 additions & 3 deletions Momento/Incubating/Responses/CacheDictionaryFetchResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using System.Linq;
using Google.Protobuf.Collections;
using Momento.Protos.CacheClient;
using MomentoSdk.Internal;
using MomentoSdk.Responses;
using Momento.Sdk.Internal;
using Momento.Sdk.Responses;

namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheDictionaryFetchResponse
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using Momento.Protos.CacheClient;
using MomentoSdk.Responses;
using Momento.Sdk.Responses;


namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheDictionaryGetBatchResponse
{
Expand Down
6 changes: 3 additions & 3 deletions Momento/Incubating/Responses/CacheDictionaryGetResponse.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Google.Protobuf;
using Momento.Protos.CacheClient;
using MomentoSdk.Exceptions;
using MomentoSdk.Responses;
using Momento.Sdk.Exceptions;
using Momento.Sdk.Responses;

namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheDictionaryGetResponse
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheDictionaryRemoveFieldResponse
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheDictionaryRemoveFieldsResponse
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheDictionarySetBatchResponse
{
Expand Down
2 changes: 1 addition & 1 deletion Momento/Incubating/Responses/CacheDictionarySetResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheDictionarySetResponse
{
Expand Down
2 changes: 1 addition & 1 deletion Momento/Incubating/Responses/CacheSetAddBatchResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheSetAddBatchResponse
{
Expand Down
2 changes: 1 addition & 1 deletion Momento/Incubating/Responses/CacheSetAddResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheSetAddResponse
{
Expand Down
2 changes: 1 addition & 1 deletion Momento/Incubating/Responses/CacheSetDeleteResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheSetDeleteResponse
{
Expand Down
6 changes: 3 additions & 3 deletions Momento/Incubating/Responses/CacheSetFetchResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using Google.Protobuf;
using Google.Protobuf.Collections;
using Momento.Protos.CacheClient;
using MomentoSdk.Internal;
using MomentoSdk.Responses;
using Momento.Sdk.Internal;
using Momento.Sdk.Responses;

namespace MomentoSdk.Incubating.Responses;
namespace Momento.Sdk.Incubating.Responses;

public class CacheSetFetchResponse
{
Expand Down
12 changes: 6 additions & 6 deletions Momento/Incubating/SimpleCacheClient.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MomentoSdk.Responses;
using Utils = MomentoSdk.Internal.Utils;
using MomentoSdk.Incubating.Internal;
using MomentoSdk.Incubating.Responses;
using Momento.Sdk.Incubating.Internal;
using Momento.Sdk.Incubating.Responses;
using Momento.Sdk.Responses;
using Utils = Momento.Sdk.Internal.Utils;

namespace MomentoSdk.Incubating;
namespace Momento.Sdk.Incubating;

/// <summary>
/// Incubating cache client.
Expand All @@ -31,7 +31,7 @@ public SimpleCacheClient(ISimpleCacheClient simpleCacheClient, string authToken,
{
this.simpleCacheClient = simpleCacheClient;

var claims = MomentoSdk.Internal.JwtUtils.DecodeJwt(authToken);
var claims = Momento.Sdk.Internal.JwtUtils.DecodeJwt(authToken);
this.dataClient = new(authToken, claims.CacheEndpoint, defaultTtlSeconds, dataClientOperationTimeoutMilliseconds);
}

Expand Down
4 changes: 2 additions & 2 deletions Momento/Incubating/SimpleCacheClientFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MomentoSdk.Incubating;
namespace Momento.Sdk.Incubating;

/// <summary>
/// Factory class used to instantiate the incubating Simple Cache Client.
Expand All @@ -16,7 +16,7 @@ public class SimpleCacheClientFactory
/// <returns>An instance of the incubating Simple Cache Client.</returns>
public static SimpleCacheClient CreateClient(string authToken, uint defaultTtlSeconds, uint? dataClientOperationTimeoutMilliseconds = null)
{
var simpleCacheClient = new MomentoSdk.SimpleCacheClient(authToken, defaultTtlSeconds, dataClientOperationTimeoutMilliseconds);
var simpleCacheClient = new Momento.Sdk.SimpleCacheClient(authToken, defaultTtlSeconds, dataClientOperationTimeoutMilliseconds);
return new SimpleCacheClient(simpleCacheClient, authToken, defaultTtlSeconds, dataClientOperationTimeoutMilliseconds);
}
}
4 changes: 2 additions & 2 deletions Momento/Internal/ControlGrpcManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
using Momento.Protos.ControlClient;
using static System.Reflection.Assembly;

namespace MomentoSdk.Internal;
namespace Momento.Sdk.Internal;

internal sealed class ControlGrpcManager : IDisposable
{
private readonly GrpcChannel channel;
public ScsControl.ScsControlClient Client { get; }
private readonly string version = "csharp:" + GetAssembly(typeof(MomentoSdk.Responses.CacheGetResponse)).GetName().Version.ToString();
private readonly string version = "csharp:" + GetAssembly(typeof(Momento.Sdk.Responses.CacheGetResponse)).GetName().Version.ToString();

public ControlGrpcManager(string authToken, string endpoint)
{
Expand Down
4 changes: 2 additions & 2 deletions Momento/Internal/DataGrpcManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
using Momento.Protos.CacheClient;
using static System.Reflection.Assembly;

namespace MomentoSdk.Internal;
namespace Momento.Sdk.Internal;

public class DataGrpcManager : IDisposable
{
private readonly GrpcChannel channel;
public Scs.ScsClient Client { get; }

private readonly string version = "csharp:" + GetAssembly(typeof(MomentoSdk.Responses.CacheGetResponse)).GetName().Version.ToString();
private readonly string version = "csharp:" + GetAssembly(typeof(Momento.Sdk.Responses.CacheGetResponse)).GetName().Version.ToString();

internal DataGrpcManager(string authToken, string host)
{
Expand Down
6 changes: 3 additions & 3 deletions Momento/Internal/HeaderInterceptor.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using Grpc.Core;
using Grpc.Core.Interceptors;
using System.Collections.Generic;
using System.Linq;
using Grpc.Core;
using Grpc.Core.Interceptors;

namespace MomentoSdk.Internal;
namespace Momento.Sdk.Internal;

class Header
{
Expand Down
4 changes: 2 additions & 2 deletions Momento/Internal/JwtUtils.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using JWT;
using JWT.Serializers;
using MomentoSdk.Exceptions;
using Momento.Sdk.Exceptions;
using Newtonsoft.Json;

namespace MomentoSdk.Internal;
namespace Momento.Sdk.Internal;

public class JwtUtils
{
Expand Down
6 changes: 3 additions & 3 deletions Momento/Internal/ScsControlClient.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using Momento.Protos.ControlClient;
using MomentoSdk.Exceptions;
using MomentoSdk.Responses;
using Momento.Sdk.Exceptions;
using Momento.Sdk.Responses;

namespace MomentoSdk.Internal;
namespace Momento.Sdk.Internal;

internal sealed class ScsControlClient : IDisposable
{
Expand Down
Loading

0 comments on commit dde5796

Please sign in to comment.