Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullability annotations #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Nocilla/DSL/LSStubRequestDSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@

@protocol LSHTTPBody;

typedef LSStubRequestDSL *(^WithHeaderMethod)(NSString *, NSString *);
typedef LSStubRequestDSL *(^WithHeadersMethod)(NSDictionary *);
typedef LSStubRequestDSL *(^AndBodyMethod)(id<LSMatcheable>);
typedef LSStubResponseDSL *(^AndReturnMethod)(NSInteger);
typedef LSStubResponseDSL *(^AndReturnRawResponseMethod)(NSData *rawResponseData);
typedef void (^AndFailWithErrorMethod)(NSError *error);
typedef LSStubRequestDSL * _Nonnull (^WithHeaderMethod)(NSString * _Nonnull, NSString * _Nullable);
typedef LSStubRequestDSL * _Nonnull (^WithHeadersMethod)(NSDictionary * _Nullable);
typedef LSStubRequestDSL * _Nonnull (^AndBodyMethod)(_Nullable id<LSMatcheable>);
typedef LSStubResponseDSL * _Nonnull (^AndReturnMethod)(NSInteger);
typedef LSStubResponseDSL * _Nonnull (^AndReturnRawResponseMethod)(NSData * _Nonnull rawResponseData);
typedef void (^AndFailWithErrorMethod)(NSError * _Nonnull error);

@interface LSStubRequestDSL : NSObject
- (id)initWithRequest:(LSStubRequest *)request;
- (id _Nonnull)initWithRequest:(LSStubRequest * _Nonnull)request;

@property (nonatomic, strong, readonly) WithHeaderMethod withHeader;
@property (nonatomic, strong, readonly) WithHeadersMethod withHeaders;
@property (nonatomic, strong, readonly) AndBodyMethod withBody;
@property (nonatomic, strong, readonly) AndReturnMethod andReturn;
@property (nonatomic, strong, readonly) AndReturnRawResponseMethod andReturnRawResponse;
@property (nonatomic, strong, readonly) AndFailWithErrorMethod andFailWithError;
@property (nonatomic, strong, readonly) _Nonnull WithHeaderMethod withHeader;
@property (nonatomic, strong, readonly) _Nonnull WithHeadersMethod withHeaders;
@property (nonatomic, strong, readonly) _Nonnull AndBodyMethod withBody;
@property (nonatomic, strong, readonly) _Nonnull AndReturnMethod andReturn;
@property (nonatomic, strong, readonly) _Nonnull AndReturnRawResponseMethod andReturnRawResponse;
@property (nonatomic, strong, readonly) _Nonnull AndFailWithErrorMethod andFailWithError;

@end

#ifdef __cplusplus
extern "C" {
#endif
LSStubRequestDSL * stubRequest(NSString *method, id<LSMatcheable> url);

LSStubRequestDSL * _Nonnull stubRequest(NSString * _Nonnull method, _Nonnull id<LSMatcheable> url);

#ifdef __cplusplus
}
#endif
14 changes: 7 additions & 7 deletions Nocilla/DSL/LSStubResponseDSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

@protocol LSHTTPBody;

typedef LSStubResponseDSL *(^ResponseWithBodyMethod)(id<LSHTTPBody>);
typedef LSStubResponseDSL *(^ResponseWithHeaderMethod)(NSString *, NSString *);
typedef LSStubResponseDSL *(^ResponseWithHeadersMethod)(NSDictionary *);
typedef LSStubResponseDSL * _Nonnull (^ResponseWithBodyMethod)(_Nullable id<LSHTTPBody>);
typedef LSStubResponseDSL * _Nonnull (^ResponseWithHeaderMethod)(NSString * _Nonnull, NSString * _Nullable);
typedef LSStubResponseDSL * _Nonnull (^ResponseWithHeadersMethod)(NSDictionary * _Nonnull);

@interface LSStubResponseDSL : NSObject
- (id)initWithResponse:(LSStubResponse *)response;
- (id _Nonnull)initWithResponse:(LSStubResponse * _Nonnull)response;

@property (nonatomic, strong, readonly) ResponseWithHeaderMethod withHeader;
@property (nonatomic, strong, readonly) ResponseWithHeadersMethod withHeaders;
@property (nonatomic, strong, readonly) ResponseWithBodyMethod withBody;
@property (nonatomic, strong, readonly) _Nonnull ResponseWithHeaderMethod withHeader;
@property (nonatomic, strong, readonly) _Nonnull ResponseWithHeadersMethod withHeaders;
@property (nonatomic, strong, readonly) _Nonnull ResponseWithBodyMethod withBody;

@end