nextemos 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { IApiResponse, RequestOptions } from '../';
2
2
  /**
3
- * Creates a HTTP client for making requests.
4
- * @returns {object} HTTP client with methods for making requests.
3
+ * İstek yapmak için bir HTTP istemcisi oluşturur.
4
+ * @returns {object} İstek yapmak için yöntemlere sahip HTTP istemcisi.
5
5
  */
6
6
  declare const fetchRequest: () => {
7
7
  get: <T>(url: string, options: Omit<RequestOptions, 'url' | 'method'>) => Promise<IApiResponse<T>>;
@@ -22,19 +22,19 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  const __1 = require("../");
24
24
  /**
25
- * Creates a HTTP client for making requests.
26
- * @returns {object} HTTP client with methods for making requests.
25
+ * İstek yapmak için bir HTTP istemcisi oluşturur.
26
+ * @returns {object} İstek yapmak için yöntemlere sahip HTTP istemcisi.
27
27
  */
28
28
  const fetchRequest = () => {
29
29
  /**
30
- * Makes an HTTP request using fetch.
30
+ * fetch kullanarak bir HTTP isteği yapar.
31
31
  * @template T
32
- * @param {RequestOptions} options - Request options.
33
- * @returns {Promise<IApiResponse<T>>} Response from the API.
32
+ * @param {RequestOptions} options - İstek seçenekleri.
33
+ * @returns {Promise<IApiResponse<T>>} API'den gelen yanıt.
34
34
  */
35
35
  const request = (_a) => __awaiter(void 0, void 0, void 0, function* () {
36
36
  var { url, method, params } = _a, options = __rest(_a, ["url", "method", "params"]);
37
- const apiURL = new URL(url); // Assuming url already contains apiUrl and apiVersion
37
+ const apiURL = new URL(url); // url'nin zaten apiUrl ve apiVersion içerdiği varsayılıyor
38
38
  if (params) {
39
39
  Object.keys(params).forEach(key => apiURL.searchParams.append(key, params[key]));
40
40
  }
@@ -42,55 +42,55 @@ const fetchRequest = () => {
42
42
  const response = yield fetch(apiURL.toString(), Object.assign(Object.assign({}, options), { method }));
43
43
  const responseData = yield response.json().catch(() => ({}));
44
44
  if (!response.ok) {
45
- const errorMessage = (responseData === null || responseData === void 0 ? void 0 : responseData.message) || 'Something went wrong!';
46
- console.error(`Error: ${response.status} - ${errorMessage}`);
45
+ const errorMessage = (responseData === null || responseData === void 0 ? void 0 : responseData.message) || 'Bir şeyler yanlış gitti!';
46
+ console.error(`Hata: ${response.status} - ${errorMessage}`);
47
47
  return { status: response.status, error: errorMessage };
48
48
  }
49
49
  return { status: response.status, data: responseData };
50
50
  }
51
51
  catch (error) {
52
- console.error('HTTP request failed:', error);
53
- return { status: 500, error: 'Internal Server Error' };
52
+ console.error('HTTP isteği başarısız oldu:', error);
53
+ return { status: 500, error: 'Sunucu İç Hatası' };
54
54
  }
55
55
  });
56
56
  /**
57
- * Makes a GET request.
57
+ * GET isteği yapar.
58
58
  * @template T
59
- * @param {string} url - Endpoint URL.
60
- * @param {RequestOptions} [options] - Request options.
61
- * @returns {Promise<IApiResponse<T>>} Response from the API.
59
+ * @param {string} url - Endpoint URL'si.
60
+ * @param {RequestOptions} [options] - İstek seçenekleri.
61
+ * @returns {Promise<IApiResponse<T>>} API'den gelen yanıt.
62
62
  */
63
63
  const get = (url, options) => __awaiter(void 0, void 0, void 0, function* () {
64
64
  return yield request(Object.assign(Object.assign({}, options), { method: __1.HTTPMethod.GET, url }));
65
65
  });
66
66
  /**
67
- * Makes a POST request.
67
+ * POST isteği yapar.
68
68
  * @template T
69
- * @param {string} url - Endpoint URL.
70
- * @param {any} data - Request payload.
71
- * @param {RequestOptions} [options] - Request options.
72
- * @returns {Promise<IApiResponse<T>>} Response from the API.
69
+ * @param {string} url - Endpoint URL'si.
70
+ * @param {any} data - İstek yükü.
71
+ * @param {RequestOptions} [options] - İstek seçenekleri.
72
+ * @returns {Promise<IApiResponse<T>>} API'den gelen yanıt.
73
73
  */
74
74
  const post = (url, data, options) => __awaiter(void 0, void 0, void 0, function* () {
75
75
  return yield request(Object.assign(Object.assign({}, options), { method: __1.HTTPMethod.POST, url, body: data }));
76
76
  });
77
77
  /**
78
- * Makes a PUT request.
78
+ * PUT isteği yapar.
79
79
  * @template T
80
- * @param {string} url - Endpoint URL.
81
- * @param {any} data - Request payload.
82
- * @param {RequestOptions} [options] - Request options.
83
- * @returns {Promise<IApiResponse<T>>} Response from the API.
80
+ * @param {string} url - Endpoint URL'si.
81
+ * @param {any} data - İstek yükü.
82
+ * @param {RequestOptions} [options] - İstek seçenekleri.
83
+ * @returns {Promise<IApiResponse<T>>} API'den gelen yanıt.
84
84
  */
85
85
  const put = (url, data, options) => __awaiter(void 0, void 0, void 0, function* () {
86
86
  return yield request(Object.assign(Object.assign({}, options), { method: __1.HTTPMethod.PUT, url, body: data }));
87
87
  });
88
88
  /**
89
- * Makes a DELETE request.
89
+ * DELETE isteği yapar.
90
90
  * @template T
91
- * @param {string} url - Endpoint URL.
92
- * @param {RequestOptions} [options] - Request options.
93
- * @returns {Promise<IApiResponse<T>>} Response from the API.
91
+ * @param {string} url - Endpoint URL'si.
92
+ * @param {RequestOptions} [options] - İstek seçenekleri.
93
+ * @returns {Promise<IApiResponse<T>>} API'den gelen yanıt.
94
94
  */
95
95
  const remove = (url, options) => __awaiter(void 0, void 0, void 0, function* () {
96
96
  return yield request(Object.assign(Object.assign({}, options), { method: __1.HTTPMethod.DELETE, url }));
@@ -1,82 +1,82 @@
1
1
  import { IResponse, IResponsePaging } from './response';
2
2
  /**
3
- * Interface representing a response containing multiple banners with pagination information.
4
- * Extends IResponsePaging to inherit properties related to response status and pagination.
3
+ * Sayfalama bilgileriyle birlikte birden fazla banner içeren yanıtı temsil eden arayüz.
4
+ * Yanıt durumu ve sayfalama ile ilgili özellikleri miras almak için IResponsePaging genişletir.
5
5
  */
6
6
  export interface IBannersResponse extends IResponsePaging {
7
7
  /**
8
- * An array of Banner objects representing the banners retrieved in the response.
8
+ * Yanıtta alınan bannerları temsil eden Banner nesnelerinin bir dizisi.
9
9
  */
10
10
  banners: Banner[];
11
11
  }
12
12
  /**
13
- * Interface representing a response containing a single banner.
14
- * Extends IResponse to inherit properties related to response status.
13
+ * Tek bir banner içeren yanıtı temsil eden arayüz.
14
+ * Yanıt durumu ile ilgili özellikleri miras almak için IResponse genişletir.
15
15
  */
16
16
  export interface IBannerResponse extends IResponse {
17
17
  /**
18
- * The Banner object representing the banner retrieved in the response.
18
+ * Yanıtta alınan bannerı temsil eden Banner nesnesi.
19
19
  */
20
20
  banner: Banner;
21
21
  }
22
22
  /**
23
- * Interface representing the structure of a banner object.
23
+ * Bir banner nesnesinin yapısını temsil eden arayüz.
24
24
  */
25
25
  interface Banner {
26
26
  /**
27
- * Unique identifier for the banner.
27
+ * Banner için benzersiz tanımlayıcı.
28
28
  */
29
29
  id: number;
30
30
  /**
31
- * Identifier for the tenant associated with the banner.
31
+ * Banner ile ilişkili kiracı için tanımlayıcı.
32
32
  */
33
33
  tenantId: string;
34
34
  /**
35
- * Identifier for the template used by the banner.
35
+ * Banner tarafından kullanılan şablon için tanımlayıcı.
36
36
  */
37
37
  templateId: number;
38
38
  /**
39
- * URL link to the banner image.
39
+ * Banner resmi için URL bağlantısı.
40
40
  */
41
41
  imageLink: string;
42
42
  /**
43
- * Key identifier for the banner.
43
+ * Banner için anahtar tanımlayıcı.
44
44
  */
45
45
  key: string;
46
46
  /**
47
- * Indicates whether the banner is approved.
47
+ * Bannerın onaylanıp onaylanmadığını gösterir.
48
48
  */
49
49
  isApproved: boolean;
50
50
  /**
51
- * Additional extension data associated with the banner.
51
+ * Banner ile ilişkili dynamic type verileri.
52
52
  */
53
53
  extensionData: Object;
54
54
  /**
55
- * Identifier for the content item associated with the banner.
55
+ * Banner ile ilişkili içerik öğesi için tanımlayıcı.
56
56
  */
57
57
  contentItemId: number;
58
58
  /**
59
- * Identifier for the content type of the banner.
59
+ * Bannerın içerik türü için tanımlayıcı.
60
60
  */
61
61
  contentTypeId: number;
62
62
  /**
63
- * External identifier for the banner.
63
+ * Banner için harici tanımlayıcı.
64
64
  */
65
65
  externalId: number;
66
66
  /**
67
- * Optional target URL link for the banner.
67
+ * Banner için hedef URL bağlantısı.
68
68
  */
69
- targetLink?: string;
69
+ targetLink: string;
70
70
  /**
71
- * Name or title of the banner.
71
+ * Bannerın adı veya başlığı.
72
72
  */
73
73
  name: string;
74
74
  /**
75
- * Optional description or details about the banner.
75
+ * Banner hakkında açıklama veya detaylar.
76
76
  */
77
- description?: string;
77
+ description: string;
78
78
  /**
79
- * Order or priority of the banner.
79
+ * Bannerın sırası veya önceliği.
80
80
  */
81
81
  order: number;
82
82
  }
@@ -0,0 +1,84 @@
1
+ import { IResponsePaging } from './response';
2
+ interface IBlogPost {
3
+ id: number;
4
+ templateId: number;
5
+ order: number;
6
+ culture: string;
7
+ name: string;
8
+ key: string;
9
+ description: string;
10
+ targetLink: string;
11
+ imageLink: string;
12
+ isApproved: boolean;
13
+ extensionData: Object;
14
+ updatedAtUtc: string;
15
+ updatedBy: number;
16
+ createdAtUtc: string;
17
+ customDateUtc: string;
18
+ createdBy: number;
19
+ blogPostBlogCategoryMappings: BlogPostBlogCategoryMapping[];
20
+ blogPostBlogTagMappings: BlogPostBlogTagMapping[];
21
+ }
22
+ interface IBlogCategory {
23
+ id: number;
24
+ templateId: number;
25
+ parentId: number;
26
+ order: number;
27
+ culture: string;
28
+ name: string;
29
+ key: string;
30
+ description: string;
31
+ className: string;
32
+ keys: string;
33
+ hierarchyField: string;
34
+ path: string;
35
+ hierarchy: number[];
36
+ blogPostBlogCategoryMappings: BlogPostBlogCategoryMapping[];
37
+ extensionData: Object;
38
+ }
39
+ interface IBlogTag {
40
+ id: number;
41
+ name: string;
42
+ culture: string;
43
+ isApproved: boolean;
44
+ tenantId: string;
45
+ updatedAtUtc: string;
46
+ updatedBy: number;
47
+ createdAtUtc: string;
48
+ createdBy: number;
49
+ blogPostBlogTagMappings: BlogPostBlogTagMapping[];
50
+ }
51
+ interface IFacet {
52
+ name: string;
53
+ count: number;
54
+ externalData: Object;
55
+ constraints: IConstraint[];
56
+ }
57
+ interface IConstraint {
58
+ key: string;
59
+ count: number;
60
+ keyAsString: string;
61
+ externalData: Object;
62
+ }
63
+ interface BlogPostBlogTagMapping {
64
+ id: number;
65
+ blogTagId: number;
66
+ blogPostId: number;
67
+ isApproved: boolean;
68
+ }
69
+ interface BlogPostBlogCategoryMapping {
70
+ id: number;
71
+ blogPostId: number;
72
+ blogCategoryId: number;
73
+ hierarchyField: string;
74
+ hierarchy: number[];
75
+ isDefault: boolean;
76
+ isApproved: boolean;
77
+ }
78
+ export interface IBlogPostsResponse extends IResponsePaging {
79
+ blogPosts: IBlogPost[];
80
+ categories: IBlogCategory[];
81
+ blogTags: IBlogTag[];
82
+ facets: IFacet[];
83
+ }
84
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
1
  export * from './elements';
2
- export * from './banner';
3
2
  export * from './response';
3
+ export * from './banner';
4
+ export * from './blog';
@@ -16,5 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /// interfaces
18
18
  __exportStar(require("./elements"), exports);
19
- __exportStar(require("./banner"), exports);
20
19
  __exportStar(require("./response"), exports);
20
+ __exportStar(require("./banner"), exports);
21
+ __exportStar(require("./blog"), exports);
@@ -20,7 +20,7 @@ export interface RequestOptions extends RequestInit {
20
20
  */
21
21
  params?: Record<string, any>;
22
22
  /**
23
- * 'language' alanı endpoint içerisinde geçen zorunlu culture kodu gönderilmelidir.
23
+ * Bu alan istek yapılan url'deki culture kodu içermelidir. örnek: "tr", "en"
24
24
  */
25
25
  language: string;
26
26
  }
@@ -2,28 +2,28 @@ import { IApiResponse, IBannerResponse, IBannersResponse, RequestOptions } from
2
2
  /**
3
3
  * BannerService arayüzü, banner verilerini almak için kullanılabilecek metodları tanımlar.
4
4
  */
5
- interface BannerService {
5
+ export interface IBannerService {
6
6
  /**
7
7
  * Verilen ID'ye sahip banner'ı getirir.
8
- * @param options - RequestOptions'dan 'url' ve 'method' çıkarılmış hali.
8
+ * @param options - RequestOptions'dan 'url' ve 'method' çıkarılmış hali, 'language' parametresi zorunludur.
9
9
  * @returns IBannerResponse tipinde bir API yanıtı.
10
10
  */
11
11
  GetBannerById: (options: Omit<RequestOptions, 'url' | 'method'>) => Promise<IApiResponse<IBannerResponse>>;
12
12
  /**
13
13
  * Verilen isme sahip banner'ı getirir.
14
- * @param options - RequestOptions'dan 'url' ve 'method' çıkarılmış hali.
14
+ * @param options - RequestOptions'dan 'url' ve 'method' çıkarılmış hali, 'language' parametresi zorunludur.
15
15
  * @returns IBannerResponse tipinde bir API yanıtı.
16
16
  */
17
17
  GetBannerByName: (options: Omit<RequestOptions, 'url' | 'method'>) => Promise<IApiResponse<IBannerResponse>>;
18
18
  /**
19
19
  * Verilen anahtara sahip banner'ı getirir.
20
- * @param options - RequestOptions'dan 'url' ve 'method' çıkarılmış hali.
20
+ * @param options - RequestOptions'dan 'url' ve 'method' çıkarılmış hali, 'language' parametresi zorunludur.
21
21
  * @returns IBannerResponse tipinde bir API yanıtı.
22
22
  */
23
23
  GetBannerByKey: (options: Omit<RequestOptions, 'url' | 'method'>) => Promise<IApiResponse<IBannerResponse>>;
24
24
  /**
25
25
  * Tüm banner'ların listesini getirir.
26
- * @param options - RequestOptions'dan 'url' ve 'method' çıkarılmış hali.
26
+ * @param options - RequestOptions'dan 'url' ve 'method' çıkarılmış hali, 'language' parametresi zorunludur.
27
27
  * @returns IBannersResponse tipinde bir API yanıtı.
28
28
  */
29
29
  GetBannerList: (options: Omit<RequestOptions, 'url' | 'method'>) => Promise<IApiResponse<IBannersResponse>>;
@@ -31,5 +31,4 @@ interface BannerService {
31
31
  /**
32
32
  * BannerService, banner verilerini almak için çeşitli metodları sağlar.
33
33
  */
34
- export declare const BannerService: BannerService;
35
- export {};
34
+ export declare const BannerService: IBannerService;
@@ -0,0 +1,17 @@
1
+ import { IApiResponse, IBlogPostsResponse, RequestOptions } from '../';
2
+ /**
3
+ * Blog servisinin sunduğu API isteklerini tanımlar.
4
+ */
5
+ export interface IBlogService {
6
+ /**
7
+ * Blog yazılarını almak için kullanılan istek.
8
+ *
9
+ * @param options - İstek yapılandırma seçenekleri. `url` ve `method` dışındaki seçenekleri içerir.
10
+ * @returns Blog yazıları yanıtını içeren bir promise.
11
+ */
12
+ GetBlogPostsRequest: (options: Omit<RequestOptions, 'url' | 'method'>) => Promise<IApiResponse<IBlogPostsResponse>>;
13
+ }
14
+ /**
15
+ * Blog servisi implementasyonu.
16
+ */
17
+ export declare const BlogService: IBlogService;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.BlogService = void 0;
16
+ // URL'lerin bulunduğu dosyayı içe aktarır
17
+ const urls_1 = __importDefault(require("./urls"));
18
+ const __1 = require("../");
19
+ /**
20
+ * Blog servisi implementasyonu.
21
+ */
22
+ exports.BlogService = {
23
+ /**
24
+ * Blog yazılarını almak için kullanılan istek.
25
+ *
26
+ * @param options - İstek yapılandırma seçenekleri. `url` ve `method` dışındaki seçenekleri içerir.
27
+ * @returns Blog yazıları yanıtını içeren bir promise.
28
+ */
29
+ GetBlogPostsRequest: (options) => __awaiter(void 0, void 0, void 0, function* () {
30
+ return yield (0, __1.fetchRequest)().get(urls_1.default.Blog.GetBlogPostsRequest.replace(/{language}/g, options.language), options);
31
+ }),
32
+ };
@@ -1 +1,4 @@
1
- export * from './banner';
1
+ export declare const Service: {
2
+ Banner: import("./banner").IBannerService;
3
+ Blog: import("./blog").IBlogService;
4
+ };
@@ -1,18 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Service = void 0;
17
4
  // services
18
- __exportStar(require("./banner"), exports);
5
+ const banner_1 = require("./banner");
6
+ const blog_1 = require("./blog");
7
+ exports.Service = {
8
+ Banner: banner_1.BannerService,
9
+ Blog: blog_1.BlogService,
10
+ };
@@ -6,5 +6,8 @@ declare const _default: {
6
6
  GetBannerList: string;
7
7
  GetBannerContainerList: string;
8
8
  };
9
+ Blog: {
10
+ GetBlogPostsRequest: string;
11
+ };
9
12
  };
10
13
  export default _default;
@@ -8,5 +8,8 @@ exports.default = {
8
8
  GetBannerByKey: API_URL + '/api/banner/{language}/Banner/v1/GetBannerByKey',
9
9
  GetBannerList: API_URL + '/api/banner/{language}/Banner/v1/GetBannerList',
10
10
  GetBannerContainerList: API_URL + '/api/banner/{language}/Banner/v1/GetBannerContainerList',
11
+ },
12
+ Blog: {
13
+ GetBlogPostsRequest: API_URL + '/api/blog/{language}/Blog/v1/GetBlogPostsRequest',
11
14
  }
12
15
  };
package/dist/test.js CHANGED
@@ -2,9 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const services_1 = require("./services");
4
4
  function test() {
5
- const res = services_1.BannerService.GetBannerById({
6
- language: 'tr'
7
- });
5
+ const res = services_1.Service.Banner.GetBannerById({ language: 'tr' });
8
6
  return;
9
7
  }
10
8
  exports.default = test;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",