-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNSURL+URLQueryBuilder.h
104 lines (77 loc) · 5.28 KB
/
NSURL+URLQueryBuilder.h
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
//
// NSURL+URLQueryBuilder.h
// NSURLComponents
//
// Created by Yaroslav Arsenkin on 26.10.15.
// Copyright © 2015 Iaroslav Arsenkin. All rights reserved.
// Website: http://arsenkin.com
//
@import Foundation;
@interface NSURL (URLQueryBuilder)
NS_ASSUME_NONNULL_BEGIN
/*!
Builds the request URL from incoming base URL and queries.
@params URL String object, that represents base URL.
@params queryElements Dictionary of query elements. Key is query name and value is query's value.
@return NSURL Complete request URL ready for use.
*/
+ (NSURL *)ars_queryWithString:(NSString *)URL queryElements:(NSDictionary<NSString *,NSString *> *)queryElements;
/*!
Builds the request URL from incoming base URL and queries.
@params URL URL object, that represents base URL.
@params queryElements Dictionary of query elements. Key is query name and value is query's value.
@return NSURL Complete request URL ready for use.
*/
+ (NSURL *)ars_queryWithURL:(NSURL *)URL queryElements:(NSDictionary<NSString *,NSString *> *)queryElements;
/*!
Builds the request URL from incoming base URL and queries, with ability to resolve URL against its base URL.
@params URL String object, that represents base URL.
@params queryElements Dictionary of query elements. Key is query name and value is query's value.
@params resolveAgainstBaseURL BOOL object, that states, whether resolving against base URL should be done or not.
@return NSURL Complete request URL ready for use.
*/
+ (NSURL *)ars_queryWithString:(NSString *)URL queryElements:(NSDictionary<NSString *, NSString *> *)queryElements resolveAgainstBaseURL:(BOOL)resolve;
/*!
Builds the request URL from incoming base URL and queries, with ability to resolve URL against its base URL.
@params URL URL object, that represents base URL.
@params queryElements Dictionary of query elements. Key is query name and value is query's value.
@params resolveAgainstBaseURL BOOL object, that states, whether resolving against base URL should be done or not.
@return NSURL Complete request URL ready for use.
*/
+ (NSURL *)ars_queryWithURL:(NSURL *)URL queryElements:(NSDictionary<NSString *, NSString *> *)queryElements resolveAgainstBaseURL:(BOOL)resolve;
/*!
Builds the request URL from incoming base URL and queries as well as ability to write NSURLComponents object that has been used to generate the URL for further use.
@params URL String object, that represents base URL.
@params queryElements Dictionary of query elements. Key is query name and value is query's value.
@params URLComponent NSURLComponents, that has been created to generate the URL, is going to be written to this variable.
@return NSURL Complete request URL ready for use.
*/
+ (NSURL *)ars_queryWithString:(NSString *)URL queryElements:(NSDictionary<NSString *, NSString *> *)queryElements URLComponent:(NSURLComponents * _Nullable * _Nullable)URLComponent;
/*!
Builds the request URL from incoming base URL and queries as well as ability to write NSURLComponents object that has been used to generate the URL for further use.
@params URL URL object, that represents base URL.
@params queryElements Dictionary of query elements. Key is query name and value is query's value.
@params URLComponent NSURLComponents, that has been created to generate the URL, is going to be written to this variable.
@return NSURL Complete request URL ready for use.
*/
+ (NSURL *)ars_queryWithURL:(NSURL *)URL queryElements:(NSDictionary<NSString *, NSString *> *)queryElements URLComponent:(NSURLComponents * _Nullable * _Nullable)URLComponent;
/*!
Builds the request URL from incoming base URL and queries, with ability to resolve URL against its base URL, as well as ability to write NSURLComponents object that has been used to generate the URL for further use.
@params URL String object, that represents base URL.
@params queryElements Dictionary of query elements. Key is query name and value is query's value.
@params resolveAgainstBaseURL BOOL object, that states, whether resolving against base URL should be done or not.
@params URLComponent NSURLComponents, that has been created to generate the URL, is going to be written to this variable.
@return NSURL Complete request URL ready for use.
*/
+ (NSURL *)ars_queryWithString:(NSString *)URL queryElements:(NSDictionary<NSString *, NSString *> *)queryElements resolveAgainstBaseURL:(BOOL)resolve URLComponent:( NSURLComponents * _Nullable * _Nullable)URLComponent;
/*!
Builds the request URL from incoming base URL and queries, with ability to resolve URL against its base URL, as well as ability to write NSURLComponents object that has been used to generate the URL for further use.
@params URL String object, that represents base URL.
@params queryElements Dictionary of query elements. Key is query name and value is query's value.
@params resolveAgainstBaseURL BOOL object, that states, whether resolving against base URL should be done or not.
@params URLComponent NSURLComponents, that has been created to generate the URL, is going to be written to this variable.
@return NSURL Complete request URL ready for use.
*/
+ (NSURL *)ars_queryWithURL:(NSURL *)URL queryElements:(NSDictionary<NSString *, NSString *> *)queryElements resolveAgainstBaseURL:(BOOL)resolve URLComponent:(NSURLComponents * _Nullable * _Nullable)URLComponent;
NS_ASSUME_NONNULL_END
@end