From e88f5090cf4d98c64f00c3b4cdef4d972a5c114c Mon Sep 17 00:00:00 2001 From: Sonu Sharma Date: Sat, 27 Apr 2024 16:03:04 +0530 Subject: [PATCH] Sync with dub api --- .openapi-generator/FILES | 3 - CHANGELOG.md | 5 + README.md | 7 - doc/EditLinkRequest.md | 36 -- doc/LinksApi.md | 36 +- example/lib/help-page.dart | 1 - example/lib/my-short-links.dart | 1 - example/lib/widget/create_link_card.dart | 2 +- lib/dub.dart | 1 - lib/src/api/analytics_api.dart | 114 ++----- lib/src/api/domains_api.dart | 94 ++---- lib/src/api/links_api.dart | 23 +- lib/src/api/workspaces_api.dart | 43 +-- lib/src/deserialize.dart | 3 - lib/src/model/edit_link_request.dart | 413 ----------------------- lib/src/model/edit_link_request.g.dart | 85 ----- openapi.json | 35 +- test/edit_link_request_test.dart | 142 -------- test/links_api_test.dart | 8 +- 19 files changed, 151 insertions(+), 901 deletions(-) delete mode 100644 doc/EditLinkRequest.md delete mode 100644 lib/src/model/edit_link_request.dart delete mode 100644 lib/src/model/edit_link_request.g.dart delete mode 100644 test/edit_link_request_test.dart diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 29cbf69..295880f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -13,7 +13,6 @@ doc/DeleteLink200Response.md doc/DomainSchema.md doc/DomainsApi.md doc/EditDomainRequest.md -doc/EditLinkRequest.md doc/GetBrowserAnalytics200ResponseInner.md doc/GetCityAnalytics200ResponseInner.md doc/GetCountryAnalytics200ResponseInner.md @@ -78,7 +77,6 @@ lib/src/model/delete_domain200_response.dart lib/src/model/delete_link200_response.dart lib/src/model/domain_schema.dart lib/src/model/edit_domain_request.dart -lib/src/model/edit_link_request.dart lib/src/model/get_browser_analytics200_response_inner.dart lib/src/model/get_city_analytics200_response_inner.dart lib/src/model/get_country_analytics200_response_inner.dart @@ -126,7 +124,6 @@ test/delete_link200_response_test.dart test/domain_schema_test.dart test/domains_api_test.dart test/edit_domain_request_test.dart -test/edit_link_request_test.dart test/get_browser_analytics200_response_inner_test.dart test/get_city_analytics200_response_inner_test.dart test/get_country_analytics200_response_inner_test.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 5707b4d..5899d16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ ## 0.0.1 - Initial version of dub package + +## 0.0.2 + +- Added example usage +- Synced with latest version of `dub` api diff --git a/README.md b/README.md index f09134c..4d7baa4 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,6 @@ Dub is link management infrastructure for companies to create marketing campaign For more information, please visit [https://dub.co/api](https://dub.co/api) -## Requirements - -- Dart 2.15.0+ or Flutter 2.8.0+ -- Dio 5.0.0+ (https://pub.dev/packages/dio) -- JSON Serializable 6.1.5+ (https://pub.dev/packages/json_serializable) - ## Installation & Usage ### pub.dev @@ -129,7 +123,6 @@ All URIs are relative to *https://api.dub.co* - [DeleteLink200Response](doc/DeleteLink200Response.md) - [DomainSchema](doc/DomainSchema.md) - [EditDomainRequest](doc/EditDomainRequest.md) -- [EditLinkRequest](doc/EditLinkRequest.md) - [GetBrowserAnalytics200ResponseInner](doc/GetBrowserAnalytics200ResponseInner.md) - [GetCityAnalytics200ResponseInner](doc/GetCityAnalytics200ResponseInner.md) - [GetCountryAnalytics200ResponseInner](doc/GetCountryAnalytics200ResponseInner.md) diff --git a/doc/EditLinkRequest.md b/doc/EditLinkRequest.md deleted file mode 100644 index 007bc54..0000000 --- a/doc/EditLinkRequest.md +++ /dev/null @@ -1,36 +0,0 @@ -# dub.model.EditLinkRequest - -## Load the model package -```dart -import 'package:dub/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**url** | **String** | The destination URL of the short link. | -**domain** | **String** | The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains). | [optional] -**key** | **String** | The short link slug. If not provided, a random 7-character slug will be generated. | [optional] -**externalId** | **String** | This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with `ext_` when passed as a query parameter. | [optional] -**prefix** | **String** | The prefix of the short link slug for randomly-generated keys (e.g. if prefix is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if `key` is provided. | [optional] -**archived** | **bool** | Whether the short link is archived. | [optional] [default to false] -**publicStats** | **bool** | Whether the short link's stats are publicly accessible. | [optional] [default to false] -**tagId** | **String** | The unique ID of the tag assigned to the short link. This field is deprecated – use `tagIds` instead. | [optional] -**tagIds** | **List<String>** | The unique IDs of the tags assigned to the short link. | [optional] -**tagNames** | **String** | The unique name of the tags assigned to the short link (case insensitive). | [optional] -**comments** | **String** | The comments for the short link. | [optional] -**expiresAt** | **String** | The date and time when the short link will expire at. | [optional] -**expiredUrl** | **String** | The URL to redirect to when the short link has expired. | [optional] -**password** | **String** | The password required to access the destination URL of the short link. | [optional] -**proxy** | **bool** | Whether the short link uses Custom Social Media Cards feature. | [optional] [default to false] -**title** | **String** | The title of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. | [optional] -**description** | **String** | The description of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. | [optional] -**image** | **String** | The image of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. | [optional] -**rewrite** | **bool** | Whether the short link uses link cloaking. | [optional] [default to false] -**ios** | **String** | The iOS destination URL for the short link for iOS device targeting. | [optional] -**android** | **String** | The Android destination URL for the short link for Android device targeting. | [optional] -**geo** | [**CreateLinkRequestGeo**](CreateLinkRequestGeo.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/doc/LinksApi.md b/doc/LinksApi.md index c8b70e8..50c736e 100644 --- a/doc/LinksApi.md +++ b/doc/LinksApi.md @@ -19,7 +19,7 @@ Method | HTTP request | Description # **bulkCreateLinks** -> List bulkCreateLinks(workspaceId, projectSlug, editLinkRequest) +> List bulkCreateLinks(workspaceId, projectSlug, createLinkRequest) Bulk create links @@ -32,10 +32,10 @@ import 'package:dub/api.dart'; final api = Dub().getLinksApi(); final String workspaceId = ws_cluuwcv0r...; // String | The ID of the workspace. final String projectSlug = projectSlug_example; // String | The slug of the project. This field is deprecated – use `workspaceId` instead. -final List editLinkRequest = ; // List | +final List createLinkRequest = ; // List | try { - final response = api.bulkCreateLinks(workspaceId, projectSlug, editLinkRequest); + final response = api.bulkCreateLinks(workspaceId, projectSlug, createLinkRequest); print(response); } catch on DioException (e) { print('Exception when calling LinksApi->bulkCreateLinks: $e\n'); @@ -48,7 +48,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **workspaceId** | **String**| The ID of the workspace. | **projectSlug** | **String**| The slug of the project. This field is deprecated – use `workspaceId` instead. | [optional] - **editLinkRequest** | [**List<EditLinkRequest>**](EditLinkRequest.md)| | [optional] + **createLinkRequest** | [**List<CreateLinkRequest>**](CreateLinkRequest.md)| | [optional] ### Return type @@ -160,7 +160,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **editLink** -> LinkSchema editLink(linkId, workspaceId, projectSlug, editLinkRequest) +> LinkSchema editLink(linkId, workspaceId, projectSlug, createLinkRequest) Edit a link @@ -174,10 +174,10 @@ final api = Dub().getLinksApi(); final String linkId = linkId_example; // String | The id of the link to edit. You may use either `linkId` (obtained via `/links/info` endpoint) or `externalId` prefixed with `ext_`. final String workspaceId = ws_cluuwcv0r...; // String | The ID of the workspace. final String projectSlug = projectSlug_example; // String | The slug of the project. This field is deprecated – use `workspaceId` instead. -final EditLinkRequest editLinkRequest = ; // EditLinkRequest | +final CreateLinkRequest createLinkRequest = ; // CreateLinkRequest | try { - final response = api.editLink(linkId, workspaceId, projectSlug, editLinkRequest); + final response = api.editLink(linkId, workspaceId, projectSlug, createLinkRequest); print(response); } catch on DioException (e) { print('Exception when calling LinksApi->editLink: $e\n'); @@ -191,7 +191,7 @@ Name | Type | Description | Notes **linkId** | **String**| The id of the link to edit. You may use either `linkId` (obtained via `/links/info` endpoint) or `externalId` prefixed with `ext_`. | **workspaceId** | **String**| The ID of the workspace. | **projectSlug** | **String**| The slug of the project. This field is deprecated – use `workspaceId` instead. | [optional] - **editLinkRequest** | [**EditLinkRequest**](EditLinkRequest.md)| | [optional] + **createLinkRequest** | [**CreateLinkRequest**](CreateLinkRequest.md)| | [optional] ### Return type @@ -273,8 +273,8 @@ final String workspaceId = ws_cluuwcv0r...; // String | The ID of the workspace. final String projectSlug = projectSlug_example; // String | The slug of the project. This field is deprecated – use `workspaceId` instead. final String domain = domain_example; // String | The domain to filter the links by. E.g. `ac.me`. If not provided, all links for the workspace will be returned. final String tagId = tagId_example; // String | The tag ID to filter the links by. This field is deprecated – use `tagIds` instead. -final String tagIds = tagIds_example; // String | The tag IDs to filter the links by. -final String tagNames = tagNames_example; // String | The unique name of the tags assigned to the short link (case insensitive). +final List tagIds = ; // List | The tag IDs to filter the links by. +final List tagNames = ; // List | The unique name of the tags assigned to the short link (case insensitive). final String search = search_example; // String | The search term to filter the links by. The search term will be matched against the short link slug and the destination url. final String userId = userId_example; // String | The user ID to filter the links by. final bool showArchived = true; // bool | Whether to include archived links in the response. Defaults to `false` if not provided. @@ -298,8 +298,8 @@ Name | Type | Description | Notes **projectSlug** | **String**| The slug of the project. This field is deprecated – use `workspaceId` instead. | [optional] **domain** | **String**| The domain to filter the links by. E.g. `ac.me`. If not provided, all links for the workspace will be returned. | [optional] **tagId** | **String**| The tag ID to filter the links by. This field is deprecated – use `tagIds` instead. | [optional] - **tagIds** | **String**| The tag IDs to filter the links by. | [optional] - **tagNames** | **String**| The unique name of the tags assigned to the short link (case insensitive). | [optional] + **tagIds** | [**List<String>**](String.md)| The tag IDs to filter the links by. | [optional] + **tagNames** | [**List<String>**](String.md)| The unique name of the tags assigned to the short link (case insensitive). | [optional] **search** | **String**| The search term to filter the links by. The search term will be matched against the short link slug and the destination url. | [optional] **userId** | **String**| The user ID to filter the links by. | [optional] **showArchived** | **bool**| Whether to include archived links in the response. Defaults to `false` if not provided. | [optional] [default to false] @@ -338,13 +338,13 @@ final String workspaceId = ws_cluuwcv0r...; // String | The ID of the workspace. final String projectSlug = projectSlug_example; // String | The slug of the project. This field is deprecated – use `workspaceId` instead. final String domain = domain_example; // String | The domain to filter the links by. E.g. `ac.me`. If not provided, all links for the workspace will be returned. final String tagId = tagId_example; // String | The tag ID to filter the links by. This field is deprecated – use `tagIds` instead. -final String tagIds = tagIds_example; // String | The tag IDs to filter the links by. -final String tagNames = tagNames_example; // String | The unique name of the tags assigned to the short link (case insensitive). +final List tagIds = ; // List | The tag IDs to filter the links by. +final List tagNames = ; // List | The unique name of the tags assigned to the short link (case insensitive). final String search = search_example; // String | The search term to filter the links by. The search term will be matched against the short link slug and the destination url. final String userId = userId_example; // String | The user ID to filter the links by. final bool showArchived = true; // bool | Whether to include archived links in the response. Defaults to `false` if not provided. final bool withTags = true; // bool | Whether to include tags in the response. Defaults to `false` if not provided. -final String groupBy = groupBy_example; // String | The field to group the links by. +final List groupBy = ; // List | The field to group the links by. try { final response = api.getLinksCount(workspaceId, projectSlug, domain, tagId, tagIds, tagNames, search, userId, showArchived, withTags, groupBy); @@ -362,13 +362,13 @@ Name | Type | Description | Notes **projectSlug** | **String**| The slug of the project. This field is deprecated – use `workspaceId` instead. | [optional] **domain** | **String**| The domain to filter the links by. E.g. `ac.me`. If not provided, all links for the workspace will be returned. | [optional] **tagId** | **String**| The tag ID to filter the links by. This field is deprecated – use `tagIds` instead. | [optional] - **tagIds** | **String**| The tag IDs to filter the links by. | [optional] - **tagNames** | **String**| The unique name of the tags assigned to the short link (case insensitive). | [optional] + **tagIds** | [**List<String>**](String.md)| The tag IDs to filter the links by. | [optional] + **tagNames** | [**List<String>**](String.md)| The unique name of the tags assigned to the short link (case insensitive). | [optional] **search** | **String**| The search term to filter the links by. The search term will be matched against the short link slug and the destination url. | [optional] **userId** | **String**| The user ID to filter the links by. | [optional] **showArchived** | **bool**| Whether to include archived links in the response. Defaults to `false` if not provided. | [optional] [default to false] **withTags** | **bool**| Whether to include tags in the response. Defaults to `false` if not provided. | [optional] [default to false] - **groupBy** | **String**| The field to group the links by. | [optional] + **groupBy** | [**List<String>**](String.md)| The field to group the links by. | [optional] ### Return type diff --git a/example/lib/help-page.dart b/example/lib/help-page.dart index 02ac537..cb2b176 100644 --- a/example/lib/help-page.dart +++ b/example/lib/help-page.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class HelpPage extends StatelessWidget { const HelpPage({super.key}); diff --git a/example/lib/my-short-links.dart b/example/lib/my-short-links.dart index 9978d17..5ba2d51 100644 --- a/example/lib/my-short-links.dart +++ b/example/lib/my-short-links.dart @@ -8,7 +8,6 @@ import 'package:example/widget/link-detail-card.dart'; import 'package:example/widget/title_action_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'package:url_launcher/url_launcher.dart'; class MyShortLinks extends StatefulWidget { diff --git a/example/lib/widget/create_link_card.dart b/example/lib/widget/create_link_card.dart index 1238ef7..ec7b8a8 100644 --- a/example/lib/widget/create_link_card.dart +++ b/example/lib/widget/create_link_card.dart @@ -267,7 +267,7 @@ class _CreateLinkCArdState extends State { onPressed: () { if (link?.shortLink != null) { Clipboard.setData( - ClipboardData(text: link!.shortLink!)); + ClipboardData(text: link!.shortLink)); ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Copied to clipboard'), diff --git a/lib/dub.dart b/lib/dub.dart index 758c421..a6cb3fb 100644 --- a/lib/dub.dart +++ b/lib/dub.dart @@ -25,7 +25,6 @@ export 'package:dub/src/model/delete_domain200_response.dart'; export 'package:dub/src/model/delete_link200_response.dart'; export 'package:dub/src/model/domain_schema.dart'; export 'package:dub/src/model/edit_domain_request.dart'; -export 'package:dub/src/model/edit_link_request.dart'; export 'package:dub/src/model/get_browser_analytics200_response_inner.dart'; export 'package:dub/src/model/get_city_analytics200_response_inner.dart'; export 'package:dub/src/model/get_country_analytics200_response_inner.dart'; diff --git a/lib/src/api/analytics_api.dart b/lib/src/api/analytics_api.dart index cf07b06..569fdca 100644 --- a/lib/src/api/analytics_api.dart +++ b/lib/src/api/analytics_api.dart @@ -20,6 +20,7 @@ import 'package:dub/src/model/get_top_links200_response_inner.dart'; import 'package:dub/src/model/get_top_urls200_response_inner.dart'; class AnalyticsApi { + final Dio _dio; const AnalyticsApi(this._dio); @@ -54,8 +55,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> - getBrowserAnalytics({ + Future>> getBrowserAnalytics({ required String workspaceId, String? projectSlug, String? domain, @@ -131,13 +131,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetBrowserAnalytics200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetBrowserAnalytics200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -190,7 +185,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> getCityAnalytics({ + Future>> getCityAnalytics({ required String workspaceId, String? projectSlug, String? domain, @@ -266,13 +261,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetCityAnalytics200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetCityAnalytics200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -325,7 +315,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [num] as data /// Throws [DioException] if API call or serialization fails - Future> getClicksAnalytics({ + Future> getClicksAnalytics({ required String workspaceId, String? projectSlug, String? domain, @@ -401,10 +391,8 @@ class AnalyticsApi { num? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize(rawData, 'num', growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'num', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -457,8 +445,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> - getCountryAnalytics({ + Future>> getCountryAnalytics({ required String workspaceId, String? projectSlug, String? domain, @@ -534,13 +521,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetCountryAnalytics200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetCountryAnalytics200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -593,8 +575,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> - getDeviceAnalytics({ + Future>> getDeviceAnalytics({ required String workspaceId, String? projectSlug, String? domain, @@ -670,13 +651,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetDeviceAnalytics200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetDeviceAnalytics200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -729,7 +705,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> getOSAnalytics({ + Future>> getOSAnalytics({ required String workspaceId, String? projectSlug, String? domain, @@ -805,13 +781,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetOSAnalytics200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetOSAnalytics200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -864,8 +835,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> - getRefererAnalytics({ + Future>> getRefererAnalytics({ required String workspaceId, String? projectSlug, String? domain, @@ -941,13 +911,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetRefererAnalytics200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetRefererAnalytics200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -1000,8 +965,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> - getTimeseriesAnalytics({ + Future>> getTimeseriesAnalytics({ required String workspaceId, String? projectSlug, String? domain, @@ -1077,13 +1041,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetTimeseriesAnalytics200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetTimeseriesAnalytics200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -1136,7 +1095,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> getTopLinks({ + Future>> getTopLinks({ required String workspaceId, String? projectSlug, String? domain, @@ -1212,13 +1171,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetTopLinks200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetTopLinks200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -1271,7 +1225,7 @@ class AnalyticsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> getTopURLs({ + Future>> getTopURLs({ required String workspaceId, String? projectSlug, String? domain, @@ -1347,13 +1301,8 @@ class AnalyticsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, - GetTopURLs200ResponseInner>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, GetTopURLs200ResponseInner>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -1375,4 +1324,5 @@ class AnalyticsApi { extra: _response.extra, ); } + } diff --git a/lib/src/api/domains_api.dart b/lib/src/api/domains_api.dart index 1845546..b2d49ac 100644 --- a/lib/src/api/domains_api.dart +++ b/lib/src/api/domains_api.dart @@ -16,6 +16,7 @@ import 'package:dub/src/model/edit_domain_request.dart'; import 'package:dub/src/model/transfer_domain_request.dart'; class DomainsApi { + final Dio _dio; const DomainsApi(this._dio); @@ -26,7 +27,7 @@ class DomainsApi { /// Parameters: /// * [workspaceId] - The ID of the workspace. /// * [projectSlug] - The slug of the project. This field is deprecated – use `workspaceId` instead. - /// * [addDomainRequest] + /// * [addDomainRequest] /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request @@ -36,7 +37,7 @@ class DomainsApi { /// /// Returns a [Future] containing a [Response] with a [DomainSchema] as data /// Throws [DioException] if API call or serialization fails - Future> addDomain({ + Future> addDomain({ required String workspaceId, String? projectSlug, AddDomainRequest? addDomainRequest, @@ -75,10 +76,10 @@ class DomainsApi { dynamic _bodyData; try { - _bodyData = jsonEncode(addDomainRequest); - } catch (error, stackTrace) { +_bodyData=jsonEncode(addDomainRequest); + } catch(error, stackTrace) { throw DioException( - requestOptions: _options.compose( + requestOptions: _options.compose( _dio.options, _path, queryParameters: _queryParameters, @@ -102,11 +103,8 @@ class DomainsApi { DomainSchema? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize(rawData, 'DomainSchema', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'DomainSchema', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -145,7 +143,7 @@ class DomainsApi { /// /// Returns a [Future] containing a [Response] with a [DeleteDomain200Response] as data /// Throws [DioException] if API call or serialization fails - Future> deleteDomain({ + Future> deleteDomain({ required String slug, required String workspaceId, String? projectSlug, @@ -156,8 +154,7 @@ class DomainsApi { ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { - final _path = - r'/domains/{slug}'.replaceAll('{' r'slug' '}', slug.toString()); + final _path = r'/domains/{slug}'.replaceAll('{' r'slug' '}', slug.toString()); final _options = Options( method: r'DELETE', headers: { @@ -193,12 +190,8 @@ class DomainsApi { DeleteDomain200Response? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize( - rawData, 'DeleteDomain200Response', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'DeleteDomain200Response', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -228,7 +221,7 @@ class DomainsApi { /// * [slug] - The domain name. /// * [workspaceId] - The ID of the workspace. /// * [projectSlug] - The slug of the project. This field is deprecated – use `workspaceId` instead. - /// * [editDomainRequest] + /// * [editDomainRequest] /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request @@ -238,7 +231,7 @@ class DomainsApi { /// /// Returns a [Future] containing a [Response] with a [DomainSchema] as data /// Throws [DioException] if API call or serialization fails - Future> editDomain({ + Future> editDomain({ required String slug, required String workspaceId, String? projectSlug, @@ -250,8 +243,7 @@ class DomainsApi { ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { - final _path = - r'/domains/{slug}'.replaceAll('{' r'slug' '}', slug.toString()); + final _path = r'/domains/{slug}'.replaceAll('{' r'slug' '}', slug.toString()); final _options = Options( method: r'PATCH', headers: { @@ -279,10 +271,10 @@ class DomainsApi { dynamic _bodyData; try { - _bodyData = jsonEncode(editDomainRequest); - } catch (error, stackTrace) { +_bodyData=jsonEncode(editDomainRequest); + } catch(error, stackTrace) { throw DioException( - requestOptions: _options.compose( + requestOptions: _options.compose( _dio.options, _path, queryParameters: _queryParameters, @@ -306,11 +298,8 @@ class DomainsApi { DomainSchema? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize(rawData, 'DomainSchema', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'DomainSchema', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -348,7 +337,7 @@ class DomainsApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> listDomains({ + Future>> listDomains({ required String workspaceId, String? projectSlug, CancelToken? cancelToken, @@ -394,12 +383,8 @@ class DomainsApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, DomainSchema>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, DomainSchema>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -438,7 +423,7 @@ class DomainsApi { /// /// Returns a [Future] containing a [Response] with a [DomainSchema] as data /// Throws [DioException] if API call or serialization fails - Future> setPrimaryDomain({ + Future> setPrimaryDomain({ required String slug, required String workspaceId, String? projectSlug, @@ -449,8 +434,7 @@ class DomainsApi { ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { - final _path = - r'/domains/{slug}/primary'.replaceAll('{' r'slug' '}', slug.toString()); + final _path = r'/domains/{slug}/primary'.replaceAll('{' r'slug' '}', slug.toString()); final _options = Options( method: r'POST', headers: { @@ -486,11 +470,8 @@ class DomainsApi { DomainSchema? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize(rawData, 'DomainSchema', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'DomainSchema', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -520,7 +501,7 @@ class DomainsApi { /// * [slug] - The domain name. /// * [workspaceId] - The ID of the workspace. /// * [projectSlug] - The slug of the project. This field is deprecated – use `workspaceId` instead. - /// * [transferDomainRequest] + /// * [transferDomainRequest] /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request @@ -530,7 +511,7 @@ class DomainsApi { /// /// Returns a [Future] containing a [Response] with a [DomainSchema] as data /// Throws [DioException] if API call or serialization fails - Future> transferDomain({ + Future> transferDomain({ required String slug, required String workspaceId, String? projectSlug, @@ -542,8 +523,7 @@ class DomainsApi { ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { - final _path = r'/domains/{slug}/transfer' - .replaceAll('{' r'slug' '}', slug.toString()); + final _path = r'/domains/{slug}/transfer'.replaceAll('{' r'slug' '}', slug.toString()); final _options = Options( method: r'POST', headers: { @@ -571,10 +551,10 @@ class DomainsApi { dynamic _bodyData; try { - _bodyData = jsonEncode(transferDomainRequest); - } catch (error, stackTrace) { +_bodyData=jsonEncode(transferDomainRequest); + } catch(error, stackTrace) { throw DioException( - requestOptions: _options.compose( + requestOptions: _options.compose( _dio.options, _path, queryParameters: _queryParameters, @@ -598,11 +578,8 @@ class DomainsApi { DomainSchema? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize(rawData, 'DomainSchema', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'DomainSchema', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -624,4 +601,5 @@ class DomainsApi { extra: _response.extra, ); } + } diff --git a/lib/src/api/links_api.dart b/lib/src/api/links_api.dart index 3311935..6100b48 100644 --- a/lib/src/api/links_api.dart +++ b/lib/src/api/links_api.dart @@ -11,7 +11,6 @@ import 'package:dio/dio.dart'; import 'package:dub/src/model/create_link_request.dart'; import 'package:dub/src/model/delete_link200_response.dart'; -import 'package:dub/src/model/edit_link_request.dart'; import 'package:dub/src/model/link_schema.dart'; class LinksApi { @@ -25,7 +24,7 @@ class LinksApi { /// Parameters: /// * [workspaceId] - The ID of the workspace. /// * [projectSlug] - The slug of the project. This field is deprecated – use `workspaceId` instead. - /// * [editLinkRequest] + /// * [createLinkRequest] /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request @@ -38,7 +37,7 @@ class LinksApi { Future>> bulkCreateLinks({ required String workspaceId, String? projectSlug, - List? editLinkRequest, + List? createLinkRequest, CancelToken? cancelToken, Map? headers, Map? extra, @@ -74,7 +73,7 @@ class LinksApi { dynamic _bodyData; try { - _bodyData = jsonEncode(editLinkRequest); + _bodyData = jsonEncode(createLinkRequest); } catch (error, stackTrace) { throw DioException( requestOptions: _options.compose( @@ -337,7 +336,7 @@ class LinksApi { /// * [linkId] - The id of the link to edit. You may use either `linkId` (obtained via `/links/info` endpoint) or `externalId` prefixed with `ext_`. /// * [workspaceId] - The ID of the workspace. /// * [projectSlug] - The slug of the project. This field is deprecated – use `workspaceId` instead. - /// * [editLinkRequest] + /// * [createLinkRequest] /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request @@ -351,7 +350,7 @@ class LinksApi { required String linkId, required String workspaceId, String? projectSlug, - EditLinkRequest? editLinkRequest, + CreateLinkRequest? createLinkRequest, CancelToken? cancelToken, Map? headers, Map? extra, @@ -388,7 +387,7 @@ class LinksApi { dynamic _bodyData; try { - _bodyData = jsonEncode(editLinkRequest); + _bodyData = jsonEncode(createLinkRequest); } catch (error, stackTrace) { throw DioException( requestOptions: _options.compose( @@ -566,8 +565,8 @@ class LinksApi { String? projectSlug, String? domain, String? tagId, - String? tagIds, - String? tagNames, + List? tagIds, + List? tagNames, String? search, String? userId, bool? showArchived = false, @@ -684,13 +683,13 @@ class LinksApi { String? projectSlug, String? domain, String? tagId, - String? tagIds, - String? tagNames, + List? tagIds, + List? tagNames, String? search, String? userId, bool? showArchived = false, bool? withTags = false, - String? groupBy, + List? groupBy, CancelToken? cancelToken, Map? headers, Map? extra, diff --git a/lib/src/api/workspaces_api.dart b/lib/src/api/workspaces_api.dart index dca5eb1..8b3be72 100644 --- a/lib/src/api/workspaces_api.dart +++ b/lib/src/api/workspaces_api.dart @@ -13,6 +13,7 @@ import 'package:dub/src/model/create_workspace_request.dart'; import 'package:dub/src/model/workspace_schema.dart'; class WorkspacesApi { + final Dio _dio; const WorkspacesApi(this._dio); @@ -21,7 +22,7 @@ class WorkspacesApi { /// Create a new workspace for the authenticated user. /// /// Parameters: - /// * [createWorkspaceRequest] + /// * [createWorkspaceRequest] /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request @@ -31,7 +32,7 @@ class WorkspacesApi { /// /// Returns a [Future] containing a [Response] with a [WorkspaceSchema] as data /// Throws [DioException] if API call or serialization fails - Future> createWorkspace({ + Future> createWorkspace({ CreateWorkspaceRequest? createWorkspaceRequest, CancelToken? cancelToken, Map? headers, @@ -63,10 +64,10 @@ class WorkspacesApi { dynamic _bodyData; try { - _bodyData = jsonEncode(createWorkspaceRequest); - } catch (error, stackTrace) { +_bodyData=jsonEncode(createWorkspaceRequest); + } catch(error, stackTrace) { throw DioException( - requestOptions: _options.compose( + requestOptions: _options.compose( _dio.options, _path, ), @@ -88,12 +89,8 @@ class WorkspacesApi { WorkspaceSchema? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize( - rawData, 'WorkspaceSchema', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'WorkspaceSchema', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -130,7 +127,7 @@ class WorkspacesApi { /// /// Returns a [Future] containing a [Response] with a [WorkspaceSchema] as data /// Throws [DioException] if API call or serialization fails - Future> getWorkspace({ + Future> getWorkspace({ required String idOrSlug, CancelToken? cancelToken, Map? headers, @@ -139,8 +136,7 @@ class WorkspacesApi { ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { - final _path = r'/workspaces/{idOrSlug}' - .replaceAll('{' r'idOrSlug' '}', idOrSlug.toString()); + final _path = r'/workspaces/{idOrSlug}'.replaceAll('{' r'idOrSlug' '}', idOrSlug.toString()); final _options = Options( method: r'GET', headers: { @@ -170,12 +166,8 @@ class WorkspacesApi { WorkspaceSchema? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize( - rawData, 'WorkspaceSchema', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'WorkspaceSchema', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -211,7 +203,7 @@ class WorkspacesApi { /// /// Returns a [Future] containing a [Response] with a [List] as data /// Throws [DioException] if API call or serialization fails - Future>> getWorkspaces({ + Future>> getWorkspaces({ CancelToken? cancelToken, Map? headers, Map? extra, @@ -249,12 +241,8 @@ class WorkspacesApi { List? _responseData; try { - final rawData = _response.data; - _responseData = rawData == null - ? null - : deserialize, WorkspaceSchema>( - rawData, 'List', - growable: true); +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, WorkspaceSchema>(rawData, 'List', growable: true); } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -276,4 +264,5 @@ class WorkspacesApi { extra: _response.extra, ); } + } diff --git a/lib/src/deserialize.dart b/lib/src/deserialize.dart index 5b1a539..26f10f1 100644 --- a/lib/src/deserialize.dart +++ b/lib/src/deserialize.dart @@ -7,7 +7,6 @@ import 'package:dub/src/model/delete_domain200_response.dart'; import 'package:dub/src/model/delete_link200_response.dart'; import 'package:dub/src/model/domain_schema.dart'; import 'package:dub/src/model/edit_domain_request.dart'; -import 'package:dub/src/model/edit_link_request.dart'; import 'package:dub/src/model/get_browser_analytics200_response_inner.dart'; import 'package:dub/src/model/get_city_analytics200_response_inner.dart'; import 'package:dub/src/model/get_country_analytics200_response_inner.dart'; @@ -80,8 +79,6 @@ final _regMap = RegExp(r'^Map$'); return DomainSchema.fromJson(value as Map) as ReturnType; case 'EditDomainRequest': return EditDomainRequest.fromJson(value as Map) as ReturnType; - case 'EditLinkRequest': - return EditLinkRequest.fromJson(value as Map) as ReturnType; case 'GetBrowserAnalytics200ResponseInner': return GetBrowserAnalytics200ResponseInner.fromJson(value as Map) as ReturnType; case 'GetCityAnalytics200ResponseInner': diff --git a/lib/src/model/edit_link_request.dart b/lib/src/model/edit_link_request.dart deleted file mode 100644 index 4ac5037..0000000 --- a/lib/src/model/edit_link_request.dart +++ /dev/null @@ -1,413 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -// ignore_for_file: unused_element -import 'package:dub/src/model/create_link_request_geo.dart'; -import 'package:json_annotation/json_annotation.dart'; - -part 'edit_link_request.g.dart'; - - -@JsonSerializable( - checked: true, - createToJson: true, - disallowUnrecognizedKeys: false, - explicitToJson: true, -) -class EditLinkRequest { - /// Returns a new [EditLinkRequest] instance. - EditLinkRequest({ - - required this.url, - - this.domain, - - this.key, - - this.externalId, - - this.prefix, - - this.archived = false, - - this.publicStats = false, - - this.tagId, - - this.tagIds, - - this.tagNames, - - this.comments, - - this.expiresAt, - - this.expiredUrl, - - this.password, - - this.proxy = false, - - this.title, - - this.description, - - this.image, - - this.rewrite = false, - - this.ios, - - this.android, - - this.geo, - }); - - /// The destination URL of the short link. - @JsonKey( - - name: r'url', - required: true, - includeIfNull: false - ) - - - final String url; - - - - /// The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains). - @JsonKey( - - name: r'domain', - required: false, - includeIfNull: false - ) - - - final String? domain; - - - - /// The short link slug. If not provided, a random 7-character slug will be generated. - @JsonKey( - - name: r'key', - required: false, - includeIfNull: false - ) - - - final String? key; - - - - /// This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with `ext_` when passed as a query parameter. - @JsonKey( - - name: r'externalId', - required: false, - includeIfNull: false - ) - - - final String? externalId; - - - - /// The prefix of the short link slug for randomly-generated keys (e.g. if prefix is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if `key` is provided. - @JsonKey( - - name: r'prefix', - required: false, - includeIfNull: false - ) - - - final String? prefix; - - - - /// Whether the short link is archived. - @JsonKey( - defaultValue: false, - name: r'archived', - required: false, - includeIfNull: false - ) - - - final bool? archived; - - - - /// Whether the short link's stats are publicly accessible. - @JsonKey( - defaultValue: false, - name: r'publicStats', - required: false, - includeIfNull: false - ) - - - final bool? publicStats; - - - - /// The unique ID of the tag assigned to the short link. This field is deprecated – use `tagIds` instead. - @Deprecated('tagId has been deprecated') - @JsonKey( - - name: r'tagId', - required: false, - includeIfNull: false - ) - - - final String? tagId; - - - - /// The unique IDs of the tags assigned to the short link. - @JsonKey( - - name: r'tagIds', - required: false, - includeIfNull: false - ) - - - final List? tagIds; - - - - /// The unique name of the tags assigned to the short link (case insensitive). - @JsonKey( - - name: r'tagNames', - required: false, - includeIfNull: false - ) - - - final String? tagNames; - - - - /// The comments for the short link. - @JsonKey( - - name: r'comments', - required: false, - includeIfNull: false - ) - - - final String? comments; - - - - /// The date and time when the short link will expire at. - @JsonKey( - - name: r'expiresAt', - required: false, - includeIfNull: false - ) - - - final String? expiresAt; - - - - /// The URL to redirect to when the short link has expired. - @JsonKey( - - name: r'expiredUrl', - required: false, - includeIfNull: false - ) - - - final String? expiredUrl; - - - - /// The password required to access the destination URL of the short link. - @JsonKey( - - name: r'password', - required: false, - includeIfNull: false - ) - - - final String? password; - - - - /// Whether the short link uses Custom Social Media Cards feature. - @JsonKey( - defaultValue: false, - name: r'proxy', - required: false, - includeIfNull: false - ) - - - final bool? proxy; - - - - /// The title of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. - @JsonKey( - - name: r'title', - required: false, - includeIfNull: false - ) - - - final String? title; - - - - /// The description of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. - @JsonKey( - - name: r'description', - required: false, - includeIfNull: false - ) - - - final String? description; - - - - /// The image of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. - @JsonKey( - - name: r'image', - required: false, - includeIfNull: false - ) - - - final String? image; - - - - /// Whether the short link uses link cloaking. - @JsonKey( - defaultValue: false, - name: r'rewrite', - required: false, - includeIfNull: false - ) - - - final bool? rewrite; - - - - /// The iOS destination URL for the short link for iOS device targeting. - @JsonKey( - - name: r'ios', - required: false, - includeIfNull: false - ) - - - final String? ios; - - - - /// The Android destination URL for the short link for Android device targeting. - @JsonKey( - - name: r'android', - required: false, - includeIfNull: false - ) - - - final String? android; - - - - @JsonKey( - - name: r'geo', - required: false, - includeIfNull: false - ) - - - final CreateLinkRequestGeo? geo; - - - - @override - bool operator ==(Object other) => identical(this, other) || other is EditLinkRequest && - other.url == url && - other.domain == domain && - other.key == key && - other.externalId == externalId && - other.prefix == prefix && - other.archived == archived && - other.publicStats == publicStats && - other.tagId == tagId && - other.tagIds == tagIds && - other.tagNames == tagNames && - other.comments == comments && - other.expiresAt == expiresAt && - other.expiredUrl == expiredUrl && - other.password == password && - other.proxy == proxy && - other.title == title && - other.description == description && - other.image == image && - other.rewrite == rewrite && - other.ios == ios && - other.android == android && - other.geo == geo; - - @override - int get hashCode => - url.hashCode + - domain.hashCode + - key.hashCode + - (externalId == null ? 0 : externalId.hashCode) + - prefix.hashCode + - archived.hashCode + - publicStats.hashCode + - (tagId == null ? 0 : tagId.hashCode) + - tagIds.hashCode + - tagNames.hashCode + - (comments == null ? 0 : comments.hashCode) + - (expiresAt == null ? 0 : expiresAt.hashCode) + - (expiredUrl == null ? 0 : expiredUrl.hashCode) + - (password == null ? 0 : password.hashCode) + - proxy.hashCode + - (title == null ? 0 : title.hashCode) + - (description == null ? 0 : description.hashCode) + - (image == null ? 0 : image.hashCode) + - rewrite.hashCode + - (ios == null ? 0 : ios.hashCode) + - (android == null ? 0 : android.hashCode) + - (geo == null ? 0 : geo.hashCode); - - factory EditLinkRequest.fromJson(Map json) => _$EditLinkRequestFromJson(json); - - Map toJson() => _$EditLinkRequestToJson(this); - - @override - String toString() { - return toJson().toString(); - } - -} - diff --git a/lib/src/model/edit_link_request.g.dart b/lib/src/model/edit_link_request.g.dart deleted file mode 100644 index aef3844..0000000 --- a/lib/src/model/edit_link_request.g.dart +++ /dev/null @@ -1,85 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'edit_link_request.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -EditLinkRequest _$EditLinkRequestFromJson(Map json) => - $checkedCreate( - 'EditLinkRequest', - json, - ($checkedConvert) { - $checkKeys( - json, - requiredKeys: const ['url'], - ); - final val = EditLinkRequest( - url: $checkedConvert('url', (v) => v as String), - domain: $checkedConvert('domain', (v) => v as String?), - key: $checkedConvert('key', (v) => v as String?), - externalId: $checkedConvert('externalId', (v) => v as String?), - prefix: $checkedConvert('prefix', (v) => v as String?), - archived: $checkedConvert('archived', (v) => v as bool? ?? false), - publicStats: - $checkedConvert('publicStats', (v) => v as bool? ?? false), - tagId: $checkedConvert('tagId', (v) => v as String?), - tagIds: $checkedConvert('tagIds', - (v) => (v as List?)?.map((e) => e as String).toList()), - tagNames: $checkedConvert('tagNames', (v) => v as String?), - comments: $checkedConvert('comments', (v) => v as String?), - expiresAt: $checkedConvert('expiresAt', (v) => v as String?), - expiredUrl: $checkedConvert('expiredUrl', (v) => v as String?), - password: $checkedConvert('password', (v) => v as String?), - proxy: $checkedConvert('proxy', (v) => v as bool? ?? false), - title: $checkedConvert('title', (v) => v as String?), - description: $checkedConvert('description', (v) => v as String?), - image: $checkedConvert('image', (v) => v as String?), - rewrite: $checkedConvert('rewrite', (v) => v as bool? ?? false), - ios: $checkedConvert('ios', (v) => v as String?), - android: $checkedConvert('android', (v) => v as String?), - geo: $checkedConvert( - 'geo', - (v) => v == null - ? null - : CreateLinkRequestGeo.fromJson(v as Map)), - ); - return val; - }, - ); - -Map _$EditLinkRequestToJson(EditLinkRequest instance) { - final val = { - 'url': instance.url, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('domain', instance.domain); - writeNotNull('key', instance.key); - writeNotNull('externalId', instance.externalId); - writeNotNull('prefix', instance.prefix); - writeNotNull('archived', instance.archived); - writeNotNull('publicStats', instance.publicStats); - writeNotNull('tagId', instance.tagId); - writeNotNull('tagIds', instance.tagIds); - writeNotNull('tagNames', instance.tagNames); - writeNotNull('comments', instance.comments); - writeNotNull('expiresAt', instance.expiresAt); - writeNotNull('expiredUrl', instance.expiredUrl); - writeNotNull('password', instance.password); - writeNotNull('proxy', instance.proxy); - writeNotNull('title', instance.title); - writeNotNull('description', instance.description); - writeNotNull('image', instance.image); - writeNotNull('rewrite', instance.rewrite); - writeNotNull('ios', instance.ios); - writeNotNull('android', instance.android); - writeNotNull('geo', instance.geo?.toJson()); - return val; -} diff --git a/openapi.json b/openapi.json index 6617fed..e067d87 100644 --- a/openapi.json +++ b/openapi.json @@ -1065,7 +1065,10 @@ "name": "tagIds", "description": "The tag IDs to filter the links by.", "schema": { - "type": "string", + "type": "array", + "items": { + "type": "string" + }, "description": "The tag IDs to filter the links by." } }, @@ -1074,7 +1077,10 @@ "name": "tagNames", "description": "The unique name of the tags assigned to the short link (case insensitive).", "schema": { - "type": "string", + "type": "array", + "items": { + "type": "string" + }, "description": "The unique name of the tags assigned to the short link (case insensitive)." } }, @@ -1245,7 +1251,10 @@ "name": "tagIds", "description": "The tag IDs to filter the links by.", "schema": { - "type": "string", + "type": "array", + "items": { + "type": "string" + }, "description": "The tag IDs to filter the links by." } }, @@ -1254,7 +1263,10 @@ "name": "tagNames", "description": "The unique name of the tags assigned to the short link (case insensitive).", "schema": { - "type": "string", + "type": "array", + "items": { + "type": "string" + }, "description": "The unique name of the tags assigned to the short link (case insensitive)." } }, @@ -1301,7 +1313,10 @@ "name": "groupBy", "description": "The field to group the links by.", "schema": { - "type": "string", + "type": "array", + "items": { + "type": "string" + }, "description": "The field to group the links by." } } @@ -1553,7 +1568,10 @@ ] }, "tagNames": { - "type": "string", + "type": "array", + "items": { + "type": "string" + }, "description": "The unique name of the tags assigned to the short link (case insensitive)." }, "comments": { @@ -2611,7 +2629,10 @@ ] }, "tagNames": { - "type": "string", + "type": "array", + "items": { + "type": "string" + }, "description": "The unique name of the tags assigned to the short link (case insensitive)." }, "comments": { diff --git a/test/edit_link_request_test.dart b/test/edit_link_request_test.dart deleted file mode 100644 index c4bdd52..0000000 --- a/test/edit_link_request_test.dart +++ /dev/null @@ -1,142 +0,0 @@ -import 'package:test/test.dart'; -import 'package:dub/dub.dart'; - -// tests for EditLinkRequest -void main() { - final EditLinkRequest? instance = /* EditLinkRequest(...) */ null; - // TODO add properties to the entity - - group(EditLinkRequest, () { - // The destination URL of the short link. - // String url - test('to test the property `url`', () async { - // TODO - }); - - // The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains). - // String domain - test('to test the property `domain`', () async { - // TODO - }); - - // The short link slug. If not provided, a random 7-character slug will be generated. - // String key - test('to test the property `key`', () async { - // TODO - }); - - // This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with `ext_` when passed as a query parameter. - // String externalId - test('to test the property `externalId`', () async { - // TODO - }); - - // The prefix of the short link slug for randomly-generated keys (e.g. if prefix is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if `key` is provided. - // String prefix - test('to test the property `prefix`', () async { - // TODO - }); - - // Whether the short link is archived. - // bool archived (default value: false) - test('to test the property `archived`', () async { - // TODO - }); - - // Whether the short link's stats are publicly accessible. - // bool publicStats (default value: false) - test('to test the property `publicStats`', () async { - // TODO - }); - - // The unique ID of the tag assigned to the short link. This field is deprecated – use `tagIds` instead. - // String tagId - test('to test the property `tagId`', () async { - // TODO - }); - - // The unique IDs of the tags assigned to the short link. - // List tagIds - test('to test the property `tagIds`', () async { - // TODO - }); - - // The unique name of the tags assigned to the short link (case insensitive). - // String tagNames - test('to test the property `tagNames`', () async { - // TODO - }); - - // The comments for the short link. - // String comments - test('to test the property `comments`', () async { - // TODO - }); - - // The date and time when the short link will expire at. - // String expiresAt - test('to test the property `expiresAt`', () async { - // TODO - }); - - // The URL to redirect to when the short link has expired. - // String expiredUrl - test('to test the property `expiredUrl`', () async { - // TODO - }); - - // The password required to access the destination URL of the short link. - // String password - test('to test the property `password`', () async { - // TODO - }); - - // Whether the short link uses Custom Social Media Cards feature. - // bool proxy (default value: false) - test('to test the property `proxy`', () async { - // TODO - }); - - // The title of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. - // String title - test('to test the property `title`', () async { - // TODO - }); - - // The description of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. - // String description - test('to test the property `description`', () async { - // TODO - }); - - // The image of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true. - // String image - test('to test the property `image`', () async { - // TODO - }); - - // Whether the short link uses link cloaking. - // bool rewrite (default value: false) - test('to test the property `rewrite`', () async { - // TODO - }); - - // The iOS destination URL for the short link for iOS device targeting. - // String ios - test('to test the property `ios`', () async { - // TODO - }); - - // The Android destination URL for the short link for Android device targeting. - // String android - test('to test the property `android`', () async { - // TODO - }); - - // CreateLinkRequestGeo geo - test('to test the property `geo`', () async { - // TODO - }); - - }); -} diff --git a/test/links_api_test.dart b/test/links_api_test.dart index 43e7787..daf6647 100644 --- a/test/links_api_test.dart +++ b/test/links_api_test.dart @@ -11,7 +11,7 @@ void main() { // // Bulk create up to 100 links for the authenticated workspace. // - //Future> bulkCreateLinks(String workspaceId, { String projectSlug, List editLinkRequest }) async + //Future> bulkCreateLinks(String workspaceId, { String projectSlug, List createLinkRequest }) async test('test bulkCreateLinks', () async { // TODO }); @@ -38,7 +38,7 @@ void main() { // // Edit a link for the authenticated workspace. // - //Future editLink(String linkId, String workspaceId, { String projectSlug, EditLinkRequest editLinkRequest }) async + //Future editLink(String linkId, String workspaceId, { String projectSlug, CreateLinkRequest createLinkRequest }) async test('test editLink', () async { // TODO }); @@ -56,7 +56,7 @@ void main() { // // Retrieve a list of links for the authenticated workspace. The list will be paginated and the provided query parameters allow filtering the returned links. // - //Future> getLinks(String workspaceId, { String projectSlug, String domain, String tagId, String tagIds, String tagNames, String search, String userId, bool showArchived, bool withTags, String sort, num page }) async + //Future> getLinks(String workspaceId, { String projectSlug, String domain, String tagId, List tagIds, List tagNames, String search, String userId, bool showArchived, bool withTags, String sort, num page }) async test('test getLinks', () async { // TODO }); @@ -65,7 +65,7 @@ void main() { // // Retrieve the number of links for the authenticated workspace. The provided query parameters allow filtering the returned links. // - //Future getLinksCount(String workspaceId, { String projectSlug, String domain, String tagId, String tagIds, String tagNames, String search, String userId, bool showArchived, bool withTags, String groupBy }) async + //Future getLinksCount(String workspaceId, { String projectSlug, String domain, String tagId, List tagIds, List tagNames, String search, String userId, bool showArchived, bool withTags, List groupBy }) async test('test getLinksCount', () async { // TODO });