Blame view

ios/GameSDKDemo/letsgameDemo/VKSdk.framework/Versions/A/Headers/VKAccessToken.h 3.75 KB
23a302b86   alexYang   GameSDK 的iOS分支提交,...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  //
  //  VKAccessToken.h
  //
  //  Copyright (c) 2014 VK.com
  //
  //  Permission is hereby granted, free of charge, to any person obtaining a copy of
  //  this software and associated documentation files (the "Software"), to deal in
  //  the Software without restriction, including without limitation the rights to
  //  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  //  the Software, and to permit persons to whom the Software is furnished to do so,
  //  subject to the following conditions:
  //
  //  The above copyright notice and this permission notice shall be included in all
  //  copies or substantial portions of the Software.
  //
  //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  //  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  //  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  //  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  //  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  //  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  //
  //  --------------------------------------------------------------------------------
  //
  //  Modified by Ruslan Kavetsky
  
  #import <Foundation/Foundation.h>
  #import "VKObject.h"
  #import "VKUser.h"
  
  /**
  Presents VK API access token that used for loading API methods and other stuff.
  */
  @interface VKAccessToken : VKObject <NSCoding>
  
  /// String token for use in request parameters
  @property(nonatomic, readonly, copy) NSString *accessToken;
  
  /// Current user id for this token
  @property(nonatomic, readonly, copy) NSString *userId;
  
  /// User secret to sign requests (if nohttps used)
  @property(nonatomic, readonly, copy) NSString *secret;
  
  // Permisiions assosiated with token
  @property(nonatomic, readonly, copy) NSArray *permissions;
  
  // User email (if passed)
  @property(nonatomic, readonly, copy) NSString *email;
  
  /// Time when token expires
  @property(nonatomic, readonly, assign) NSInteger expiresIn;
  
  /// If user sets "Always use HTTPS" setting in his profile, it will be true
  @property(nonatomic, readonly, assign) BOOL httpsRequired;
  
  /// Indicates time of token creation
  @property(nonatomic, readonly, assign) NSTimeInterval created;
  
  /// Indicates time of token creation
  @property(nonatomic, readonly, strong) VKUser *localUser;
  
  /**
  Retrieve token from key-value query string
  @param urlString string that contains URL-query part with token. E.g. access_token=ffffff&expires_in=0...
  @return parsed token
  */
  + (instancetype)tokenFromUrlString:(NSString *)urlString;
  
  /**
  Create token with existing properties
  @param accessToken token string
  @param secret secret
  @param userId user id
  @return new token
  */
  + (instancetype)tokenWithToken:(NSString *)accessToken secret:(NSString *)secret userId:(NSString *)userId;
  
  /**
  Retrieve token from user defaults. Token must be saved to defaults with saveTokenToDefaults method
  @param defaultsKey path to file with saved token
  @return parsed token
  */
  + (instancetype)savedToken:(NSString *)defaultsKey;
  
  /**
  Save token into user defaults by specified key
  @param defaultsKey key for defaults
  */
  - (void)saveTokenToDefaults:(NSString *)defaultsKey;
  
  /// Return YES if token has expired
  - (BOOL)isExpired;
  
  /**
   Remove token from storage
   */
  + (void)delete:(NSString *)service;
  
  @end
  
  @interface VKAccessTokenMutable : VKAccessToken
  @property(nonatomic, readwrite, copy) NSString *accessToken;
  @property(nonatomic, readwrite, copy) NSString *userId;
  @property(nonatomic, readwrite, copy) NSString *secret;
  @property(nonatomic, readwrite, copy) NSArray *permissions;
  @property(nonatomic, readwrite, assign) BOOL httpsRequired;
  @property(nonatomic, readwrite, assign) NSInteger expiresIn;
  @property(nonatomic, readwrite, strong) VKUser *localUser;
  @end