kelvinRosa / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

Scopes class with const strings #367

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The current implementation of Scopes is an enum in each generated class.
We should change this behavior and create a static Scopes class inside the 
service and add const strings in it.

OLD WAY:

public enum Scopes 
{           
/// <summary>View and manage the files and documents in your Google 
Drive</summary>
[Google.Apis.Util.StringValueAttribute("https://www.googleapis.com/auth/drive")]
Drive,
/// <summary>View your Google Drive apps</summary>
[Google.Apis.Util.StringValueAttribute("https://www.googleapis.com/auth/drive.ap
ps.readonly")]
DriveAppsReadonly,
/// <summary>View and manage Google Drive files that you have opened or created 
with this app</summary>
[Google.Apis.Util.StringValueAttribute("https://www.googleapis.com/auth/drive.fi
le")]
DriveFile,
....
}

NEW WAY:

public static class Scopes 
{           
/// <summary>View and manage the files and documents in your Google 
Drive</summary>
public const string Drive = "https://www.googleapis.com/auth/drive";

/// <summary>View your Google Drive apps</summary>
DriveAppsReadonly = "https://www.googleapis.com/auth/drive.apps.readonly";

/// <summary>View and manage Google Drive files that you have opened or created 
with this app</summary>
DriveFile = "https://www.googleapis.com/auth/drive.file";
....
}

Original issue reported on code.google.com by pele...@google.com on 6 Aug 2013 at 3:55

GoogleCodeExporter commented 9 years ago
NEW WAY should look like this:

public static class Scopes 
{           
/// <summary>View and manage the files and documents in your Google 
Drive</summary>
public const string Drive = "https://www.googleapis.com/auth/drive";

/// <summary>View your Google Drive apps</summary>
public const string DriveAppsReadonly = 
"https://www.googleapis.com/auth/drive.apps.readonly";

/// <summary>View and manage Google Drive files that you have opened or created 
with this app</summary>
public const string DriveFile = "https://www.googleapis.com/auth/drive.file";
....
}

The reason is that strings are more convenient and the current way of 
converting the enum to the string (in the StringValueAttribute) is done using 
reflection which is unnecessary!

Original comment by pele...@google.com on 6 Aug 2013 at 3:56

GoogleCodeExporter commented 9 years ago
Issue 144 has been merged into this issue.

Original comment by pele...@google.com on 14 Sep 2013 at 1:53

GoogleCodeExporter commented 9 years ago
Work is internal in the code generator

Original comment by pele...@google.com on 14 Sep 2013 at 2:21

GoogleCodeExporter commented 9 years ago
Fixed in the internal repository. will be published in 1.6.0-beta release

Original comment by pele...@google.com on 16 Sep 2013 at 2:19

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 16 Sep 2013 at 2:19

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 3 Oct 2013 at 7:28

GoogleCodeExporter commented 9 years ago
Issue 144 has been merged into this issue.

Original comment by pele...@google.com on 3 Oct 2013 at 7:29