Skip to content

Commit 0cccb06

Browse files
committed
feat(medusa-api): Adds cookie session management
1 parent 0fd9eed commit 0cccb06

File tree

77 files changed

+233
-556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+233
-556
lines changed

README.md

Lines changed: 55 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -131,30 +131,29 @@ Please follow the [installation](#installation) instruction and execute the foll
131131
import mobi.appcent.medusa.store.MedusaSdkClient;
132132
import mobi.appcent.medusa.store.ApiException;
133133
import mobi.appcent.medusa.store.api.AuthApi;
134-
import mobi.appcent.medusa.store.auth.ApiKeyAuth;
135134
import mobi.appcent.medusa.store.model.response.StoreAuthRes;
136135
import mobi.appcent.medusa.store.model.response.StoreGetAuthEmailRes;
137136
import mobi.appcent.medusa.store.model.response.StorePostAuthReq;
138137

139138
public class AuthApiExample {
140139

141-
public static void main(String[] args) {
142-
MedusaSdkClient defaultClient = Configuration.getDefaultApiClient();
143-
144-
// Configure API key authorization: cookie_auth
145-
ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth");
146-
cookie_auth.setApiKey("YOUR API KEY");
147-
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
148-
//cookie_auth.setApiKeyPrefix("Token");
149-
150-
AuthApi apiInstance = new AuthApi();
151-
try {
152-
apiInstance.deleteAuth();
153-
} catch (ApiException e) {
154-
System.err.println("Exception when calling AuthApi#deleteAuth");
155-
e.printStackTrace();
140+
public static void main(String[] args) {
141+
MedusaSdkClient defaultClient = Configuration.getDefaultApiClient();
142+
143+
// Configure API key authorization: cookie_auth
144+
ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth");
145+
cookie_auth.setApiKey("YOUR API KEY");
146+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
147+
//cookie_auth.setApiKeyPrefix("Token");
148+
149+
AuthApi apiInstance = new AuthApi();
150+
try {
151+
apiInstance.deleteAuth();
152+
} catch (ApiException e) {
153+
System.err.println("Exception when calling AuthApi#deleteAuth");
154+
e.printStackTrace();
155+
}
156156
}
157-
}
158157
}
159158
import mobi.appcent.medusa.store.*;
160159
import mobi.appcent.medusa.store.auth.*;
@@ -166,24 +165,24 @@ import mobi.appcent.medusa.store.*;
166165

167166
public class AuthApiExample {
168167

169-
public static void main(String[] args) {
170-
MedusaSdkClient defaultClient = Configuration.getDefaultApiClient();
171-
172-
// Configure API key authorization: cookie_auth
173-
ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth");
174-
cookie_auth.setApiKey("YOUR API KEY");
175-
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
176-
//cookie_auth.setApiKeyPrefix("Token");
177-
178-
AuthApi apiInstance = new AuthApi();
179-
try {
180-
StoreAuthRes result = apiInstance.getAuth();
181-
System.out.println(result);
182-
} catch (ApiException e) {
183-
System.err.println("Exception when calling AuthApi#getAuth");
184-
e.printStackTrace();
168+
public static void main(String[] args) {
169+
MedusaSdkClient defaultClient = Configuration.getDefaultApiClient();
170+
171+
// Configure API key authorization: cookie_auth
172+
ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth");
173+
cookie_auth.setApiKey("YOUR API KEY");
174+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
175+
//cookie_auth.setApiKeyPrefix("Token");
176+
177+
AuthApi apiInstance = new AuthApi();
178+
try {
179+
StoreAuthRes result = apiInstance.getAuth();
180+
System.out.println(result);
181+
} catch (ApiException e) {
182+
System.err.println("Exception when calling AuthApi#getAuth");
183+
e.printStackTrace();
184+
}
185185
}
186-
}
187186
}
188187
import mobi.appcent.medusa.store.*;
189188
import mobi.appcent.medusa.store.auth.*;
@@ -195,18 +194,18 @@ import mobi.appcent.medusa.store.*;
195194

196195
public class AuthApiExample {
197196

198-
public static void main(String[] args) {
199-
200-
AuthApi apiInstance = new AuthApi();
201-
String email = "email_example"; // String | The email to check if exists.
202-
try {
203-
StoreGetAuthEmailRes result = apiInstance.getAuthEmail(email);
204-
System.out.println(result);
205-
} catch (ApiException e) {
206-
System.err.println("Exception when calling AuthApi#getAuthEmail");
207-
e.printStackTrace();
197+
public static void main(String[] args) {
198+
199+
AuthApi apiInstance = new AuthApi();
200+
String email = "email_example"; // String | The email to check if exists.
201+
try {
202+
StoreGetAuthEmailRes result = apiInstance.getAuthEmail(email);
203+
System.out.println(result);
204+
} catch (ApiException e) {
205+
System.err.println("Exception when calling AuthApi#getAuthEmail");
206+
e.printStackTrace();
207+
}
208208
}
209-
}
210209
}
211210
import mobi.appcent.medusa.store.*;
212211
import mobi.appcent.medusa.store.auth.*;
@@ -218,18 +217,18 @@ import mobi.appcent.medusa.store.*;
218217

219218
public class AuthApiExample {
220219

221-
public static void main(String[] args) {
222-
223-
AuthApi apiInstance = new AuthApi();
224-
StorePostAuthReq body = new StorePostAuthReq(); // StorePostAuthReq |
225-
try {
226-
StoreAuthRes result = apiInstance.postAuth(body);
227-
System.out.println(result);
228-
} catch (ApiException e) {
229-
System.err.println("Exception when calling AuthApi#postAuth");
230-
e.printStackTrace();
220+
public static void main(String[] args) {
221+
222+
AuthApi apiInstance = new AuthApi();
223+
StorePostAuthReq body = new StorePostAuthReq(); // StorePostAuthReq |
224+
try {
225+
StoreAuthRes result = apiInstance.postAuth(body);
226+
System.out.println(result);
227+
} catch (ApiException e) {
228+
System.err.println("Exception when calling AuthApi#postAuth");
229+
e.printStackTrace();
230+
}
231231
}
232-
}
233232
}
234233
```
235234

src/main/java/mobi/appcent/medusa/store/MedusaApi.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ private void initializeSdkClients() {
4242
orderEditApi.setApiClient(defaultMedusaSdkClient);
4343
paymentCollectionApi.setApiClient(defaultMedusaSdkClient);
4444
productApi.setApiClient(defaultMedusaSdkClient);
45+
productTagApi.setApiClient(defaultMedusaSdkClient);
4546
productTypeApi.setApiClient(defaultMedusaSdkClient);
4647
productVariantApi.setApiClient(defaultMedusaSdkClient);
4748
regionApi.setApiClient(defaultMedusaSdkClient);

0 commit comments

Comments
 (0)