|
| 1 | +// |
| 2 | +// GTNote.h |
| 3 | +// ObjectiveGitFramework |
| 4 | +// |
| 5 | +// Created by Slava Karpenko on 5/16/2016. |
| 6 | +// |
| 7 | +// The MIT License |
| 8 | +// |
| 9 | +// Copyright (c) 2016 Wildbit LLC |
| 10 | +// |
| 11 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 12 | +// of this software and associated documentation files (the "Software"), to deal |
| 13 | +// in the Software without restriction, including without limitation the rights |
| 14 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 15 | +// copies of the Software, and to permit persons to whom the Software is |
| 16 | +// furnished to do so, subject to the following conditions: |
| 17 | +// |
| 18 | +// The above copyright notice and this permission notice shall be included in |
| 19 | +// all copies or substantial portions of the Software. |
| 20 | +// |
| 21 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 22 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 23 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 24 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 25 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 26 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 27 | +// THE SOFTWARE. |
| 28 | +// |
| 29 | + |
| 30 | +#import <Foundation/Foundation.h> |
| 31 | +#import "git2/oid.h" |
| 32 | + |
| 33 | +@class GTSignature; |
| 34 | +@class GTRepository; |
| 35 | +@class GTOID; |
| 36 | +@class GTObject; |
| 37 | + |
| 38 | +NS_ASSUME_NONNULL_BEGIN |
| 39 | + |
| 40 | +@interface GTNote : NSObject {} |
| 41 | + |
| 42 | +/// The author of the note. |
| 43 | +@property (nonatomic, readonly, strong, nullable) GTSignature *author; |
| 44 | + |
| 45 | +/// The committer of the note. |
| 46 | +@property (nonatomic, readonly, strong, nullable) GTSignature *committer; |
| 47 | + |
| 48 | +/// Content of the note. |
| 49 | +@property (nonatomic, readonly, strong) NSString *note; |
| 50 | + |
| 51 | +@property (nonatomic, readonly, strong) GTObject *target; |
| 52 | + |
| 53 | +/// The underlying `git_note` object. |
| 54 | +- (git_note *)git_note __attribute__((objc_returns_inner_pointer)); |
| 55 | + |
| 56 | +/// Create a note with target OID in the given repository. |
| 57 | +/// |
| 58 | +/// oid - OID of the target to attach to |
| 59 | +/// repository - Repository containing the target OID refers to |
| 60 | +/// referenceName - Name for the notes reference in the repo, or nil for default ("refs/notes/commits") |
| 61 | +/// error - Will be filled with a NSError object in case of error. |
| 62 | +/// May be NULL. |
| 63 | +/// |
| 64 | +/// Returns initialized GTNote instance or nil on failure (error will be populated, if passed). |
| 65 | +- (nullable instancetype)initWithTargetOID:(GTOID *)oid repository:(GTRepository *)repository referenceName:(nullable NSString *)referenceName error:(NSError **)error; |
| 66 | + |
| 67 | +/// Create a note with target libgit2 oid in the given repository. |
| 68 | +/// |
| 69 | +/// oid - git_oid of the target to attach to |
| 70 | +/// repository - Repository containing the target OID refers to |
| 71 | +/// referenceName - Name for the notes reference in the repo, or NULL for default ("refs/notes/commits") |
| 72 | +/// |
| 73 | +/// Returns initialized GTNote instance or nil on failure. |
| 74 | +- (nullable instancetype)initWithTargetGitOID:(git_oid *)oid repository:(git_repository *)repository referenceName:(const char * _Nullable)referenceName error:(NSError **)error NS_DESIGNATED_INITIALIZER; |
| 75 | + |
| 76 | +- (instancetype)init NS_UNAVAILABLE; |
| 77 | + |
| 78 | + |
| 79 | +/// Return a default reference name (that is used if you pass nil to any referenceName parameter) |
| 80 | +/// |
| 81 | +/// repository - Repository for which to get the default notes reference name. |
| 82 | +/// error - Will be filled with a git error code in case of error. |
| 83 | +/// May be NULL. |
| 84 | +/// |
| 85 | +/// Returns default reference name (usually "refs/notes/commits"). |
| 86 | ++ (nullable NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error:(NSError **)error; |
| 87 | + |
| 88 | +@end |
| 89 | + |
| 90 | +NS_ASSUME_NONNULL_END |
| 91 | + |
0 commit comments